1 、加法器
1.1 4位加法器
module add_4(x,y,sum,c);
input [3:0] x,y;
output [3:0] sun;
output c;
assign {
c,sum} = x + y;
endmodule
1.2 16位加法器
module add_16(x,y,sum,c);
input [15:0] x,y;
output [15:0] sun;
output c;
assign {
c,sum} = x + y;
endmodule
2、乘法器
2.1 4位乘法器
module mult_4(x,y,product)
input [3:0] x