A module and a program block carry many similarities.
- Similar to a module, a program block may have zero or more inputs, outputs and inout ports.
- A program block can contain zero or more initial blocks, cont assignments, generate and specparam statements, concurrent assertions and timunit declarations.
- Type and data declarations, functions and tasks can be defined within a program block similar to what you can do in a module.
- A hierarchy can contain any number of program blocks. These program blocks may interact throughtheir ports or may be isolated from one other. This is how modules work too in a design environment.
However, the similarities end there. Here are some of the differences.
- A program block can not contain any always statement, UDP, module, interface or other program. Thus a program block is always a leaf level node in a hierarchy.
- A program definition can occur within a module as we saw earlier. Obviously, a module can not be defined this way.
- A program can call a task or function in modules or other programs. But a module can not call a task or function in a program.
reference