的教科书,我读器具1位加法器使用内置基本模块:Verilog的:实现使用基本模块与位运算符
module yAdder1(z, cout, a, b, cin);
output[0:0] z, cout;
input[0:0] a, b, cin;
wire[0:0] tmp, outL, outR;
xor left_xor(tmp, a, b);
xor right_xor(z, cin, tmp);
and left_and(outL, a, b);
and right_and(outR, tmp, cin);
or my_or(cout, outR, outL);
endmodule
但是,为什么不使用位运算符?似乎更简单。
module yAdder1(z, cout, a, b, cin);
output[0:0] z, cout;
input[0:0] a, b, cin;
assign z = (a^b)^cin;
assign cout = (a & b) | ((a^b) & cin);
endmodule
除非按位运算符隐式使用原始模块?
啊我看到,门(结构)水平抽象与功能和算法水平(行为)抽象。每个人都有自己的优点和缺点。 – NoName