-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathtoplevel.v
More file actions
45 lines (38 loc) · 717 Bytes
/
Copy pathtoplevel.v
File metadata and controls
45 lines (38 loc) · 717 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
44
45
module toplevel #(
parameter RESET_LOW = 1
) (
input clock,
input reset,
output io_tx,
input io_rx,
output io_terminate,
output io_ledB,
output io_ledC
);
wire clock_out;
reg reset_out;
wire lock;
Chiselwatt_pll chiselwatt_pll(
.clki(clock),
.clko(clock_out),
.lock(lock)
);
Core core(
.clock(clock_out),
.reset(reset_out),
.io_tx(io_tx),
.io_rx(io_rx),
.io_terminate(io_terminate),
.io_ledB(io_ledB),
.io_ledC(io_ledC)
);
reg [21:0] cnt = ~0;
always@(posedge clock) begin
if (~lock || (reset ^ RESET_LOW)) begin
cnt <= ~0;
end else if (cnt != 0) begin
cnt <= cnt - 1;
end
reset_out <= |cnt;
end
endmodule