1
0
mirror of https://github.com/antonblanchard/chiselwatt.git synced 2026-05-03 22:58:45 +00:00
Files
antonblanchard.chiselwatt/toplevel.v
Anton Blanchard f138ab7c7c Initial import
2020-01-30 05:20:07 +11:00

48 lines
585 B
Verilog

module toplevel(
input clock,
input reset,
output io_tx,
input io_rx,
output io_terminate,
output io_ledB,
output io_ledC
);
wire clk_out;
wire 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)
begin
cnt <= cnt - 1;
end
reset_out <= |cnt;
end
endmodule