• 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. Regular expression for keeping

Stats

  • Locked Locked
  • Replies 3
  • Subscribers 65
  • Views 10395
  • 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

Regular expression for keeping

LorincAntoni
LorincAntoni over 3 years ago

I have registers defined in vr_ad (with reg_def and reg_fld) and I have a macro that makes me possible to make writes to it, even to fields, e.g.:

wr_reg REG1 keeping {.fld1== val1}

I would like to have an expression that I can use inside the {} with which I could write the same value (e.g. 0) to all the fields of the register, something similar as the "for each" in case of a list. The problem is that I cannot use "for each" in this case as it is not a list but a register with several values. Could you please help me what the regular expression that I could use here is, to have all fields the same value?

  • Cancel
  • StephenH
    StephenH over 3 years ago

    If you want to write all 1's or all 0's, it might be simpler to use the macro like this:
    write_reg REG1 value 0x00;

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

    the problem is that I need to use our macro that is defined as I explained above, so I would nee a regular expression to constrain all the register fields, or maybe a way to use wildcards e.g. *fld* or something like that.

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

    Constrains only work on struct members, you cannot directly refer to a struct member in any context by using a regexp.

    The only solution I can see is for you to extend your existing wr_reg macro (which I assume you own the source code for as it's not a Cadence provided macro name). You would need to declare it as a "define as computed" macro with a regexp string as an argument, use reflection code to list all the fields in the struct and select them based on the regexp value, then the macro would return the appropriate e code modelling the list of individual constraints on those fields. It's not impossible but certainly isn't trivial and would take quite a lot of care to get it right whilst checking that your constraints are valid (e.g. not trying to constrain a 5 bit value onto a 2 bit field).

    • 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