Packages in System Verilog

Here are some of points for packages in SV

  • By default , if no package defined , variable will be in $unit package.
  • It is good idea to have package which helps in code management and also for separate compilation flow.
  • Generally Package should not have any dependency on other package or hierarchical path , If other package is required then import that package.
  • Do not include interface inside package , but it should be included in package file. e.g.

This is how ideal package file looks like.

`include “if.sv”

package x ;

`include “driver_class.sv”

`include “monitor_class.sv”

—–

—-

endpackage

  • package can not access variables declared in $unit package.
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s