I am new to verilog and I understand it is not a sequential language. So, I wanted to ask is there some way to display results in a module after some execution?Because display should always be inside initial
block and so there is no way I can use display for debugging purposes. Here is a sample code which may better explain my problem-
module A(a,b,c);
input a,b;
output c;
assign c=a&b;
initial
$display("%b",c);
endmodule
module testbench11;
reg a,b;
wire c;
A a1(a,b,c);
initial
$monitor(,$time,"a=%b,b=%b,c=%b",a,b,c);
initial
begin
#0 a=1'b0;b=1'b0;
#3 a=1'b0;b=1'b0;
#3 a=1'b0;b=1'b0;
end
endmodule
So I want to display the result of c
after every time instance so as to check whether I am getting desired output. It may seem to display results at the end in this case, but in some complex problems I wanted to use display
for debugging purposes just as I use printf
in C. Is there some way to do that in verilog?