cg.v
917 Bytes
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
// $Id: cg.v,v 1.1 2002/05/21 23:55:43 berndt Exp $
`timescale 1ns/100ps
module cg(clock, reset_l);
`include "reality.vh"
// clock generator controls
parameter RAMBUS_CLOCK_PERIOD = 16.0; // 250 MHz Rambus
// parameter RAMBUS_CLOCK_PERIOD = 5.0; // 200 MHz Rambus
parameter RESET_ACTIVE_DELAY = 20; // system clocks
parameter RESET_IDLE_DELAY = 2000; // system clocks
output clock;
output reset_l;
reg reset_l;
reg bus_clk;
integer clock_count;
always #(RAMBUS_CLOCK_PERIOD / 2) bus_clk = ~bus_clk;
assign clock = bus_clk;
always @(posedge clock) clock_count <= reset_l ? clock_count + 1 : 0;
initial begin
$dumpvars;
// wait for clock
bus_clk <= HIGH;
reset_l <= LOW;
wait (clock)
repeat (RESET_ACTIVE_DELAY) @(posedge clock);
reset_l <= HIGH;
repeat (RESET_IDLE_DELAY) @(posedge clock);
//$finish;
reset_l <= LOW;
repeat (RESET_ACTIVE_DELAY) @(posedge clock);
reset_l <= HIGH;
end
endmodule