• 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. Mixed-Signal Design
  3. Accessing LINUX environment variables in verilog-AMS/verilog...

Stats

  • Locked Locked
  • Replies 4
  • Subscribers 64
  • Views 5707
  • 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

Accessing LINUX environment variables in verilog-AMS/verilog-A

LDIL
LDIL over 5 years ago

Hello all.

Does anyone know how to do that?

One can do that in systemVerilog, but I could not find the same for verilog-a or verilog-AMS.

Thanks!

  • Cancel
  • Andrew Beckett
    Andrew Beckett over 5 years ago

    What are you hoping to do with these environment variables? Maybe you don't need to evaluate them - for example, the $fopen() function will accept paths containing environment variables and read/write files with the evaluated values of those env vars.

    How are you doing it in SystemVerilog?

    Regards,

    Andrew.

    • Cancel
    • Vote Up +1 Vote Down
    • Cancel
  • LDIL
    LDIL over 5 years ago in reply to Andrew Beckett

    Hi Andrew.

    In short, import "DPI-C" function string getenv(input string env_name);

    Here it is in SystemVeilog, the full thread.

    https://stackoverflow.com/questions/15034019/how-do-i-read-an-environment-variable-in-verilog-system-verilog#15103561

    I was trying to get certain printouts done when an environment variable was set.

    Thanks.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 5 years ago in reply to LDIL

    I don't think this is possible with Verilog-A (I didn't check with Verilog-AMS). You might have been able to do:

    import "CDS_VA_DPI" function string getenv(string varname);

    except that this approach doesn't support string return values or string arguments.

    I think you would need to contact customer support for an enhancement.

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • LDIL
    LDIL over 5 years ago in reply to Andrew Beckett

    Thanks Andrew.

    Happy new year!

    • 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