OK, So How Do I Create a Program Block?
A program block, as we mentioned earlier, is enclosed within the
keywords program and endprogram (similar to a
module being defined within module and endmodule
Following is an example of a program module.
program my_prog ( input clk
, input reset
, input [7:0] in_pkt
, output [7:0] out_pkt
out_pkt = 8'h0;
A program module can be defined independently similar to a module
and then instantiated within a module. Or, it can be defined within
a module itself.
This later type of definition (within a module) is known as implicit
definition. In such a case, both the program name and the instance
names are identical (e.g., my_prog in the above example). Also,
a module variable (such as the integer i above) will also be
accessible from the program my_prog.