📄 csa_8bit.v
字号:
`timescale 1ns/10ps//===============================================================================// TOP Level ---> 8-bit CSA Source Code// ---BAO Chaowei Mar 3rd,2009//===============================================================================module CSA_8bit(COUT, SUM, A, B, CIN ); output COUT; output [7:0] SUM; input [7:0] A; input [7:0] B; input CIN; wire cout0,cout1,cout2,cout3,cout4,cout5,cout6,cout7; CSA_CELL CSA_BIT0(.co (cout0), .s (SUM[0]), .a (A[0]), .b (B[0]), .ci (CIN) ); CSA_CELL CSA_BIT1(.co (cout1), .s (SUM[1]), .a (A[1]), .b (B[1]), .ci (cout0) ); CSA_CELL CSA_BIT2(.co (cout2), .s (SUM[2]), .a (A[2]), .b (B[2]), .ci (cout1) ); CSA_CELL CSA_BIT3(.co (cout3), .s (SUM[3]), .a (A[3]), .b (B[3]), .ci (cout2) ); CSA_CELL CSA_BIT4(.co (cout4), .s (SUM[4]), .a (A[4]), .b (B[4]), .ci (cout3) ); CSA_CELL CSA_BIT5(.co (cout5), .s (SUM[5]), .a (A[5]), .b (B[5]), .ci (cout4) ); CSA_CELL CSA_BIT6(.co (cout6), .s (SUM[6]), .a (A[6]), .b (B[6]), .ci (cout5) ); CSA_CELL CSA_BIT7(.co (cout7), .s (SUM[7]), .a (A[7]), .b (B[7]), .ci (cout6) ); assign COUT = cout7;endmodule//=======================1-bit cell for CSA(Carry Select Adder)=======================module CSA_CELL(co, s, a, b, ci ); output co; output s; input a; input b; input ci; assign s0 = a^b; assign s1 = !s0; assign c0 = a&&b; assign c1 = a||b; assign s = ci ? s1:s0; assign co = ci ? c1:c0; endmodule
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -