SV program与module的区别

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.

However, the biggest difference between a program and a module is the way they handle variable assignments in procedural blocks. We will see in the next section this is where the utility of a program comes into effect.

reference

http://www.project-veripage.com/program_blocks_2.php 

posted on 2012-04-06 04:08  单向度的人  阅读(1078)  评论(0编辑  收藏  举报

导航