module andd(a,b,out);
input[2:0] a,b;
output[2:0] out;
if (a==b)
out=1;
else out=0;
endmodule
这个程序为什么通不过呢?难道一定要写成assign out=(a==b)?1:0;才行吗?
共7条
1/1 1 跳转至页

4楼
if、case、while、for等高级编程语句只能出现在initial和always的过程块中。所以改成下面这
样的就可以了。
module andd(a,b,out);
input[2:0] a,b;
output[2:0] out;
always @(a or b)
if (a==b)
out=1;
else
out=0;
endmodule


共7条
1/1 1 跳转至页