【发布时间】: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