Hey guys, i need help. test bench file don't working :(((((((
this is verilog module
module kursinis(clk, SB, O35, O4, CB, LED2ON, LED1, LED3, LED2BLINK,
state);
// SB-START_BUTTON, O3-OVER_3V, O4-OVER_4V, CB- CONTROL_BUTTON
input clk, SB, O35, O4, CB;
output LED2ON, LED1, LED3, LED2BLINK;
output [2:0]state;
//busenos DB-dead battery, LB- low battery, FB- full battery,
C1-calibrated1, C2-calibtrated2
parameter OFF= 3'b001, DB= 3'b010, LB= 3'b011, FB= 3'b100, C1=
3'b101, C2=3'b110;
//esamos busenos registras ir kitos busenos signalas
reg [2:0] state_reg, state_next;
reg LED2ON, LED1, LED3, LED2BLINK;
assign state = state_reg;
// busenu registro perrasymas
always @(posedge clk)
begin
state_reg <= state_next;
end
// kitos busenos skaiciavimas
always @(state_reg, clk, SB, O35, O4, CB)
begin
case(state_reg)
OFF : if (SB == 1'b1) begin
state_next <= DB;
LED2ON <= 1'b1;
end
else begin
state_next <= OFF;
end
DB : if (SB == 1'b0) begin
state_next <= OFF;
LED2ON <= 1'b0;
end else if (O35 == 1'b1) begin
state_next <= LB;
LED2ON <= 1'b0;
LED2BLINK <= 1'b1;
end
else begin
state_next <= DB;
end
LB : if (SB == 1'b0) begin
state_next <= OFF;
LED2BLINK <= 1'b0;
end else if (O4 == 1'b1) begin
state_next <= FB;
LED2BLINK <= 1'b0;
LED1 <= 1'b1;
end else if (O35 == 0'b1) begin
state_next <= DB;
LED2BLINK <= 1'b0;
LED2ON <= 1'b1;
end else if (CB == 1'b1) begin
state_next <= C1;
LED3 <= 1'b1;
end
else begin
state_next <=LB;
end
FB : if (SB == 1'b0) begin
state_next <= OFF;
LED1 <= 1'b0;
end else if (O4 == 1'b0) begin
state_next <= LB;
LED2BLINK <= 1'b1;
LED1 <= 1'b0;
end else if (CB == 1'b1) begin
state_next <= C2;
LED3 <= 1'b1;
end
else begin
state_next <=FB;
end
C1 : if (SB == 1'b0) begin
state_next <= OFF;
LED3 <= 1'b0;
LED2BLINK <= 1'b0;
end else if (CB == 1'b0) begin
state_next <= LB;
LED3 <= 1'b0;
end else if (O35 == 1'b0) begin
state_next <= DB;
LED3 <= 1'b0;
LED2ON <= 1'b1;
LED2BLINK <= 1'b0;
end
else begin
state_next <= C1;
end
C2 : if (SB == 1'b0) begin
state_next <= OFF;
LED3 <= 1'b0;
LED1 <= 1'b0;
end else if (CB == 1'b0) begin
state_next <= FB;
LED3 <= 1'b0;
end else if (O4 == 1'b0) begin
state_next <= C1;
LED1 <= 1'b0;
LED2BLINK <= 1'b1;
end
else begin
state_next <= C2;
end
endcase
end
endmodule
////////////////////////////////////////////////////////////////
and this is test bench file
module kursinis_tb;
reg clk, SB, O35, O4, CB;
output LED2ON, LED1, LED3, LED2BLINK;
output [2:0]state;
kursinis pirmas(
.clk (clk),
.SB (SB),
.O35 (O35),
.O4 (O4),
.CB (CB),
.LED2ON (LED2ON),
.LED1 (LED1),
.LED3 (LED3),
.LED2BLINK (LED2BLINK),
.state (state)
);
initial
begin
clk =0;
SB=0;
O35=0;
O4=0;
CB=0;
end
always
#50 clk = !clk;
initial
begin
#100 SB=1;
#100 O35=1;
#5000 $stop;
end
endmodule