|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
本帖最后由 oscillator_cn1 于 2011-1-18 16:08 编辑
各位:
verilog中使用for循环出错,但是不知道错在哪里,帮忙看看。
module DW_minmax(
a,
tc,
min_max,
value,
index
);
parameter WIDTH = 4; // element WIDTH
parameter NUM_INPUTS = 8; // number of elements in input array
parameter INDEX_WIDTH = 3; // size of index pointer = ceil(log2(NUM_INPUTS))
input [WIDTH*NUM_INPUTS-1:0] a; //Concatenated input vector
input tc; //0=unsigned,1=signed
input min_max; //0=find min,1=find max
output [WIDTH-1:0] value; //min or max value found
output [INDEX_WIDTH-1:0] index; //index to value found
reg [WIDTH-1:0]b[NUM_INPUTS-1:0];
always @(a)
begin: takeout
reg [INDEX_WIDTH-1:0] pi;
for (pi=0;pi<NUM_INPUTS;pi=pi+1)
b[pi]=a[WIDTH*pi+WIDTH-1:WIDTH*pi];
end
endmodule
用的是MOdelsim6.5C,提示错误信息是:** Error: D:/modeltech_6.5c/examples/DW_minmax/DW_minmax.v(24): near "[": syntax error, unexpected '[', expecting ':'
24行是 b[pi]=a[WIDTH*pi+WIDTH-1:WIDTH*pi]; |
|