我有一个名为 dct_8p 的模块,其中有一个 8 个元素的输入数组,其中每个元素都是 4 位数字,8 个元素输出数组每个包含 5 位数字。我想通过模块传递每个4位数字输入。
我试图通过设计愿景来解读设计。它会生成一个错误:
/Farhana/Synopsys/dct_8p.v:56: Illegal reference to memory xin. (VER-253)
我想我在数组声明中犯了非常愚蠢的错误,我无法得到。
module dct_8p(xin,cin,add,sub,xout);
input [3:0] xin [0:7];
input cin;
output [4:0] xout[0:7];
input add,sub;
//layer 1
RCA3 #(.n(4), .approx(0)) l10(.p(xin[0]),.q(xin[]),.ci(cin),.op(add),.r(xout[0]));
....
..
module RCA3(p,q,ci,op,r);
parameter n=4;
input[n-1:0]p,q;
input ci,op;
output [n:0] r;
parameter approx=0;
....
....
最佳答案
我编译了你的代码here它工作得很好。正如您所告知的,我已使用 xin[7] 作为输入。
SystemVerilog 允许将多维数组作为输入传递给模块。您可以修改示例代码并验证这一事实。
使用synopsis-vcs执行SystemVerilog代码的命令如下:
vcs -timescale=1ns/1ns +vcs+flush+all +warn=all -sverilog -R
关于arrays - 通过verilog中的模块传递数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32192845/