lac_adder16.v
来自「十六位超前进位加法器」· Verilog 代码 · 共 22 行
V
22 行
module LAC_adder16(a,b,cin,s,p_out,g_out);
input[15:0] a,b;
input cin;
output[15:0] s;
output p_out,g_out;
wire[3:0] p,g;
wire[2:0] c;
LAC_adder4(a[3:0],b[3:0],cin,s[3:0],p[0],g[0]);
assign c[0]=g[0]||(p[0]&&cin);
LAC_adder4(a[7:4],b[7:4],c[0],s[7:4],p[1],g[1]);
assign c[1]=g[1]||(p[1]&&g[0])||(p[1]&&p[0]&&cin);
LAC_adder4(a[11:8],b[11:8],c[1],s[11:8],p[2],g[2]);
assign c[2]=g[2]||(p[2]&&g[1])||(p[2]&&p[1]&&g[0])||(p[2]&&p[1]&&p[0]&&cin);
LAC_adder4(a[15:12],b[15:12],c[2],s[15:12],p[3],g[3]);
assign p_out=p[3]&&p[2]&&p[1]&&p[0];
assign g_out=g[3]||(p[3]&&g[2])||(p[3]&&p[2]&&g[1])||(p[3]&&p[2]&&p[1]&&g[0]);
endmodule
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?