Professional Documents
Culture Documents
Outline
Microoperations
s0 s1 s2
Bus
7
READ
1
CLR
INR PC
2
CLR
INR
DR INR AC
3
CLR
4
CLR
LD
INR INPR IR
5 6
CLR Clock
INR OUTR
Arithmetic Microoperations
A Microoperation is an elementary operation performed with the data stored in registers. Usually, it consist of the following 4 categories: Register transfer: transfer data from one register to another Arithmetic microoperation Logic microoperation Shift microoperation
Arithmetic Microoperations
Symbolic designation R3 R1 + R2 R3 R1 R2 R2 R2 R2 R2 + 1 R3 R1 + R2 + 1 R1 R1 + 1 R1 R1 1 Description Contents of R1 plus R2 transferred to R3 Contents of R1 minus R2 transferred to R3 Complement the contents of R2 (1s complement) 2s Complement the contents of R2 (negate) R1 plus the 2s complement of R2 (subtract) Increment the contents of R1 by one Decrement the contents of R1 by one
Multiplication and division are not basic arithmetic operations Multiplication : R0 = R1 * R2 Division : R0 = R1 / R2
Arithmetic Microoperations
A single circuit does both arithmetic addition and subtraction depending on control signals. Arithmetic addition: R3 R1 + R2 (Here + is not logical OR. It denotes addition)
BINARY ADDER
FULL-ADDER
It has 3 input and 2 output
To implement an arithmetic adder for multiple-bit inputs, we need to treat the carry out from the lower bit as a third input ( it becomes carry in for the current bit) in addition to the two input bits at the current bit position. X1 Y1 Z1 S 1 C1 X0 Y0 Z0 S0 C0 +
Full- Adder
It adds 3-bits, it has 3-inputs and 2-outputs
We will use x, y and z for inputs and s for sum and c for carry are the two outputs. x y z c s The truth table 0 0 0 0 0
0 0 0 1 0 1 1 0 1 0 1 0 0 0 1 0 1 1 0 1
1
1 1
0
1 1
1
0 1
1
1 1
0
0 1
Full Adder
Putting them together we get:
S= x y z C= z (x y) + xy
BINARY ADDER
Arithmetic Microoperations
Arithmetic subtraction: R3 R1 + R2 + 1 where R2 is the 1s complement of R2. Adding 1 to the ones complement is equivalent to taking the 2s complement of R2 and adding it to R1.
BINARY ADDER-SUBTRACTOR
The addition and subtraction operations cane be combined into one common circuit by including an exclusive-OR gate with each full-adder. XOR M b 0 0 0 1 1 0 1 1
0 1 1 0
BINARY ADDER-SUBTRACTOR
M = 0: Note that B XOR 0 = B. This is exactly the same as the binary adder with carry in C0 = 0.
M = 1: Note that B XOR 1 = B (flip all B bits). The outputs of the XOR gates are thus the 1s complement of B. M = 1 also provides a carry in 1. The entire operation is: A + B + 1.
BINARY ADDER-SUBTRACTOR
Outline
Microoperations
Logic Microoperations
LOGIC CIRCUIT
A variety of logic gates are inserted for each bit of registers. Different bitwise logical operations are selected by select signals.
Example
Extend the previous logic circuit to accommodate XNOR, NAND, NOR, and the complement of the second input.
S2 0 0 0 0 1 1 1 1
S1 0 0 1 1 0 0 1 1
S0 0 1 0 1 0 1 0 1
Output XY XY XY
A (X Y)
(X Y) (X Y)
B
F0 = 0 F1 = xy F2 = xy F3 = x F4 = xy F5 = y F6 = x y F7 = x+y
F8 = (x+y) F AB NOR F9 = (x y) F A B Ex-NOR F10 = y FB Compl-B F11 = x+y F AB F12 = x FA Compl-A F13 = x+y F AB F14 = (xy) F AB NAND F15 = 1 F all 1s set to all 1s
Homework 1
Outline
Microoperations
Shift Microoperations :
Shift microoperations are used for serial transfer of data Three types of shift microoperation : Logical, Circular, and Arithmetic
Shift Microoperations
Symbolic designation R shl R R shr R R cil R R cir R R ashl R R ashr R Description Shift-left register R Shift-right register R Circular shift-left register R Circular shift-right register R Arithmetic shift-left R Arithmetic shift-right R
Logical Shift
A logical shift transfers 0 through the serial input The bit transferred to the end position through the serial input is assumed to be 0 during a logical shift (Zero inserted)
Circular Shift
The circular shift circulates the bits of the register around the two ends without loss of information
R1 cil R1 R 2 cir R 2
Arithmetic Shift
An arithmetic shift shifts a signed binary number to the left or right An arithmetic shift-left multiplies a signed binary number by 2 An arithmetic shift-right divides the number by 2 In arithmetic shifts the sign bit receives a special treatment
Arithmetic right-shift: Rn-1 remains unchanged; Rn-2 receives Rn-1, Rn-3 receives Rn-2, so on. For a negative number, 1 is shifted from the sign bit to the right. A negative number is represented by the 2s complement. The sign bit remained unchanged.
Example 1
Example 2
R2 ashl R2
LSB
Rn-1
Rn-2
0 insert
Example 1
Example 2
Example 3
Example 4
Example
example: 011011 SHL SHR CiL CiR ASHL ASHR 110110 001101 110110 101101 Overflow 001101