Presentation is loading. Please wait.

Presentation is loading. Please wait.

By: A. H. Abdul Hafez CAO, by Dr. A.H. Abdul Hafez, CE Dept. HKU

Similar presentations


Presentation on theme: "By: A. H. Abdul Hafez CAO, by Dr. A.H. Abdul Hafez, CE Dept. HKU"— Presentation transcript:

1 Computer Architecture and Organization: L05: Arithmetic Micro-operations
By: A. H. Abdul Hafez CAO, by Dr. A.H. Abdul Hafez, CE Dept. HKU January 10, 2019

2 Outlines Arithmetic microoperation Full adder Four bit parallel adder
Adder – subtractor circuit Four bits arithmetic circuit One stage logic unite Logic microoperation example Shift microoperation Logic shift Circular shift Arithmetic shift Shift unit ALU End CAO, by Dr. A.H. Abdul Hafez, CE Dept. HKU January 10, 2019

3 Main Types of Microoperations in Digital Computers
Register Transfer Microoperations transfer binary information from one register to another. Arithmetic Microoperations perform arithmetic operations on numeric data stored in registers. Logic Microoperations perform bit manipulation operations on (non-numeric) data stored in registers. Shift Microoperations perform shift operations on data stored in registers. CAO, by Dr. A.H. Abdul Hafez, CE Dept. HKU January 10, 2019

4 Arithmetic Microoperations
Symbolic Designation Description R3  R1 + R2 Contents of R1 plus R2 transferred to R3 R3  R1 – R2 Contents of R1 minus R2 transferred to R3 R2  R’2 Complement of the contents of R2 (1’s complement) R2  R’2 + 1 2’s complement of the contents of R2 R3  R1 + R’2 + 1 R1 plus the 2’s complement of R2 (subtraction) R1  R1 + 1 Increment the contents of R1 by one R1  R1 -1 Decrement the contents of R1 by one CAO, by Dr. A.H. Abdul Hafez, CE Dept. HKU January 10, 2019

5 The full Adder Half Adder 0 0 0 0 0 1 0 1 1 0 0 1 1 1 1 0 x y c s x y
x y c s x y c s c = xy s = xy’ + x’y = x  y Full Adder x y cn cn s x y S cn cn-1 CAO, by Dr. A.H. Abdul Hafez, CE Dept. HKU January 10, 2019

6 The full Adder The full adder accepts two input bits and an input carry and generates a sum output and an output carry A B Cin Cout 1 CAO, by Dr. A.H. Abdul Hafez, CE Dept. HKU January 10, 2019

7 Four-bits parallel adder
CAO, by Dr. A.H. Abdul Hafez, CE Dept. HKU January 10, 2019

8 2’s complement form A negative value is the 2’s complement of the corresponding positive value. CAO, by Dr. A.H. Abdul Hafez, CE Dept. HKU January 10, 2019

9 Binary adder-subtractor
M=0  Add M=1  Subtract M C4 C3 C2 C1 C0 FA FA FA FA S3 S2 S1 S0 CAO, by Dr. A.H. Abdul Hafez, CE Dept. HKU January 10, 2019

10 4-bit Arithmetic Circuit
Cin A0 FA C0 4-bit Arithmetic Circuit X0 S1 S1 4x1 MUX S0 S0 D0 B0 Y0 C1 1 2 1 3 A1 X1 FA S1 4x1 MUX S0 D1 B1 Y1 C2 1 2 1 3 The output of the circuit is represented by the expression: D= A + Y + Cin A2 X2 FA S1 4x1 MUX S0 D2 B2 Y2 C3 1 2 The value of Y is depend on the value of the selector lines. 1 3 A3 X3 FA S1 4x1 MUX S0 D3 B3 Y3 1 C4 CAO, by Dr. A.H. Abdul Hafez, CE Dept. HKU 2 January 10, 2019 1 3 Cout

11 Arithmetic Circuit Function Table
Select Input Output Microoperation S1 S0 Cin Y D = A + Y + Cin B D = A + B Add 1 D = A + B + 1 Add with carry B’ Subtract with borrow Subtract D = A Transfer A D = A + 1 Increment A D = A - 1 Decrement A Arithmetic Circuit Function Table CAO, by Dr. A.H. Abdul Hafez, CE Dept. HKU January 10, 2019

12 Logic Microoperations
CAO, by Dr. A.H. Abdul Hafez, CE Dept. HKU January 10, 2019

13 One Stage Logic Circuit
4x1 MUX S0 Ai Bi Ei 1 S1 S0 Output Operation E = A  B AND 1 E = A  B OR E = A  B XOR E = A Complement 2 3

14 Logic microoperation Examples
Selective set Selective clear Selective complement Mask Compare Insert CAO, by Dr. A.H. Abdul Hafez, CE Dept. HKU January 10, 2019

15 A or B Selective Set 1010 Content of Register A before Microoperation
Setting a bit is turning that bit on (making it 1) 0  1 1  1 1010 Content of Register A before Microoperation 1100 Content of Register B (Logic Operand) 1110 Content of Register A after Microoperation What is the logic function that performs the selective set micro-operation ? A or B

16 Selective Clear 1010 A Before 1100 B (Logic Operand) -------
Clearing a bit is turning that bit off (making it 0) 0  0 1  0 A Before B (Logic Operand) A after What is the logic function that performs the selective clear micro-operation ? A and B

17 Selective Complement 1010 A Before 1100 B (Logic Operand) -------
Complementing a bit is negating the bit 0  1 1  0 1010 A Before 1100 B (Logic Operand) 0110 A after What is the logic function that performs the selective complement micro-operation ? A xor B

18 Mask (Select) Operation
Masking a bit is selecting the bit if the mask bit is 1 Mask bit = 1  0  0 , 1  1 Mask bit = 0 1  0 , 0  0 1010 A Before 1100 B (Mask) 1000 A after What is the logic function that performs the mask micro-operation ? A and B

19 Compare Microoperation
A  A  B 1010 A 1010 B 0000 A  A  B

20 Insert Microoperation
Inserting a group of bits into one part of a register e.g. insert 1001 into the most significant nibble of a register A Before B (mask) A after Microoperation 1 Step no.1 Masking (A And B) A Before B (insert) A after Step No.2 (A OR B) Microoperation 2

21 Shift microoperations
Logical shift : transfers 0 through the serial input 7 Logical Shift R2← shr R2 R1← shl R1 Circular shift : circulates the bits around the two ends without loss the information. 7 R1← cil R1 R2← cir R2 7 Circular Shift (Rotate) CAO, by Dr. A.H. Abdul Hafez, CE Dept. HKU January 10, 2019

22 Shift microoperations
Arithmetic shift: shifts a signed binary number to the left or to the right. The sign bit must not changed because the sign of the number remains the same. 7 Arithmetic Shift Right (Divide by 2) R← ashr R -8 4 2 1 -8 4 2 1 Before 1 1 Before 1 1 1 1 After 1 1 1 After Negative Numbers Positive Numbers CAO, by Dr. A.H. Abdul Hafez, CE Dept. HKU January 10, 2019 Negative Numbers Positive Numbers

23 Shift microoperations
Arithmetic shift: shifts a signed binary number to the left or to the right. The sign bit may be changed. 7 Arithmetic Shift Left (Multiply by 2) R← ashl R -8 4 2 1 -8 4 2 1 Before 1 Before 1 1 1 After 1 1 After No Overflow Overflow ! Overflow occurs if, before the shift, Vs = Rn-1  Rn-2 Vs = R3  R2 CAO, by Dr. A.H. Abdul Hafez, CE Dept. HKU January 10, 2019

24 4-bits combinational circuit shifter
CAO, by Dr. A.H. Abdul Hafez, CE Dept. HKU January 10, 2019

25 Arithmetic logic shift unit ALU
CAO, by Dr. A.H. Abdul Hafez, CE Dept. HKU January 10, 2019

26 Function Table for Arithmetic Logic Shift Unit
CAO, by Dr. A.H. Abdul Hafez, CE Dept. HKU January 10, 2019

27 The end of the Lecture Thanks for your time Questions are welcome
CAO, by Dr. A.H. Abdul Hafez, CE Dept. HKU January 10, 2019


Download ppt "By: A. H. Abdul Hafez CAO, by Dr. A.H. Abdul Hafez, CE Dept. HKU"

Similar presentations


Ads by Google