• 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. Difference between instance and reference

Stats

  • Locked Locked
  • Replies 1
  • Subscribers 64
  • Views 13707
  • 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

Difference between instance and reference

archive
archive over 17 years ago

Hello... What is the difference between instantiating and referencing the struct or a unit in 'e'? Ex. unit abc {}; struct xyz {}: abc_r : abc; (Reference) abc_i : abc is instance; (instance) or xyz_r : xyz; (Reference) xyz_i : xyz is instance; (instance) So, What is the difference between Reference and Instance? Thanks!


Originally posted in cdnusers.org by vlsi_dude
  • Cancel
  • archive
    archive over 17 years ago

    Units are like a static struct, they can only be generated during pre-run generation and they have
    a static path in the hierarchy (e-path) which doesn't change during a run (units have other specific attributes
    like hdl_path()). The recommendation is to use units to model static test bench components (monitors,
    BFMs, sequence drivers etc.) which are valid throughout the test.

    structs can be dynamically generated (on the fly), they don't have a static e-path etc.

    unit abc {}; struct xyz {}:
    abc_r : abc; (Reference) -> reference(pointer) to a static unit
    abc_i : abc is instance; (instance) -> static unit instance
    xyz_r : xyz; (Reference) -> this is a struct instance, not a reference
    xyz_i : xyz is instance; (instance) -> this is an error, can not be done

    to get a reference to xyz_r you could do:
    var xyz_ref: xyz;
    xyz_ref = xyz_r;
    (xyz_ref was not generated and just assigned, so it is a reference to xyz_r)

    In general assignments of structs to other structs are done by reference. After the assignment
    takes place, the variable on the left side refers to the same instance that was referred to by the
    expression on the right side.

    -hannes


    Originally posted in cdnusers.org by hannes
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel

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