I'm new to Verilog coding and I have a college project to design a simple elevator system. The code worked perfectly fine on the FPGA but I cannot get the simulation to work. This is my code:
module move(
output reg [1:0] current,
input [1:0] target,
input clk,
input overloadin,
output reg up,
output reg down
);
always@(posedge clk)
if (overloadin==1'b0)
begin
if (target[1:0]>current[1:0])
begin
current[1:0] <= current[1:0] + 1;
up = 1'b1;
down = 1'b0;
end
else if (target[1:0]<current[1:0])
begin
current[1:0] <= current[1:0] - 1;
down = 1'b1;
up = 1'b0;
end
else
begin
up = 1'b0;
down = 1'b0;
end
end
endmodule
'current' is declared as wire in the top module. I'm assuming I cannot simulate it because the value of 'current' was not initialized. How can I initialize the value of it without affecting the functionality of the always block?