• 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. Community Forums
  2. Functional Verification
  3. using an event inside a TCM

Stats

  • Locked Locked
  • Replies 2
  • Subscribers 65
  • Views 13223
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

using an event inside a TCM

LATHEESH
LATHEESH over 14 years ago

Can we use events inside a TCM.

Can this be implemented as following code:

extend mem{

 handle_memory_access(data,address,word_width)@sys.any is also{

if access == read{

while(TRUE){

sync @sys.top.phase_monitor.data_valid exec{

ad_pairs = cast_to_pair_of_ad(address,data,word_width);

      };

wait cycle;

    };

  };

};

  • Cancel
Parents
  • StephenH
    StephenH over 14 years ago

    Yes, events are definitely used in TCMs. However it's considered very bad practice to make hierarchical references like your sys.top.phase_monitor.data_valid.This is because you break all the re-use rules, assuming that the phase_monitor will always be located under sys.top an so on. This means your code cannot be reused without modification, and also means that if you have to make any hierarchy changes, you will have to go deep into your code to fix everything that breaks.
    You should instead create a local unit pointer to the phase_monitor, and access the event through the pointer. Here's an example:

     1 <'
     2 unit ph_mon_u {
     3   event data_valid;
     4 };
     5
     6 unit top_u {
     7   phase_monitor : ph_mon_u is instance;
     8 };
     9
    10 unit mem_u {
    11   !p_phase_monitor : ph_mon_u ;
    12   demo()@sys.any is {
    13     sync @p_phase_monitor.data_valid;
    14     wait cycle;
    15   };
    16 };
    17
    18 extend sys {
    19   top : top_u is instance;
    20   mem : mem_u is instance;
    21   connect_pointers() is also {
    22     mem.p_phase_monitor = top.phase_monitor;
    23   };
    24 };
    25 '>

     

    Please also note that if you "wait cycle" on sys.any, you have no guarantee of how long the wiat will last. Recall that sys.any is basically triggered on every interaction between Specman and the HDL simulator. You probably should be defining a clock event and waiting on that instead, to avoid complex and hard to reproduce bugs in your testbench.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • StephenH
    StephenH over 14 years ago

    Yes, events are definitely used in TCMs. However it's considered very bad practice to make hierarchical references like your sys.top.phase_monitor.data_valid.This is because you break all the re-use rules, assuming that the phase_monitor will always be located under sys.top an so on. This means your code cannot be reused without modification, and also means that if you have to make any hierarchy changes, you will have to go deep into your code to fix everything that breaks.
    You should instead create a local unit pointer to the phase_monitor, and access the event through the pointer. Here's an example:

     1 <'
     2 unit ph_mon_u {
     3   event data_valid;
     4 };
     5
     6 unit top_u {
     7   phase_monitor : ph_mon_u is instance;
     8 };
     9
    10 unit mem_u {
    11   !p_phase_monitor : ph_mon_u ;
    12   demo()@sys.any is {
    13     sync @p_phase_monitor.data_valid;
    14     wait cycle;
    15   };
    16 };
    17
    18 extend sys {
    19   top : top_u is instance;
    20   mem : mem_u is instance;
    21   connect_pointers() is also {
    22     mem.p_phase_monitor = top.phase_monitor;
    23   };
    24 };
    25 '>

     

    Please also note that if you "wait cycle" on sys.any, you have no guarantee of how long the wiat will last. Recall that sys.any is basically triggered on every interaction between Specman and the HDL simulator. You probably should be defining a clock event and waiting on that instead, to avoid complex and hard to reproduce bugs in your testbench.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
No Data

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

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

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