Difference between program and module block
- A program block can not instantiate a module block. On the opposite side, a module block can instantiate another module or program block.
- A program block can not have an interface, user-defined primitives (UDP), always block or nested program.
- The initial block inside the program block is scheduled in the reactive region whereas the initial blocks inside the module lock are scheduled in the active region.
// Code your testbench here
// or browse Examples
program tb_pro(input [3:0] out);
initial begin
if(out == 2)
$display("Design assigned out is 2");
else
$display("Design assigned out = %0d", out);
end
endprogram
module dut_example (output bit [3:0] out);
initial begin
out <= 2;
end
endmodule
module tb_mod_top;
wire [3:0] out;
dut_example DUT(out);
tb_pro tb(out);
endmodule
Output:
Design assigned out is 2