Mod 2
Mod 2
MODULE –II
0 00101000 001010………………….0
For excess-127 format, 0 ≤ E’ ≤ 255. However, 0 and 255 are used to represent special
value. So actually 1 ≤ E’ ≤ 254. That means -126 ≤ E ≤ 127.
Single precision uses 32-bit. The value range is from 2-126 to 2+127.
Double precision used 64-bit. The value range is from 2-1022 to 2+1023. Note the
following aspects
If a number is not normalized, it can always be put in normalized form by shifting the
fraction and adjusting the exponent.
As computations proceed, a number that does not fall in the represent able
R402-CO-Module III
Add/Subtract Rule
1. Choose the number with the smallest exponent and shift its mantissa right n times
where n is the difference between the exponents.
2. Set the exponent of the result as that of the larger exponent.
3. Perform addition or subtraction on the mantissa and determine the sign of the result.
4. Normalize the resulting value is necessary.
1.Multiply Rule
2
R402-CO-Module III
2.Divide Rule
3
R402-CO-Module III
Flow Chart
4
R402-CO-Module III
5
R402-CO-Module III
Flow Chart(DIVIDE )
6
R402-CO-Module III
In step 1, compare the exponent to determine how far to shift the smaller
exponent. Shift count value n= EA’-EB’ is determined by the subtractor unit. The value n
is sent to the shifter unit. The sign of the difference determine which mantissa to be
shifted. The sign sent to the Swap circuit. If the sign is 0 then EA’> EB” and mantissa
MA and MB are sent straight through the swap network. MB sent to the shifter unit and
shift n times right. MA sent directly to the adder/sub unit. If the sign is 1 then EA’< EB’
and mantissa swapped and sent to the shifter.
7
R402-CO-Module III
II.ALU DESIGN
A ns B are the inputs. S2= mode select ( select the arithmetic or logic operation)
S1 S0 specifies the operation to be performed. S0 S1 and Cin combine to generate 8
operations.
Design of ALU has 3 stages.
2) Determine the logic operations obtained from the arithmetic circuit in step 1,assuming
that the input carries to all stages are 0.
8
R402-CO-Module III
The basic component in the ALU is a Parallel adder.Consider the above figure we obtain
the following 8 functions
S1 S0 Output Operation
0 0 Fi= Ai + Bi OR
0 1 Fi = Ai XOR Bi XOR
1 0 Fi= AiBi AND
9
R402-CO-Module III
1 1 F= Ai NOT
10
R402-CO-Module III
• All other carries are connected internally from one stage to the next
• The selection variables are s1, s0 and Cin
• Variables s1 and S0 control all of the B inputs to the full-adder circuits
• The A inputs go directly to the other inputs of the full adders
V. DECIMALARITHMETIC
ADDITION,SUBTRACTION,MULTIPLICATION AND DIVISION
Addition and subtraction of decimals is like adding and subtracting whole numbers. The
only thing we must remember is to line up the place values correctly. The easiest way to
do that is to line up the decimal points
Example
Here is an example of adding 12.35 and 5.287. 12.35+
Notice how the decimal points are lined up. 5.287
_________
17.637
Here is an example of subtracting 2.28 from
12.993. Notice how the decimal points are lined up.
12.993 +
2.28
---------------------
15.273
11
R402-CO-Module III
12
R402-CO-Module III
tenths column.
Multiplication of Decimals
When multiplying numbers with decimals, we first multiply them as if they were whole
numbers. Then, the placement of the number of decimal places in the result is equal to the
sum of the number of decimal places of the numbers being multiplied.
13
R402-CO-Module III
Division of Decimals
Division with decimals is easier to understand if the divisor (the dividend is divided by
the divisor) is a whole number.
14
R402-CO-Module III
15
R402-CO-Module III
MDR
Move (R1), R2
MAR ← [R1]
Start a Read operation on the memory bus
Wait for the MFC response from the memory
Load MDR from the memory bus
R2 ← [MDR]
Move (R1), R2
1. R1out, MARin, Read
2. MDRinE, WMFC
3. MDRout, R2in
16
Figure 7.6. Control sequencefor executionof the instruction Add (R3),R1.
R402-CO-Module III
A branch instruction replaces the contents of PC with the branch target address,
which is usually obtained by adding an offset X given in the branch instruction.
The offset X is usually the difference between the branch target address and the
address immediately following the branch instruction.
17
R402-CO-Module III
Step Action
3. HARDWIRED CONTROL
To execute instructions, the processor must have some means of generating the
control signals needed in the proper sequence. The two categories are hardwired
control and microprogrammed control. Hardwired system can operate at high speed;
but with little flexibility.
18
CLK
Clock Control step Reset
R402-CO-Module III
counter
Step decoder
T 1 T2 Tn
INS1
External
INS2 inputs
Instruction
IR Encoder
decoder
Condition
codes
INSm
Run End
Control signals
19
R402-CO-Module III
20
R402-CO-Module III
4. MICROPROGRAMMED CONTROL
Every time a new instruction is loaded into the IR, the output of the block labeled
“starting address generator” is loaded into the PC. The PC is then automatically
incremented by the clock, causing successive microinstructions to be read from the
control store. Hence, the control signals are delivered to various parts of the processor in
the correct sequence.
21
R402-CO-Module III
Fig: Organization of the control unit to allow conditional branching in the microprogram.
To support micro program branching, the organization of the control unit should be
modified. The starting and branch address generator loads a new address into the PC.
To allow implementation of a conditional branch, input to this block consists of the
external inputs and condition codes as well as the contents of the instruction register. In
this control unit, the PC is incremented every time a new microinstruction is fetched
from the micro program memory, except in the following situations:
When a new instruction is loaded into the IR, the PC is loaded with the starting
address of the micro routine for that instruction.
When a branch microinstruction is encountered and the branch condition is
satisfied, the PC is loaded with the branch address.
When an End microinstruction is encountered, the PC is loaded with the address
of the first CW in the micro routine for the instruction fetch cycle.
ADD (Rs) +, Rd
1. PCout, MARin, Read, Select 4, Add, Zin
2. Zout, PCin, Yin, WMFC
3. MDRout, IRin
4. Rsout, MARin, Read, Select 4, Add, Zin
5. Zout, Rsin
6. Rdout, Yin, WMFC
7. MDRout, Select Y, Add, Zin
8. Zout, Rdin, End
22
R402-CO-Module III
The easiest way of structuring a microinstruction is to assign one bit for each control
signal. But this results in very long microinstructions and also only a very few of these
will be set to one in a particular clock cycle. So it is better to encode the
microinstructions such that a group of bits represent many control sequence, a particular
pattern of these bits represents a particular microinstruction. A horizontal
microinstruction is a minimally encoded scheme and a vertical microinstruction is a
tightly encoded scheme. In general, a horizontal approach involves a wider control store,
but is capable of greater speed. The vertical approach requires a narrow control store, but
must be decoded in order to drive the actual control lines, thus introducing a delay in
driving the control lines.
23
R402-CO-Module III
It has four addressing modes: register, autoincrement, autodecrement, and indexed (with
indirect forms).
24
R402-CO-Module III
25
External Condition
Inputs codes
Decoding circuits
A R
Control store
Next address I R
Microinstruction decoder
Control signals
26