【问题标题】:Attempting to change include statement at compile time/run time for Verilog code尝试在 Verilog 代码的编译时/运行时更改包含语句
【发布时间】:2020-06-26 06:15:17
【问题描述】:

如果我在写这篇文章时出现任何错误,我深表歉意,因为这是我的第一个问题。我一直在测试 Verilog 中的一些代码,这些代码将使用不同长度的表/数组,我计划简单地将我当前需要的代码包含在一个 include 语句中。但是,我一直在尝试能够在运行时/编译时更改 include 语句的宏,以便我可以快速运行测试,并希望最终为它编写一个 .do 文件。这是简单的包含语句:

`define Table "dummy_table.v"
`include `Table

(我也用 `ifdef 试过这个)

然后,我尝试使用以下命令对其进行编译:

vlog +define+Table=VerilogTables.v Adder.v

不幸的是,我总是收到此错误:

# ** Error: ** while parsing macro expansion: 'Table' starting at Adder.v(18)
# ** at Adder.v(18): Filename to `include must be enclosed in "'s.
# ** Error: (vlog-13069) ** while parsing macro expansion: 'Table' starting at Adder.v(18)

第 18 行是实际的包含语句。 任何帮助将不胜感激!提前致谢。

【问题讨论】:

    标签: macros verilog test-bench


    【解决方案1】:

    错误消息告诉您确切的问题是什么,您缺少文件名周围的""。命令行中的代码将扩展为

    `include VerilogTables.v
    

    这不是正确的语法。您需要将引号添加到+define 开关

    vlog +define+Table=\"VerilogTables.v\" Adder.v
    

    这个答案可能需要针对不同的 shell 或制作文件进行修改

    【讨论】:

    • 我现在才意识到,这确实让我觉得自己像个傻瓜哈哈。非常感谢你指出,戴夫!出于某种原因,我不断地犯一些小的(很容易修复的)错误。我真的很感激!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-11-18
    • 1970-01-01
    • 2017-12-16
    • 2016-11-05
    • 1970-01-01
    • 2012-04-18
    • 1970-01-01
    相关资源
    最近更新 更多