• 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. Passing variables between structs and sequences

Stats

  • Locked Locked
  • Replies 4
  • Subscribers 65
  • Views 10796
  • 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

Passing variables between structs and sequences

Nir Z
Nir Z over 3 years ago

Hi all,

I'm Trying to create an effective "end of test" condition where I generate packets in a designed unit and send them to a sequence.

I'm interested that after a X amount of packets the sequence will end. The problem is that the "number of packets" generated in the designed block is defined there and I'm not sure what is best way to make it visible to my sequence so I could have the "end of test" condition.

Important to mention that I'm working on a big based environment and I'm trying not to make to much changes.

Thank you for your help,

Nir

  • Cancel
Parents
  • StephenH
    StephenH over 3 years ago

    Why not simply add an attribute into the transaction class to signal the end of the stream? Then set it to 1 in the last transaction sent from the packet generator, and in your sequence, break out of the loop when the flag is set.

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

    Why not simply add an attribute into the transaction class to signal the end of the stream? Then set it to 1 in the last transaction sent from the packet generator, and in your sequence, break out of the loop when the flag is set.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
  • Nir Z
    Nir Z over 3 years ago in reply to StephenH

    I could do it, and probably will, but because my code is part of big environment with many module (and I'm working on a small side module) my transactions are defined as well in many other environments who uses the same transaction definition.

    Is there any other way of passing those variables without changing the transaction class?

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • StephenH
    StephenH over 3 years ago in reply to Nir Z

    Well, given that you haven't even said which language you're using (e, SV, UVM, SystemC, raw VHDL...) it's kinda tricky to propose anything precise. I'm going to assume you're using SV UVM, in the which case you could consider making a derived transaction class that adds the flag, then use a factory override so that you can make the changes only for your use case and not for everyone else.

    You might be able to do something really dirty like making a hierarchical reference from the sequence across to the packet generator, but then your code will be harder to maintain, more fragile and less reusable.

    It's also not clear why your packet generator isn't a sequence itself, that would be the normal use model in UVM.

    Perhaps the least intrusive method would be to make no changes to the transaction class or the generator, and instead simply add a mechanism in the sequence whereby it times out and terminates if it hasn't received any new packets from the generator after a defined number of clock cycles...

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Nir Z
    Nir Z over 3 years ago in reply to StephenH

    Thank you for your help,

    I'm Working with e language. In the end I added an attribute into the transaction class like you offered and it was the simplest solution.

    • 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