如下的两个数比较仿真未能输出。请教各位。环境ISE13.2.
module comp(fnum,A,B,C);//fnum用于功能选择,1:大于操作;0:大于等于操作。A,B位16位数,C为比较的结果。input fnum;
input A;
input B;
output C;
reg C;
reg fnumreg;
reg Areg,Breg;
initial begin //初始化
fnumreg<=0;
Areg<=0;
Breg<=0;
end
always begin//寄存器赋值
fnumreg<=fnum;
Areg<=A;
Breg<=B;
end
always begin
if(fnumreg==1)begin //fnum
C<=(Areg>Breg);
end
else if(fnumreg==0)begin //fnum
C<=(Areg>=Breg);
end
else begin
fnumreg<=0;
Areg<=0;
Breg<=0;
end
end
endmodule 你的代码不能综合把 还有你的问题不是很具体 wire c1, c2;
assign c1 = (A>B) ? 1'b1:1'b0;
assign c2 = (A>=B) ? 1'b1:1'b0;
assign c = (funm==1) ? c1 : c2;
页:
[1]