Files
learn-fpga/FemtoRV/TUTORIALS/FROM_BLINKER_TO_RISCV/step1.v
2022-03-20 10:34:51 +01:00

44 lines
605 B
Verilog

/**
* Step 1: simulation of a Blinker
* Usage:
* iverilog step1.v
* vvp a.out
* to exit: <ctrl><c> then finish
*/
`default_nettype none
module Blink (
input clock,
output led
);
reg count;
initial begin
count = 0;
end
always @(posedge clock) begin
count <= ~count;
end
assign led = count;
endmodule
module bench();
reg clock;
wire led;
Blink uut(
.clock(clock),
.led(led)
);
initial begin
clock = 0;
forever begin
#1 clock = ~clock;
$display("LED = %b",led);
end
end
endmodule