SlideShare a Scribd company logo
1 of 11
Download to read offline
1
Hardware for Arithmetic
• Today’s topics:
 Logic for common operations
 Designing an ALU
2
Common Logic Blocks – Decoder
Takes in N inputs and activates one of 2N outputs
I0 I1 I2 O0 O1 O2 O3 O4 O5 O6 O7
0 0 0 1 0 0 0 0 0 0 0
0 0 1 0 1 0 0 0 0 0 0
0 1 0 0 0 1 0 0 0 0 0
0 1 1 0 0 0 1 0 0 0 0
1 0 0 0 0 0 0 1 0 0 0
1 0 1 0 0 0 0 0 1 0 0
1 1 0 0 0 0 0 0 0 1 0
1 1 1 0 0 0 0 0 0 0 1
3-to-8
Decoder
I0-2 O0-7
3
Common Logic Blocks – Multiplexor
• Multiplexor or selector: one of N inputs is reflected on the
output depending on the value of the log2N selector bits
2-input mux
Source: H&P textbook
4
1-Bit ALU with Add, Or, And
• Multiplexor selects between Add, Or, And operations
Source: H&P textbook
5
32-bit Ripple Carry Adder
1-bit ALUs are connected
“in series” with the
carry-out of 1 box
going into the carry-in
of the next box
Source: H&P textbook
6
Incorporating Subtraction
Must invert bits of B and add a 1
• Include an inverter
• CarryIn for the first bit is 1
• The CarryIn signal (for the
first bit) can be the same
as the Binvert signal
Source: H&P textbook
7
Incorporating NOR and NAND
Source: H&P textbook
8
Incorporating slt
• Perform a – b and check
the sign
• New signal (Less) that
is zero for ALU boxes
1-31
• The 31st box has a unit
to detect overflow and
sign – the sign bit
serves as the Less
signal for the 0th box
Source: H&P textbook
Incorporating beq
• Perform a – b and
confirm that the
result is all zero’s
9
Source: H&P textbook
10
Control Lines
What are the values
of the control lines
and what operations
do they correspond to?
Source: H&P textbook
11
Control Lines
What are the values
of the control lines
and what operations
do they correspond to?
Ai Bn Op
AND 0 0 00
OR 0 0 01
Add 0 0 10
Sub 0 1 10
SLT 0 1 11
NOR 1 1 00
Source: H&P textbook

More Related Content

Similar to Arithmatic and logic units of the cpu intro

04 Unit IV DTE.pptx
04 Unit IV DTE.pptx04 Unit IV DTE.pptx
04 Unit IV DTE.pptx
Harsheye
 
PPT of Dr. Arun Somani_MIPS_SC-Extended.pdf
PPT of Dr. Arun Somani_MIPS_SC-Extended.pdfPPT of Dr. Arun Somani_MIPS_SC-Extended.pdf
PPT of Dr. Arun Somani_MIPS_SC-Extended.pdf
UsssshaaaMehta
 
vhdl.ppt Verilog Hardware Description Language
vhdl.ppt Verilog Hardware Description Languagevhdl.ppt Verilog Hardware Description Language
vhdl.ppt Verilog Hardware Description Language
shreenathji26
 

Similar to Arithmatic and logic units of the cpu intro (20)

ICT Basic Logic Gates Lessons.pptx
ICT Basic Logic Gates Lessons.pptxICT Basic Logic Gates Lessons.pptx
ICT Basic Logic Gates Lessons.pptx
 
BASIC LOGIC GATES.pdf
BASIC LOGIC GATES.pdfBASIC LOGIC GATES.pdf
BASIC LOGIC GATES.pdf
 
04 Unit IV DTE.pptx
04 Unit IV DTE.pptx04 Unit IV DTE.pptx
04 Unit IV DTE.pptx
 
boolean-logic.pptx
boolean-logic.pptxboolean-logic.pptx
boolean-logic.pptx
 
Bca i sem de lab
Bca i sem  de labBca i sem  de lab
Bca i sem de lab
 
Logic gates 12th standard ivestigatory project
Logic gates 12th standard ivestigatory projectLogic gates 12th standard ivestigatory project
Logic gates 12th standard ivestigatory project
 
Logic Gates
Logic GatesLogic Gates
Logic Gates
 
Logic gates 07 11-2014
Logic gates 07 11-2014Logic gates 07 11-2014
Logic gates 07 11-2014
 
LOGIC GATES
LOGIC GATESLOGIC GATES
LOGIC GATES
 
Logic gates
Logic gatesLogic gates
Logic gates
 
Logic gates ,flip flop ,registers and
Logic gates ,flip flop ,registers andLogic gates ,flip flop ,registers and
Logic gates ,flip flop ,registers and
 
PPT of Dr. Arun Somani_MIPS_SC-Extended.pdf
PPT of Dr. Arun Somani_MIPS_SC-Extended.pdfPPT of Dr. Arun Somani_MIPS_SC-Extended.pdf
PPT of Dr. Arun Somani_MIPS_SC-Extended.pdf
 
vhdl.ppt Verilog Hardware Description Language
vhdl.ppt Verilog Hardware Description Languagevhdl.ppt Verilog Hardware Description Language
vhdl.ppt Verilog Hardware Description Language
 
Boolean Algebra part 2.ppt
Boolean Algebra part 2.pptBoolean Algebra part 2.ppt
Boolean Algebra part 2.ppt
 
introduction of logic gates
introduction of logic gates introduction of logic gates
introduction of logic gates
 
LOGICAL_GATES_priyansh_singhal.pdf
LOGICAL_GATES_priyansh_singhal.pdfLOGICAL_GATES_priyansh_singhal.pdf
LOGICAL_GATES_priyansh_singhal.pdf
 
11_Fundamentals_of_Digital_Electronics_L.pptx
11_Fundamentals_of_Digital_Electronics_L.pptx11_Fundamentals_of_Digital_Electronics_L.pptx
11_Fundamentals_of_Digital_Electronics_L.pptx
 
Boolean Algebra
Boolean AlgebraBoolean Algebra
Boolean Algebra
 
Digital electronics logic design complete notes.pdf
Digital electronics logic design complete notes.pdfDigital electronics logic design complete notes.pdf
Digital electronics logic design complete notes.pdf
 
Logic gatesrevised.ppt
Logic gatesrevised.pptLogic gatesrevised.ppt
Logic gatesrevised.ppt
 

Recently uploaded

一比一原版(Monash毕业证书)莫纳什大学毕业证成绩单如何办理
一比一原版(Monash毕业证书)莫纳什大学毕业证成绩单如何办理一比一原版(Monash毕业证书)莫纳什大学毕业证成绩单如何办理
一比一原版(Monash毕业证书)莫纳什大学毕业证成绩单如何办理
pyhepag
 
一比一原版纽卡斯尔大学毕业证成绩单如何办理
一比一原版纽卡斯尔大学毕业证成绩单如何办理一比一原版纽卡斯尔大学毕业证成绩单如何办理
一比一原版纽卡斯尔大学毕业证成绩单如何办理
cyebo
 
一比一原版阿德莱德大学毕业证成绩单如何办理
一比一原版阿德莱德大学毕业证成绩单如何办理一比一原版阿德莱德大学毕业证成绩单如何办理
一比一原版阿德莱德大学毕业证成绩单如何办理
pyhepag
 
一比一原版麦考瑞大学毕业证成绩单如何办理
一比一原版麦考瑞大学毕业证成绩单如何办理一比一原版麦考瑞大学毕业证成绩单如何办理
一比一原版麦考瑞大学毕业证成绩单如何办理
cyebo
 
Exploratory Data Analysis - Dilip S.pptx
Exploratory Data Analysis - Dilip S.pptxExploratory Data Analysis - Dilip S.pptx
Exploratory Data Analysis - Dilip S.pptx
DilipVasan
 
一比一原版西悉尼大学毕业证成绩单如何办理
一比一原版西悉尼大学毕业证成绩单如何办理一比一原版西悉尼大学毕业证成绩单如何办理
一比一原版西悉尼大学毕业证成绩单如何办理
pyhepag
 
Fuzzy Sets decision making under information of uncertainty
Fuzzy Sets decision making under information of uncertaintyFuzzy Sets decision making under information of uncertainty
Fuzzy Sets decision making under information of uncertainty
RafigAliyev2
 

Recently uploaded (20)

一比一原版(Monash毕业证书)莫纳什大学毕业证成绩单如何办理
一比一原版(Monash毕业证书)莫纳什大学毕业证成绩单如何办理一比一原版(Monash毕业证书)莫纳什大学毕业证成绩单如何办理
一比一原版(Monash毕业证书)莫纳什大学毕业证成绩单如何办理
 
MALL CUSTOMER SEGMENTATION USING K-MEANS CLUSTERING.pptx
MALL CUSTOMER SEGMENTATION USING K-MEANS CLUSTERING.pptxMALL CUSTOMER SEGMENTATION USING K-MEANS CLUSTERING.pptx
MALL CUSTOMER SEGMENTATION USING K-MEANS CLUSTERING.pptx
 
Atlantic Grupa Case Study (Mintec Data AI)
Atlantic Grupa Case Study (Mintec Data AI)Atlantic Grupa Case Study (Mintec Data AI)
Atlantic Grupa Case Study (Mintec Data AI)
 
AI Imagen for data-storytelling Infographics.pdf
AI Imagen for data-storytelling Infographics.pdfAI Imagen for data-storytelling Infographics.pdf
AI Imagen for data-storytelling Infographics.pdf
 
一比一原版纽卡斯尔大学毕业证成绩单如何办理
一比一原版纽卡斯尔大学毕业证成绩单如何办理一比一原版纽卡斯尔大学毕业证成绩单如何办理
一比一原版纽卡斯尔大学毕业证成绩单如何办理
 
How I opened a fake bank account and didn't go to prison
How I opened a fake bank account and didn't go to prisonHow I opened a fake bank account and didn't go to prison
How I opened a fake bank account and didn't go to prison
 
一比一原版阿德莱德大学毕业证成绩单如何办理
一比一原版阿德莱德大学毕业证成绩单如何办理一比一原版阿德莱德大学毕业证成绩单如何办理
一比一原版阿德莱德大学毕业证成绩单如何办理
 
一比一原版麦考瑞大学毕业证成绩单如何办理
一比一原版麦考瑞大学毕业证成绩单如何办理一比一原版麦考瑞大学毕业证成绩单如何办理
一比一原版麦考瑞大学毕业证成绩单如何办理
 
how can i exchange pi coins for others currency like Bitcoin
how can i exchange pi coins for others currency like Bitcoinhow can i exchange pi coins for others currency like Bitcoin
how can i exchange pi coins for others currency like Bitcoin
 
basics of data science with application areas.pdf
basics of data science with application areas.pdfbasics of data science with application areas.pdf
basics of data science with application areas.pdf
 
2024 Q1 Tableau User Group Leader Quarterly Call
2024 Q1 Tableau User Group Leader Quarterly Call2024 Q1 Tableau User Group Leader Quarterly Call
2024 Q1 Tableau User Group Leader Quarterly Call
 
Exploratory Data Analysis - Dilip S.pptx
Exploratory Data Analysis - Dilip S.pptxExploratory Data Analysis - Dilip S.pptx
Exploratory Data Analysis - Dilip S.pptx
 
Slip-and-fall Injuries: Top Workers' Comp Claims
Slip-and-fall Injuries: Top Workers' Comp ClaimsSlip-and-fall Injuries: Top Workers' Comp Claims
Slip-and-fall Injuries: Top Workers' Comp Claims
 
一比一原版西悉尼大学毕业证成绩单如何办理
一比一原版西悉尼大学毕业证成绩单如何办理一比一原版西悉尼大学毕业证成绩单如何办理
一比一原版西悉尼大学毕业证成绩单如何办理
 
2024 Q2 Orange County (CA) Tableau User Group Meeting
2024 Q2 Orange County (CA) Tableau User Group Meeting2024 Q2 Orange County (CA) Tableau User Group Meeting
2024 Q2 Orange County (CA) Tableau User Group Meeting
 
Pre-ProductionImproveddsfjgndflghtgg.pptx
Pre-ProductionImproveddsfjgndflghtgg.pptxPre-ProductionImproveddsfjgndflghtgg.pptx
Pre-ProductionImproveddsfjgndflghtgg.pptx
 
Easy and simple project file on mp online
Easy and simple project file on mp onlineEasy and simple project file on mp online
Easy and simple project file on mp online
 
Fuzzy Sets decision making under information of uncertainty
Fuzzy Sets decision making under information of uncertaintyFuzzy Sets decision making under information of uncertainty
Fuzzy Sets decision making under information of uncertainty
 
Supply chain analytics to combat the effects of Ukraine-Russia-conflict
Supply chain analytics to combat the effects of Ukraine-Russia-conflictSupply chain analytics to combat the effects of Ukraine-Russia-conflict
Supply chain analytics to combat the effects of Ukraine-Russia-conflict
 
Machine Learning for Accident Severity Prediction
Machine Learning for Accident Severity PredictionMachine Learning for Accident Severity Prediction
Machine Learning for Accident Severity Prediction
 

Arithmatic and logic units of the cpu intro

  • 1. 1 Hardware for Arithmetic • Today’s topics:  Logic for common operations  Designing an ALU
  • 2. 2 Common Logic Blocks – Decoder Takes in N inputs and activates one of 2N outputs I0 I1 I2 O0 O1 O2 O3 O4 O5 O6 O7 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 1 1 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 1 0 1 0 0 0 0 0 1 0 0 1 1 0 0 0 0 0 0 0 1 0 1 1 1 0 0 0 0 0 0 0 1 3-to-8 Decoder I0-2 O0-7
  • 3. 3 Common Logic Blocks – Multiplexor • Multiplexor or selector: one of N inputs is reflected on the output depending on the value of the log2N selector bits 2-input mux Source: H&P textbook
  • 4. 4 1-Bit ALU with Add, Or, And • Multiplexor selects between Add, Or, And operations Source: H&P textbook
  • 5. 5 32-bit Ripple Carry Adder 1-bit ALUs are connected “in series” with the carry-out of 1 box going into the carry-in of the next box Source: H&P textbook
  • 6. 6 Incorporating Subtraction Must invert bits of B and add a 1 • Include an inverter • CarryIn for the first bit is 1 • The CarryIn signal (for the first bit) can be the same as the Binvert signal Source: H&P textbook
  • 7. 7 Incorporating NOR and NAND Source: H&P textbook
  • 8. 8 Incorporating slt • Perform a – b and check the sign • New signal (Less) that is zero for ALU boxes 1-31 • The 31st box has a unit to detect overflow and sign – the sign bit serves as the Less signal for the 0th box Source: H&P textbook
  • 9. Incorporating beq • Perform a – b and confirm that the result is all zero’s 9 Source: H&P textbook
  • 10. 10 Control Lines What are the values of the control lines and what operations do they correspond to? Source: H&P textbook
  • 11. 11 Control Lines What are the values of the control lines and what operations do they correspond to? Ai Bn Op AND 0 0 00 OR 0 0 01 Add 0 0 10 Sub 0 1 10 SLT 0 1 11 NOR 1 1 00 Source: H&P textbook