串行进位加法器

描述

②    请用全加器电路①实现串行进位的4位全加器电路

1位全加器参考代码如下:

module add_half(
   input                A   ,
   input                B   ,
 
   output	wire        S   ,
   output   wire        C   
);

assign S = A ^ B;
assign C = A & B;
endmodule

/***************************************************************/
module add_full(
   input                A   ,
   input                B   ,
   input                Ci  , 

   output	wire        S   ,
   output   wire        Co   
);

wire c_1;
wire c_2;
wire sum_1;

add_half add_half_1(
   .A   (A),
   .B   (B),
         
   .S   (sum_1),
   .C   (c_1)  
);
add_half add_half_2(
   .A   (sum_1),
   .B   (Ci),
         
   .S   (S),
   .C   (c_2)  
);

assign Co = c_1 | c_2;
endmodule

输入描述:

   input         [3:0]  A   ,
   input         [3:0]  B   ,
   input                Ci  , 

输出描述:

   output    wire [3:0]  S   ,
   output   wire        Co   

参考代码

`timescale 1ns/1ns

module add_half(
   input                A   ,
   input                B   ,
 
   output	wire        S   ,
   output   wire        C   
);

assign S = A ^ B;
assign C = A & B;
endmodule

/***************************************************************/
module add_full(
   input                A   ,
   input                B   ,
   input                Ci  , 

   output	wire        S   ,
   output   wire        Co   
);

wire c_1;
wire c_2;
wire sum_1;

add_half add_half_1(
   .A   (A),
   .B   (B),
         
   .S   (sum_1),
   .C   (c_1)  
);
add_half add_half_2(
   .A   (sum_1),
   .B   (Ci),
         
   .S   (S),
   .C   (c_2)  
);

assign Co = c_1 | c_2;
endmodule
/******************************************************************/
module add_4(
   input         [3:0]  A   ,
   input         [3:0]  B   ,
   input                Ci  , 

   output	wire [3:0]  S   ,
   output   wire        Co   
);

wire [3:0] C;

add_full u1(
   .A   (A[0]),
   .B   (B[0]),
   .Ci  (Ci), 
          
   .S   (S[0]),
   .Co  (C[0])   
);
add_full u2(
   .A   (A[1]),
   .B   (B[1]),
   .Ci  (C[0]), 
          
   .S   (S[1]),
   .Co  (C[1])   
);
add_full u3(
   .A   (A[2]),
   .B   (B[2]),
   .Ci  (C[1]), 
          
   .S   (S[2]),
   .Co  (C[2])   
);
add_full u4(
   .A   (A[3]),
   .B   (B[3]),
   .Ci  (C[2]), 
          
   .S   (S[3]),
   .Co  (C[3])   
);
assign Co = C[3];

endmodule

  • 4
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
串行进位加法器是一种常见的数字电路,用于实现两个二进制数据的相加操作。在Multisim中进行串行进位加法器实验,可以通过以下步骤进行构建和测试。 首先,打开Multisim软件并创建新的电路文件。在电路面板上选择合适的数字逻辑门件,如门、触发器等,以便构建串行进位加法器电路。 接下来,根据串行进位加法器的原理,将门依次连接起来。主要包含两个部分:数据接收与传递部分、进位传递与产生部分。其中,数据接收与传递部分包括两个输入数据和一个输入进位,通过逻辑门运算得到两个输出数据和一个输出进位进位传递与产生部分则将输入进位与输入数据和输出进位进行逻辑门运算,得到最终的输出进位。根据电路图和原理图将门连接起来,并配置适当的连接引脚。 然后,将设计好的电路连接到适当的输入输出设备上。在Multisim中,可以使用开关来模拟二进制数的输入,通过LED灯来显示输出结果。 最后,验证电路的正确性。输入合适的二进制数,并观察LED灯的亮灭情况,以及输出进位的值。通过比较验证输出是否与预期结果一致,从而验证串行进位加法器电路的正确性。 通过上述步骤,在Multisim中可以成功实验串行进位加法器。同时,在Multisim中还可以进行电路仿真和调试,帮助理解电路原理,发现可能存在的问题,并进行相应的调整和改进。通过不断实验和调试可以提高设计和实现串行进位加法器电路的技能和能力。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

cai-LF

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值