1
0
mirror of https://github.com/antonblanchard/chiselwatt.git synced 2026-05-02 14:30:15 +00:00
Files
antonblanchard.chiselwatt/toplevel.v
Anton Blanchard 858ac3281c Fix a few issues in toplevel.v
Vivado and verilator flagged a few issues.

Signed-off-by: Anton Blanchard <anton@linux.ibm.com>
2020-01-30 18:11:46 +11:00

48 lines
592 B
Verilog

module toplevel(
input clock,
input reset,
output io_tx,
input io_rx,
output io_terminate,
output io_ledB,
output io_ledC
);
wire clock_out;
logic reset_out;
wire lock;
pll_ecp5_evn 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)
);
logic [21:0] cnt = ~0;
always_ff@(posedge clock)
begin
if (~lock || ~reset)
begin
cnt <= ~0;
end
else if (cnt != 0)
begin
cnt <= cnt - 1;
end
reset_out <= |cnt;
end
endmodule