Verification Guild
A Community of Verification Professionals

 Create an AccountHome | Calendar | Downloads | FAQ | Links | Site Admin | Your Account  

Login
Nickname

Password

Security Code: Security Code
Type Security Code
BACKWARD

Don't have an account yet? You can create one. As a registered user you have some advantages like theme manager, comments configuration and post comments with your name.

Modules
· Home
· Downloads
· FAQ
· Feedback
· Recommend Us
· Web Links
· Your Account

Advertising

Who's Online
There are currently, 38 guest(s) and 0 member(s) that are online.

You are Anonymous user. You can register for free by clicking here

  
Verification Guild: Forums

 Forum FAQForum FAQ   SearchSearch   UsergroupsUsergroups   ProfileProfile  ProfileDigest    Log inLog in 

How to use packages sensibly

 
Post new topic   Reply to topic    Verification Guild Forum Index -> Main
View previous topic :: View next topic  
Author Message
tzar
Senior
Senior


Joined: Nov 28, 2007
Posts: 69

PostPosted: Mon Sep 05, 2011 7:53 am    Post subject: How to use packages sensibly Reply with quote

Hi,
I often see it recommended that one should group related c;ass definitions into a single package. For example I have seen it recommended that all components of a UVM agent be defined in a single package. In one sense this seems reasonable in that if you want to make use of the agent you have a single source for all components. However this would make the package file a long,complex and difficult to edit file. If a revision control mechanism is being used only one person can work on any element of the agent (assuming only single checkouts are allowed).

In the past I have always preferred to keep each component in a separate file as I have found this easier to work with.

Is it all down to a matter of personal preference or am I missing the big picture?

Thanks
Back to top
View user's profile
vhdlcohen
Industry Expert
Industry Expert


Joined: Jan 05, 2004
Posts: 1237
Location: Los Angeles, CA

PostPosted: Mon Sep 05, 2011 8:41 am    Post subject: Re: How to use packages sensibly Reply with quote

tzar wrote:
Hi,
I often see it recommended that one should group related c;ass definitions into a single package. For example I have seen it recommended that all components of a UVM agent be defined in a single package. In one sense this seems reasonable in that if you want to make use of the agent you have a single source for all components. However this would make the package file a long,complex and difficult to edit file. If a revision control mechanism is being used only one person can work on any element of the agent (assuming only single checkouts are allowed).

In the past I have always preferred to keep each component in a separate file as I have found this easier to work with.

Is it all down to a matter of personal preference or am I missing the big picture?

Thanks

Mentor recommends the use of separate files, but using the `include of files in packages. Below are examples from code that was generated using the Certe templates http://www.mentor.com/products/fv/certe/
Code:
package agent_pkg;

  `include "ovm_macros.svh"

  import ovm_pkg::*;
  import ovm_container_pkg::*; 
  import fifo_pkg::*;
  `include "trans.svh" 
 
  `include "driver.svh"
  `include "monitor.svh"

  `include "agent_config.svh"
  `include "agent.svh"
   
endpackage: agent_pkg

package env_pkg;

  `include "ovm_macros.svh"
 
   import ovm_pkg::*;
   import agent_pkg::*;

   `include "env_config.svh"
   `include "coverage.svh"
   `include "scoreboard.svh"
   `include "env.svh"
   
endpackage: env_pkg

package test_pkg;

  `include "ovm_macros.svh"

  import ovm_pkg::*;
  import ovm_container_pkg::*;
     
  import sequences_pkg::*;
  import agent_pkg::*;
  import env_pkg::*;

  `include "test_base.svh"
  `include "test1.svh"
   
endpackage: test_pkg


_________________
Ben Cohen http://www.systemverilog.us/
* SystemVerilog Assertions Handbook, 3rd Edition, 2013
* A Pragmatic Approach to VMM Adoption
* Using PSL/SUGAR ... 2nd Edition
* Real Chip Design and Verification
* Cmpt Design by Example
* VHDL books


Last edited by vhdlcohen on Mon Sep 05, 2011 9:05 am; edited 1 time in total
Back to top
View user's profile Send e-mail Visit poster's website
tzar
Senior
Senior


Joined: Nov 28, 2007
Posts: 69

PostPosted: Mon Sep 05, 2011 9:00 am    Post subject: Reply with quote

Ah, that makes sense.
Thanks
Back to top
View user's profile
dave_59
Senior
Senior


Joined: Jun 22, 2004
Posts: 974
Location: Fremont, CA

PostPosted: Mon Sep 05, 2011 11:27 pm    Post subject: package import and `include are not exclusive Reply with quote

You may also want to read this article: http://go.mentor.com/package-import-versus-include.

Dave Rich
Back to top
View user's profile Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Verification Guild Forum Index -> Main All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Verification Guild © 2006 Janick Bergeron
Web site engine's code is Copyright © 2003 by PHP-Nuke. All Rights Reserved. PHP-Nuke is Free Software released under the GNU/GPL license.
Page Generation: 0.207 Seconds