• 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. Custom IC Design
  3. hex variable to verilog module

Stats

  • Locked Locked
  • Replies 6
  • Subscribers 125
  • Views 13884
  • 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

hex variable to verilog module

amacSS
amacSS over 4 years ago

Hello, I'm trying to pass a hex constant to a verilog module via a variable but so far I could only specify it manually like:

 (it works with hex or binary)

Afer defining a variable in ADE called cfg, the following is interpreted as 0x636667 which is the ascii for "cfg"

This is regardless of the value of cfg.

Is there a way to use variables and preferably to specify them in hex?

By the way, variables should follow AEL synthax, but in the AEL guide there seems to be no reference to hex constants.

Thanks

  • Cancel
Parents
  • Andrew Beckett
    Andrew Beckett over 4 years ago

    AEL will convert variables with value such as 0xfe to 254 - but actually the UI will do the same, so I'm not sure that's what you want. I'm not sure how this constant is being passed to your model. so that may not be what you want.

    You could also have your design or global variable (in ADE Explorer/Assembler) set to atoi(numConv("0xfe" "dec" nil)) or something like that?

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • amacSS
    amacSS over 4 years ago in reply to Andrew Beckett

    I'm trying 0x10 as the value of ADE variable cfg; then i set cfg as the value passed to my verilog cell

    I get a netlist error:

      dynamicparam real cfg = 0x10;
                                  |
    xmvlog: *E,EXPSMC (./cds_globals.vams,28|30): expecting a semicolon (';') [3.10(IEEE)].
       dynamicparam real cfg = 0x10;
                                   |
    xmvlog: *E,EXPEQL (./cds_globals.vams,28|31): expecting an equal sign ('=') [3.10(IEEE)].
        module worklib.cds_globals:vams

    What I would like is to pass 0x10 via a variable.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 4 years ago in reply to amacSS

    Ah, my apologies - I entered the 0x9e via the Editing Design Variables form where it gets converted to decimal. If you enter it there, it passes it literally to spectre or AMS - and that's not going to work. I think you may need to use the numConv option...

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • amacSS
    amacSS over 4 years ago in reply to Andrew Beckett

    Meanwhile Cadence Support explained how to do it; may be useful to someone else:

    From Tools->CDF edit change CDF layer to Base, then enable "parse as CEL" and "parse as number":

    Now the value of "constant" can be a variable, however using the old hex notation (32'h1f3) directly in the property field is not possible, only decimal numbers.

    The variable however can be either a decimal number or hex or binary, using one of the following:

    eval(0b1101)

    atoi(numConv(“0b1101” ‘dec t))

    eval(0xfe)

    atoi(numConv(“0xfe” ‘dec t))

    In the end I wanted to easily switch between two hex values, like below:

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • amacSS
    amacSS over 4 years ago in reply to Andrew Beckett

    Meanwhile Cadence Support explained how to do it; may be useful to someone else:

    From Tools->CDF edit change CDF layer to Base, then enable "parse as CEL" and "parse as number":

    Now the value of "constant" can be a variable, however using the old hex notation (32'h1f3) directly in the property field is not possible, only decimal numbers.

    The variable however can be either a decimal number or hex or binary, using one of the following:

    eval(0b1101)

    atoi(numConv(“0b1101” ‘dec t))

    eval(0xfe)

    atoi(numConv(“0xfe” ‘dec t))

    In the end I wanted to easily switch between two hex values, like below:

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
  • Andrew Beckett
    Andrew Beckett over 4 years ago in reply to amacSS

    I had also meant to ask about your CDF settings because something sounded incorrect. Anyway, glad it was resolved (oh and by the way, if you're also asking the same question to customer support at the same time, it's polite to mention that as otherwise the Cadence folks on here can end up repeating work being done by a colleague, which is not efficient for those of us with limited bandwidth).

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • amacSS
    amacSS over 4 years ago in reply to Andrew Beckett

    Actually it was not at the same time, only after your last response.

    But sure, I will mention any pending customer support in the future.

    Thank you

    • 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