马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
//两级流水线加法器代码
module a(cout, sum, ina, inb, cin, enable);
output cout;
output [7:0] sum;
input [7:0] ina, inb;
input cin, enable;
reg cout;
reg [7:0] sum;
reg [3:0] tempa, tempb, firsts;
reg firstc;
always @(posedge enable)
begin
{firstc,firsts} = ina[3:0] + inb[3:0] + cin;
tempa = ina[7:4];
//缓存未参与计算的数据
tempb = inb[7:4];
//
end
always @(posedge enable)
begin
//{cout,sum[7:4]} = tempa + tempb + firstc;
…………………………………1
//sum[3:0] = firsts;
………………………………………1
{cout, sum} = {tempa + tempb + firstc, firsts} ; ……………………………………………….2
end
endmodule
问题:我觉得1与2在语法是等效的,但我用2句时,QUARTUS会把COUT接GOUND。结果无进位。而1则是正确的。为什么啊? |