Defined macros become undefined - MFCU vs SFCU

文章讨论了在SystemVerilog中,由于默认的单文件编译单元模式导致在不同文件间使用宏定义时出现‘undefinedmacros’警告的问题,解决方法是将SystemVerilog模式设置为多文件编译单元。
摘要由CSDN通过智能技术生成

Q: I have macros defined in a separate input file. Why does Verific analyzer complain about "undefined macros" in SystemVerilog mode but not in Verilog 2K mode?

SystemVerilog introduces "compilation unit." In general, constructs defined in one compilation unit is not visible in a different compilation unit.

The default mode in SystemVerilog is "single-file compilation unit." The default mode in Verilog 2K mode is "multiple-file compilation unit."

In SystemVerilog mode, in order for one file sees macros defined in another file, one needs to specify "multiple-file compilation unit" mode.

  $ cat foo.v
  `define ZERO 0

  $ cat bar.v
  module test (output oo);
  assign oo = `ZERO;
  endmodule
  
  $ verific-linux
  -- (c) Copyright 1999 - 2018 Verific Design Automation Inc. All rights reserved
  % analyze -verilog_2000 foo.v bar.v
  -- Analyzing Verilog file 'foo.v' (VERI-1482)
  -- Analyzing Verilog file 'bar.v' (VERI-1482)
  % cleanup -all -static
  INFO: All parse-trees and netlists were deleted (CMD-2055)
  % analyze -sysv foo.v bar.v
  -- Analyzing Verilog file 'foo.v' (VERI-1482)
  -- Analyzing Verilog file 'bar.v' (VERI-1482)
  bar.v(2): WARNING: use of undefined macro 'ZERO' (VERI-1158)
  bar.v(2): ERROR: syntax error near ';' (VERI-1137)
  bar.v(3): ERROR: module 'test' ignored due to previous errors (VERI-1072)
  ERROR: analyze: failed (CMD-1014)
  % cleanup -all -static
  INFO: All parse-trees and netlists were deleted (CMD-2055)
  % analyze -sysv -mfcu foo.v bar.v
  -- Analyzing Verilog file 'foo.v' (VERI-1482)
  -- Analyzing Verilog file 'bar.v' (VERI-1482)
  % exit

  $
 
  • 6
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值