verilog代码错,请大家帮忙看一看
时间:10-02
整理:3721RD
点击:
module DataProcess(in,out);
input [511:0] in;
output reg [511:0] out=in;
reg[9:0]b=0;
genvar a;
generate for(a=0;a<512;a=a+1) begin:leng
casex(out[a])
1'bx:b=b+1;
1'b0,1'b1,
default:b=b;
endcase
end
endgenerate
assign out[b-1]=1'b1;
assign out=out+512-b;
initial $monitor($time , ,"out= %h",out);
endmodule
错误信息如下,请各位帮忙指正。
** Error: (vlog-13069) D:/FPGA/test/SHA-1 modelsim/DataProcess.v(7): near "casex": syntax error, unexpected casex.
** Error: (vlog-13069) D:/FPGA/test/SHA-1 modelsim/DataProcess.v(17): near "endmodule": syntax error, unexpected endmodule.
input [511:0] in;
output reg [511:0] out=in;
reg[9:0]b=0;
genvar a;
generate for(a=0;a<512;a=a+1) begin:leng
casex(out[a])
1'bx:b=b+1;
1'b0,1'b1,
default:b=b;
endcase
end
endgenerate
assign out[b-1]=1'b1;
assign out=out+512-b;
initial $monitor($time , ,"out= %h",out);
endmodule
错误信息如下,请各位帮忙指正。
** Error: (vlog-13069) D:/FPGA/test/SHA-1 modelsim/DataProcess.v(7): near "casex": syntax error, unexpected casex.
** Error: (vlog-13069) D:/FPGA/test/SHA-1 modelsim/DataProcess.v(17): near "endmodule": syntax error, unexpected endmodule.
提示都很明显了,有语法错误
casex() 1'bx就忽略了这一位,你总共只有一位,就是任何情况下b=b+1;但你后面default又是b=b,感觉就冲突了吧;如果你要为x时,进行加1赋值操作的话,应该是case()
verilog 没有casex只有case
casex(i),就是不管i取值为什么,1,0,或者不定态,后面的赋值语句都会执行,但是你又在后面加一个“1‘b0"的分支是几个意思 ?