cg.v
1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// $Id: cg.v,v 1.1.1.1 2002/05/17 06:14:58 blythe Exp $
`timescale 1ns/100ps
module cg(clock, reset_l, bus_clk, vbus_clock);
`include "reality.vh"
`include "define.vh"
parameter RAMBUS_CLOCK_PERIOD = 4.0; // 250 MHz Rambus
input reset_l;
input clock;
output bus_clk;
output vbus_clock;
reg bus_clk;
reg vbus_clock;
integer clock_count;
initial bus_clk = HIGH;
// freeze vclk flag
reg freeze_vclk;
initial freeze_vclk = LOW;
reg tssi_capture;
initial
begin
tssi_capture = 0;
if ($test$plusargs("rcp_test_tssi") || $test$plusargs("rcp_full_tssi") ||
$test$plusargs("rcp_attest_tab") || $test$plusargs("rcp_hp330_tssi"))
begin
tssi_capture = 1;
vbus_clock = LOW;
end
else
vbus_clock = HIGH;
end
always #(RAMBUS_CLOCK_PERIOD / 2) bus_clk = ~bus_clk;
always #(RAMBUS_CLOCK_PERIOD * 2)
begin
if (tssi_capture)
vbus_clock = ~vbus_clock || freeze_vclk;
end
always #((RAMBUS_CLOCK_PERIOD * 5 )/ 2)
begin
if (!tssi_capture)
vbus_clock = ~vbus_clock;
end
always @(posedge clock) clock_count <= reset_l ? clock_count + 1 : 0;
endmodule