【问题标题】:invalid module instantiation systemverilog无效的模块实例化 systemverilog
【发布时间】:2016-12-22 07:49:31
【问题描述】:

我正在尝试在 eda playground 中运行此代码,但出现以下错误:

module array_redu(); 
  byte b[] = { 1, 2, 3, 4 }; 
  int sum,product,b_xor;
  initial
    begin 
      sum =b.sum ;  // y becomes 10 => 1 + 2 + 3 + 4
      product =b.product ;  // y becomes 24 => 1 * 2 * 3 * 4
      b_xor=b.xor with (item+ 4 );  // y becomes 12 => 5 ^ 6 ^ 7 ^8 
      $display(" Sum is %0d, product is %0d, xor is  %0b",sum,product,b_xor)
      end
endmodule

我收到以下错误:

design.sv:2: syntax error
design.sv:2: error: Invalid module instantiation
design.sv:3: syntax error
design.sv:3: error: Invalid module instantiation
design.sv:8: syntax error
design.sv:8: error: malformed statement
design.sv:10: syntax error

【问题讨论】:

  • 您编写了(不连贯的)软件,但 Verilog 是一种硬件语言。看看这个网站:asic-world.com它一定会帮助你理解如何编写硬件描述语言。
  • 我应该使用哪个模拟器
  • 模拟器的名字无所谓,都是编译Verilog的
  • @Krouitch OP 显然不是在尝试设计硬件,而是在使用 System Verilog 中的数组缩减方法。阵列缩减方法是不可综合的;它们仅对您的测试平台有用。测试台软件:它留在您的计算机中 - 它永远不会是硬件。
  • 我不同意数组缩减方法不可合成。它们只是编写更长表达式的语法糖。可能是某些工具还不支持它。就合成技术而言,10 年并不是很长的时间。

标签: verilog system-verilog hdl


【解决方案1】:

我在EDA Playground 上使用 Aldec Riviera Pro 模拟了您的代码。只有 1 个错误:您在 $display 的行尾缺少一个分号。

【讨论】:

  • 谢谢 Matthew,我一般使用 Icarus verilog 0.9.7 编译器,你推荐使用 Aldec Riviera Pro 2015.6。另外我正在尝试学习verilog,所以我试图在一些示例中运行只是为了掌握它,是否可以使用EDA Playground及更高版本的编译器来实现它。
  • @SarangAgrawal Icarus Verilog 是一个免费的模拟器。它确实支持 System Verilog,但不是全部。 Aldec Riviera Pro 是一款商业模拟器。它支持几乎所有的语言。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2022-01-21
  • 1970-01-01
  • 2017-06-21
  • 2014-05-30
  • 2014-06-04
  • 2016-05-27
  • 1970-01-01
相关资源
最近更新 更多