• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Blogs
  2. Verification
  3. e Templates: A Nifty Way To Create Reusable Code
teamspecman
teamspecman

Community Member

Blog Activity
Options
  • Subscribe by email
  • More
  • Cancel
IEEE 1647
funtional verification
when sub-typing
TLM
Verification methodology
Object Oriented Programming
innovation
Functional Verification
Open Verification Methodology
when inheritance
Testbench simulation
OVM e
Coverage-Driven Verification
e
OVM-e
team specman
specman elite
OOP
coverage driven verification (CDV)
ClubT
Aspect Oriented Programming
esl tlm synthesis rtl dac estimation planning
macros
eRM
System Verification
Incisive Enterprise Simulator (IES)
hvl
IES
Coverage Driven Verification
Functional Verificatioa
OVMWorld
verification
IES-XL
Trailblazer

e Templates: A Nifty Way To Create Reusable Code

10 Aug 2010 • 1 minute read

Hi All,

An e template (known as a parameterized type in other programming languages) is a feature that has been around for several releases and can be a great way of creating re-usable code.  Templates can be used anywhere a user would like to create a single re-useable object that might operate on different data types.  An example would be to create a scoreboard (if you were not already using the ovm_scbd package) that can be instantiated to perform checking on packets, transactions, or any other type of data structure of interest. 

Below is a short example of a simple FIFO scoreboard implemented using a template:

 

File: scoreboard.e
<'
template unit scoreboard of (<T'type>) {

    // Instantiate the TLM analysis ports to receive items for adding items to the scoreboard and checking
    add_pkt: in interface_port of tlm_analysis of <T'type> using prefix=add_pkt_ is instance;
    check_pkt: in interface_port of tlm_analysis of <T'type> using prefix=check_pkt_ is instance;

    // The actual scoreboard list
   !sblist: list of <T'type>;  

   // Implement the _write() method of the TLM analysis port
   add_pkt_write(p: <T'type>) is {
      message(NONE, "scoreboard added item: ", p);
      sblist.push(p);
   };

   // Implement the _write() method of the TLM analysis port
   check_pkt_write(p: <T'type>) is { 
      if (deep_compare_physical(p, sblist[0], 10).is_empty()) then {sblist.delete(0);};
      message(NONE, "scoreboard checked item: ", p);
   };           
};
‘>  

Using the above code, a user can instantiate the same scoreboard code to handle any type of data structure.

 

File: env.e

<'
unit env_u {
   packet_sb: scoreboard of (packet_s) is instance;  // Scoreboard to handle packets
   transaction_sb: scoreboard of (transaction_s) is instance;  // Scoreboard to handle transactions
   ...
};
‘>
 

Hope this little technical tidbit helps.

Happy verifying!

Corey

 

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information