lundi 23 avril 2018

if else statement in 4-bit ripple Carry adder testbench vivado

The code below is for a 4-bit ripple carry adder testbench. it's giving me 8 syntax errors, 4 near end and 4 near else. i don't know what these errors are referring to, what to do need to fix?

module rca_dataflow_tb(

reg [3:0] a,
reg [3:0] b,
reg cin,
reg [3:0] s,
reg cout

);

rca_dataflow uut(.a(a),.b(b),.cin(cin),.s(s),.cout(cout));

initial 
begin

#20
a = 4'b0;
b = 4'b0;
cin = 1'b0;
#20
if (s == 4'b0000 & cout == 1'b0) 
$display("Test Passed")
else 
$display("Test Failed")
end

#20
a = 4'b0010;
b = 4'b0000;
cin = 1'b0;
#20
if (s == 4'b0010 & cout == 1'b0)
$display("Test Passed")
else 
$display("Test Failed")
end


end
endmodule

Aucun commentaire:

Enregistrer un commentaire