当前位置:网站首页>数字电路基础(五)算术运算电路
数字电路基础(五)算术运算电路
2022-07-06 09:24:00 【ブリンク】
数字电路基础(五)算术运算电路
一、二进制加法电路
1.半加器和全加器
(1)半加器
半加器是一个只考虑两个一位二进制数相加,而不考虑低位进位的运算电路。如下图所示是半加器的逻辑图:
A A A和 B B B端的输入不同时, S S S输出的和为1;相同时,S输出的是0,符合二进制的加法运算规则。但当 A A A和 B B B都为1时,向高位会产生一个进位,此时 C C C的输出为1。
(2)全加器
在半加器的基础上,考虑本位数来自低位的进位,构成了全加器。根据二进制加法的规则,我们首先给出全加器的真值表,如下图所示:
根据真值表我们可以写出逻辑表达式:
S i = A i ⊕ B i ⊕ C i , C i + 1 = A i B i + C i ( A I ⊕ B i ) S_i=A_i\oplus B_i \oplus C_i,C_{i+1}=A_iB_i+C_i(A_I\oplus B_i) Si=Ai⊕Bi⊕Ci,Ci+1=AiBi+Ci(AI⊕Bi)
故可以画出它的逻辑图如下图所示:
全加器是计算机中最基础的算术逻辑单元。
2.加法器
这里只介绍行波进位加法器,这种加法器由于是从最低位开始做加法,逐步进位到最高位,随着位数的增多,其运算速度也会减慢。在连接电路时,加法器的个数等于被加数和加数的位数,尽管运算速度并不是很快,但它的连接是相对简单的。
如图所示是一个四位行波进位加法器的连接图:
二、二进制减法电路
虽然我们可以通过真值表列逻辑表达式的方式设计出半减器和全减器,但是我们一般使用加法器实现减法的功能。
1.二进制正负数的表示方法
(1)原码
原码是指在二进制数的最前面加一个符号位,正数的符号位为0,负数的符号位为1,其余各位表示的是数的绝对值,比如:+10110的原码是010110,而-10110的原码是110110.
(2)补码
正数的补码和它本身是相同的。
负数的补码是它本身的反码再加1,而它的反码则是出了符号位之外的所有数位全部取反得到的。例如:11101的反码是10010,再加1得到它的补码即:10011.
2.减法电路
由于减去一个数等于加上一个数的负数,减去一个负数等于加上一个正数,故我们可以用加法实现减法。我们在钟表中有这样的循环:
比如现在时间是13:00,我想要到达12:00,那么就有两种方式可以,一种是等待到11小时;一种是时间倒流1小时;再比如现在是20:00, 我想要到达15:00,那么也有两种方式,第一种是等待7小时(此时指针指向3),一种是时间倒流5小时。我们把等待的时间看做是加上一个数,把时间倒流看做是减去一个数,我们发现,加和减两个不同的数,得到的结果都是一样的,而且我们发现这两个数绝对值的和为12,是一个定值。因为时钟本身是一个循环,补码做减法的原理也是一样,补码和它本身的和始终是0,故相当于减去一个数相当于加上这个数的补码。
等我们需要实现这样的效果,使用之前所学到的加法器即可,只需要把加数转换为补码的形式再做加法即可。
边栏推荐
- Ucos-iii learning records (11) - task management
- Statistics 8th Edition Jia Junping Chapter XIII Summary of knowledge points of time series analysis and prediction and answers to exercises after class
- “Hello IC World”
- 内网渗透之内网信息收集(三)
- "Gold, silver and four" job hopping needs to be cautious. Can an article solve the interview?
- Realize applet payment function with applet cloud development (including source code)
- [issue 18] share a Netease go experience
- Detailed explanation of network foundation routing
- 小程序web抓包-fiddler
- 《英特尔 oneAPI—打开异构新纪元》
猜你喜欢
“Hello IC World”
Statistics 8th Edition Jia Junping Chapter IX summary of knowledge points of classified data analysis and answers to exercises after class
Apache APIs IX has the risk of rewriting the x-real-ip header (cve-2022-24112)
[paper reproduction] cyclegan (based on pytorch framework) {unfinished}
Web vulnerability - File Inclusion Vulnerability of file operation
Intranet information collection of Intranet penetration (3)
xray與burp聯動 挖掘
Windows platform mongodb database installation
Record an API interface SQL injection practice
Statistics 8th Edition Jia Junping Chapter 12 summary of knowledge points of multiple linear regression and answers to exercises after class
随机推荐
Data mining - a discussion on sample imbalance in classification problems
Interview Essentials: what is the mysterious framework asking?
Network technology related topics
内网渗透之内网信息收集(三)
Realize applet payment function with applet cloud development (including source code)
Attack and defense world misc practice area (GIF lift table ext3)
“Hello IC World”
Intranet information collection of Intranet penetration (4)
C language file operation
Detailed explanation of three ways of HTTP caching
The United States has repeatedly revealed that the yield of interest rate hiked treasury bonds continued to rise
内网渗透之内网信息收集(四)
Record once, modify password logic vulnerability actual combat
Mysql的事务是什么?什么是脏读,什么是幻读?不可重复读?
【指针】查找最大的字符串
循环队列(C语言)
1.支付系统
浙大版《C语言程序设计实验与习题指导(第3版)》题目集
Harmonyos application development -- address book management system telmanagesys based on listcontainer [phonebook][api v6]
Spot gold prices rose amid volatility, and the rise in U.S. prices is likely to become the key to the future