当前位置:网站首页>Adder - Notes
Adder - Notes
2022-06-28 03:51:00 【Jiangnan small workshop】
adder
- An adder is a unit that performs the addition function , It has two or three data input ports and two output ports .
- For binary addition operation , Such as
0+0=0,0+1=1,1+1=0, Carry is 1. - Depending on the number of input ports , Adders are divided into half adders and full adders .
Half adder
- Two input ports , Addend and addend ; Two output ports , Carry and result .
- Common symbols

- Logical expression F = A ⋅ B ˉ + B ⋅ A ˉ = A ⊕ B F=A\cdot\bar{B}+B\cdot\bar{A}=A\oplus B F=A⋅Bˉ+B⋅Aˉ=A⊕B C o u n t = A ⋅ B Count=A\cdot B Count=A⋅B
- Corresponding truth table

- You can find , F F F And A . B A.B A.B The relation of is XOR gate , C o u n t Count Count And A . B A.B A.B The relationship between and gate . Therefore, a semi adder can be composed of an XOR gate and an and gate .

- Verilog describe
module half_adder( input A, input B, output F, output Cout ); assign F = A ^ B; assign Cout = A & B; endmodule - RTL View

Full adder
On the basis of half adder , Consider the carry of low order operations , So the full adder has three input ports .

Logical expression F = A ⊕ B ⊕ C i n F=A\oplus B\oplus Cin F=A⊕B⊕Cin C o u t = A ⋅ B + C i n ( A ⊕ B ) Cout = A\cdot B+Cin(A\oplus B) Cout=A⋅B+Cin(A⊕B)
Corresponding truth table

Verilog grammar
module full_adder( input A, input B, input Cin, output F, output Cout ); assign F = A^B^Cin; assign Cout = A&B|(Cin&(A^B)); endmoduleRTL View

Another method is to realize full adder , Using two half adders

Since the full adder takes into account the carry of the low order operation , Thus, we can easily add multi bit data by cascading multiple full adders , Such as 8 Bit data

This cascade method is also called traveling wave carry adder , If there is carry , Like a ripple from low to high . This adder , Because each full adder needs to wait for the carry output of its previous full adder to complete the calculation , So it takes a long time 、 Low efficiency . In order to improve the time efficiency of addition , Carry select adder and carry ahead adder are introduced .
HDLBits There is a question about adder above : Give a 16 Bit adder add16, To design a 32 Bit adders .

This 16 Bit adders , It can be formed by cascading traveling wave carry , Its internal structure can be free from entanglement , On how to form 32 Bit adder for understanding .
Verilog Realization
module top_module( input [31:0] a, input [31:0] b, output [31:0] sum ): // Define the internal connection line wire [15:0] a_1, a_2; wire [15:0] b_1, b_2; wire [15:0] sum_1, sum_2; wire cin_1, cin_2, cout_1; // Be careful , Here you can see that the following carry has no output , therefore , Can not define . // Connect the cable to the port data assign cin_1 = 0; assign a_1 = a[15:0]; assign a_2 = a[31:16]; assign b_1 = b[15:0]; assign b_2 = b[31:16]; assign sum = { sum_2,sum_1}; // call add16 modular add16 add16_inst_1(.a(a_1),.b(b_1),.cin(cin_1),.cout(cout_1)); add16 add16_inst_2(.a(a_2),.b(b_2),.cin(cin_2)); endmoduleAs mentioned earlier , For addition of multi bit bus data , If traveling wave carry is used , It has a long carry chain and key path , Time consuming , Low efficiency . Therefore, several adders based on the carry derivation of traveling wave are introduced .
Carry select adder
- I have learned about multiplexers , Can multiplexers be added to improve the efficiency of traveling wave carry ? Take the above as an example , Give a 16 Bit adder add16, To design a 32 Bit adders .
- By means of carry selection , The block diagram is as follows

- Use 3 individual 16 Bit adders : Build two high 16 Bit adders , A carry to 0, A carry to 1. Through low 16 The carry signal of the bit adder is used to select which adder value to output .
- Verilog Realization

- Simulation results

- Advantages and disadvantages :
- High and low bits can be operated at the same time , Reduce time ;
- Large circuit area ( Pictured above , Use more than one adder and selector );
边栏推荐
- 局域网内共享打印机的几种方式
- 荣耀v8 真机调试时不显示 Logcat 日志的解决办法
- 可扩展数据库(下)
- INFO: HHH000397: Using…
- Cannot edit in read-only editor if it appears in vscode
- Execution plan in MySQL of database Series
- Online DDL implementation mechanism in InnoDB of database Series
- 从遇见大咖到成为大咖,昇腾AI开发者创享日给开发者带来无限可能
- Establishment of SSH Framework (Part I)
- 数据库系列之MySQL和TiDB中慢日志分析
猜你喜欢
随机推荐
Extensible database (I)
Sublime text 3 basic configuration tutorial
Establishment of SSH Framework (Part I)
开关电源—Buck电路原理及其仿真
Circular sliding auto adsorption UI tool that monkeys can use
MySQL error
TypeScript 联合类型
可扩展数据库(上)
Custom controls under WPF and adaption of controls in Grid
开启创客教育造物学的领域
Database migration
Scalable storage system (I)
云应用、服务的“5层”架构
黑體輻射初探
学习---有用的资源
多线程与高并发六:线程池源码解析
leetcode:494.数组中添加加减运算符得到指定值的所有方法
电学基础知识整理(二)
如何系统学习一门编程语言? | 黑马程序员
JVM一:JVM入门以及Class文件认识









