• 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. Logic Design
  3. genus include `define file

Stats

  • Locked Locked
  • Replies 2
  • Subscribers 62
  • Views 19084
  • 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

genus include `define file

saw235
saw235 over 5 years ago

I have a file that list all the `defines that is used in the current design. This file (define.vh) is generated, like so :

`define MACRO_1 5

`define MACRO_2 1'h0

... etc

But in genus when I run the command

read_hdl define.vh

read_hdl -sv top.sv

The tool work as if the defines never get parsed and returns with unreferenced errors. How can I resolve this? Do I have to include 'define.vh' in all the design files?

  • Cancel
Parents
  • Igor Danilov
    Igor Danilov over 5 years ago

    You can parse your define.vh, convert it to a single string, and put it into the -define option of read_hdl command.

    Assume you have a file consist of only `defines. For example:

    `define SYNTHESIS

    `define MACRO_1 5

    `define MACRO_2 1'h0

    `define MACRO_3

    You can use this or something like it:

    proc parse_verilog_define_file {file_with_macro} {  

      set fp [open $file_with_macro r]  

      set file_data [read $fp]  

      close $fp  

      set data [split $file_data "\n"]  

      foreach line $data {    

        lappend processed_data [string map {" " =} [string trim [string map {`define ""} $line]]]  

      }  

      return $processed_data

    }

    set macro_string [parse_verilog_define_file "define.vh"]

    # result: "SYNTHESIS MACRO_1=5 MACRO_2=1'h0 MACRO_3"

    read_hdl -define $macro_string -sv top.sv

    • Cancel
    • Vote Up +1 Vote Down
    • Cancel
  • saw235
    saw235 over 5 years ago in reply to Igor Danilov

    Hi that worked, thanks a lot for the solution. I've used your solution in my script, but the last few days I tried the following and surprisingly parsing it as a list worked which I didn't expect because parsing them line by line did not work using read_hdl.

    read_hdl -sv {define.vh top.sv}

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • saw235
    saw235 over 5 years ago in reply to Igor Danilov

    Hi that worked, thanks a lot for the solution. I've used your solution in my script, but the last few days I tried the following and surprisingly parsing it as a list worked which I didn't expect because parsing them line by line did not work using read_hdl.

    read_hdl -sv {define.vh top.sv}

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
No Data

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