ALU Orgenisation
ALU Orgenisation
ORGANISATION
Structure
3.0 Inuoduction
3.1 Objectives
3.2 ALU Organisation
3.2.1 A simple ALU Organisation
3.2.2 Floa~ingpoint ALU
3.2.3 Arithmetic Processors
3.3 Control Unit Organization
3.3.1 Functional Requirements of a Control Unit
3.3.2 Structure of Control Unit
3.3.3 An Illustration of Control
3.3.4 Hardwired Control Unit
3.4 Summary
3.5 Model Answers
3.0 INTRODUCTION
By now we have discussed about the instruction sets and register organisation followed by a
discussion on the micro-operations and a simple arithmetic logic unit circuit. In all the
j previous Units, we have used a term conuol signals, without any definition. In this unit fmt
we will discuss about the ALU organisation. We will also discuss about the floating point
ALU and arithmetic co-processors which are commonly used for floating point
computations. This discussion will be followed by the discussions on the confrol unit, a
component which causes all the components of computer to behave effectively to achieve the
basic objective i.e. program execution. The control unit causes all the things to happen in the
computer.
We will discuss about the functions of a conuol unit, its structure followed by the hardwired
type of control unit. We will introduce the micro-programmed based conml unit in the next
Unit. The details provided in Unit 3 and 4 about confrol units can be supplemented by the
details given in the further readings of the block.
OBJECTIVES
At the end of this unit, you will be able to
I
discuss the &sic organisation of ALU
I
discuss the requirements of a floating point ALU
define the term arithmetic coprocessor
define what is a control unit and its functions
f
1
describe a simple conuol unit organisation
As discussed earlier, an ALU performs the simple arithmetic-logic and shift operations. The
complexity of an ALU depends on the type of instruction set which has been realised for it.
The simple ALUs can be constructed for fixed point numbers, on the other hand the floating
p,oint arithmetic implementation require more complex control logic and data processing
capabilities, i.e. the hardware. Several micro-processor families utilizes only fixed point
arithmetic capabilities in the ALUs and for floating point arithmetic or other complex
functions they may utilise an auxiliary special purpose unit. This unit is called arithmetic
co-processor. Let us discuss all these in greater details in this section.
CPU Organisation
3.2.1 A Simple A L U Organisation
An ALU consist of various circuits which arc uscd for excculion of data processing
micro-operations. But how these ALU circuits are used in conjunction of other registers and
control unit. The simplest organisation in this respect for fixed point ALU was suggested by
John von Neumann in his IAS computer design. The structure of this simple organisation is
given in figure 1.
Register Quotient
Register (MQ)
QRegister (DR)
.) .) -
Parallel
Adder and
other Logic
Circuits
,
Flags -
-
- Control
Unit
: Control
Signals
The organisation have three onc word registers AC, MQ and DR which are used for data
storage. Please noLe that the arithmetic, logic circuits have two inputs and only one output.
In the present case the two inputs are AC and DR registers, while output is AC register. AC
and MQ are generally organiscd as a single AC.MQ register. This register is capable of left or
right shift operations. Somc of thc micro-operations which can be defined on this unit are :
Addition : ACtAC+DR
Subtraction : ACtAC-DR
AND : AC~ACADR
OR : ACcACvDR
Exclusive OR : AC t AC @ DR
NOT : A C t X
In this ALU organisation the multiplication and division are implemented using shift-add/
subtract operations. The MQ (Multiplier-Quotient register) is a special register used for
implementation of multiplication and division. We are no1 giving the details of how this
register can be used for implementing multiplication and division algorithms. For more
details on these algorithms please refer to further readings. The MQ register stores the
multiplier if multiplication is to be performcd or the quotient if ,&vision is to be performed.
For multiplication or division operations DR register stores the multiplicand or divisor
respectively. The result of multiplication or division on applying certain algorithm can
finally be obtained in AC.MQ register combination. These operations can be represented as:
Multiplication : AC.MQ c DR x MQ
Division : AC.MQ t MQ + DR
DR is another important registcr which is used for storing second operand. In fact it acts as a
buffer register which stores the data brought from the memory for an instruction. In
machines where we have general purpose registers, for example motorola 68020, any of the
register can be utilised as AC. MQ and DR.
The characteristics of a typical floating point represencation of 32 bit in the above figure are:
Now, let us define the range which a normalised mantissa can represent. As for a normalised
mantissa the left most bit can not be zero, therefore, it has to be 1. Thus, it is not necessary to
store this first bit and it is assumed implicitly for the number. Therefore, a 23 bit mantissa
can represent 23 + 1 = 24 bit significand.
Minimum value of the significand:
The implicit first bit as 1 followed by 23 zero's
0.1000 0000 0000 0000 0000 0000
Decimal equivalent = 1x2.' = 0.5
-
.
- !!
.-
'3
~ e ~ r t i v d , numbers
~ I- , , I Positive Positive
overflow numbers
expressible expressible overflow
In floating point numbers, the basic trade off is between the range of the numbers and
accuracy or precision of numbers. If in 32 bit format we increase the exponent bits, the
range can be increased, however the accuracy of numbers will go down as significand will
become smaller. Let us give an example which will clarify the term precision. Suppose we
have one bit binary significand then we can represent only 0.10 and 0.11 in a normalised
form. The values such as 0.101,0.1011 and so on can not be represented as a complete
numbers. Either they have to be approximated or truncated and will be represented as either
0.10 or 0.11. Thus, it will create an error. The higher the number of bits in significand better
will be precision.
In floating point numbers for increasing both precision and range more number of bits are
needed. This can be achieved by using double precision numbers. A double precision format
is normally of 64 bits.
Institute of Electrical and Electronics Engineers (IEEE) a society which has created lot of
standards regarding various aspects of computer have created IEEE standard 754 for floating
point representation and arithmetic. The basic objective of developing this stan-dard was to
facilitate the portability of programs from one to another computer. This standard has
resulted in development of some standard numerical capabilities in various micro-processors.
This representation is shown in figure 4.
Im~liedbase = 2
0 1 8 9 31 ~ignificand is in
normalired form i.e.
Biased Significand the first bit is
Exponent (E)
implied and is 1
Single precesion = 32 bits S is sign bit
t
S
Biased Expanent Significrrnd
(El m)
Double precision = 64 bits
Figure 5 gives the floating point numbers specified by the IEEE standard 754.
Single Precision Numbers (32 bits)
Exponent (E) Signijlcand (N) Value l Comments
255 Not equal to 0 Do not represent a number
Alu and Control Unlt
255 0 - or + od de nding on sign bit
2r- Orprnlntbn
O<E<255 Any k (IN) 2E-1
For example, if S is zero that is
positive number;
N = 101 (rest 20 zeros) and E = 207,
then the number is = + ( l . l 0 l ) 2 ~ ' ~ ' ~
= +1.101x2~~
0 Not equal to 0 * (0~2-I%
f 0 depending on the sign bit.
0 0
Double precision Numbers (64 bits)
Exponent (E) Significand (N) Value I Comments
2047 Not equal to 0 Do not represent a number
-
2047
O<E<2047
0
Any * (or1+~ 2deIF~ nding
00
- '
on the sign bit
Please note that IEEE standard 754 specifies plus zero and minus zero and plus infinity and
minus infinity. Floating point arithmetic is more sticky than fixed point arithmetic. For
floating point addition and subtraction we have to:
, check whether a typical operand is zero
align the significant such that both the significands have same exponent
add or subtract the significand only and finally
the significand is normalised again
These operations can be representedas :
and X-~=(N~X~~-~Y--N~)X~E'
Here, the assumption is that exponent of x (EJ is greater than exponent of y (E,). Nxand Ny
represent mantissa of x and y respectively.
Wtiile far multiplication and division operations the significand need to be multiplied or
divided respectively however, the exponent is to be added or to be subtracted respectively.
In case we are using bias of 128 or any other bias for exponent then on addition of exponents
since both the exponents have bias, the bias gets doubled. Therefore, we must subtract the
bias from the exponent on addition of exponents. However, bias is to be added if we are
subtracting the exponents. The division and multiplication operating can be represented as:
Ex + Ey
x x y=(NxxNy)x2
x+y=(NX+Ny)x2Ex-Ey
For more details on floating point arithmetic you can refer to the further readings.
rn Data bus
--
k
- Significandl
Ex onent
enit Mantissa
Unit
t
t I
I
I' I
-
,
,,
,
,,
,
,,
,
,,
L
Peripheral Processor
An example of one such arithmetic processor is the AMD 95 11/12 one chip floating point
processor. The advantage of this processor is that they can be utilised with any CPU, while
the disadvantages are that thcy need explicitly programmed and slow communication links
with the CPU. These processors can be utiliscd as given in the following figure:
Performer Instructions executed Processing details
1) CPU Data-transfer These instructions help in sending a
instructions set input operands and commands, e.g.
arithmetic operations, to the peripheral
processor.
2) Peripheral Decode & Execute Results are generated and placed in
Processor the cornrnar~dreceived registers directly access,( e to the CPU Alu and Control Unit
Orgrnlsatlon
from CPU asing ihc opcrs;:,or;.
-3) CPU Checks status by polling It determines whether the peripheral
a status register or by processor has completed the task.
receiving interrupt from
the peripheral processor.
4) CPU Data transfer instruction is CPU obrains the results from the
executed peripheral processor by executing this
data transrer instruction.
Figure 7 :Communication between the CPU and Peripheral Rucesror
In certain implementations CPLT has to wait for peripheral processor to finish, therefore, I
remains idle for that time.
Coprocessors
Coprocessors, unlike peripheral processors, are tailor made for a parlicular family of CPUs.
Normally, each CPU is designed to have a coprocessor interface. The control signal circuits
of the CPU is designed for the interface beforehand. Special instructions are earmarked for
execution by the coprocessors. These coprocessor instructions can appear in any assembly
or machine language program similar to any other instruction. The CPU hardware takes care
of the instruction execution by the coprocessors. The coprocessor instructions can be
executed even if a coprocessor is not present, by already stored software routines at
pre-determined memory locations. If a coprocessor is not attached, then the CPU issues a
softwarc (coprocessor) trap which executes a desired sortware localion routine for the
instruction, Thus, without changing the source or object code we can execute the
coprocessor instructions by the CPU even if the coprocessor is not present. Figure 8 shows a
general structure, along with some of the conuol lines between the CPU and the coprocessor.
System Bus
Figure 8 :General Structure of CPU-Coprc~essor
As both the processors are directly linked, therefore, they can be synchronised easily. The
control lines between them are few. The data transfer between the processors can take place
through the system bus. The CPU may act as the master of coprocessor. The registers of
coprocessor can be written into or read by the CPU directly as it do for the main memory.
Sometimes it is useful to allow the coprocessor to control the bus as in such cases it can
conuol data transfer from memory or can initiate data transfer to the CPU.
In case coprocessor can control the system bus then it is allowed to decode and identify the
instructions at the same time CPU is doing. The coprocessor then can execute the
instructions meant for it directly. This type of approach is Collowed in 8087 arithmetic
coprocessor of 8086. While in some CPUs, only the CPU can decode the coprocessor
instructions. This is the case for the 68881 floating point coprocessor of Motorola 68000
series. A CPU can employ more than one different coprocessors if desired.
Base + 2
Sign + 1 bit
Exponent + 4 bits. Bias of 8 is used
55
CPU OrynbaUon Significand + 3 bits
Assume the normalised mantissa representation
......................................................................................................................
2. State true or false
(a) A double precision number is used when accuracy requirements are higher.
True False 1
(b) A zero can not be represented in IEEE standard 754 format.
True- False n
(c) On multiplication of floating point numbers, the value of bias need to be subtracted
after adding the two exponents.
True False
(d) The exponent unit of floating point ALU must perform all the four arithmetic
operations.
True False
3. What is an arithmetic processor? Compare the co-processor with peripheral processor.
......................................................................................................................
e!'
Instruction
Register
Various
Flags
of ALU
-
-
Control Signals with in
the CPW for:
h Register to Reg~ster
ALU operation
/
opeation
Master clock
Control Signals to Control
Control Bus Bus
In the model given above the control unit is a black box which has certain inputs and outputs.
The inpurs to the control unit are:
57
The Master Clock Signal: This signal causes micro-operations to be performed. In
a single clock cycle either a single or a set of.simultaneous micro-operations can be
performed. The time taken in performing a single micro-operation is also termed as
processor cycle time in some machines. However, some micro-operations, such as
memory read, may require more than one clock cycle if km / b,,is greater than
one.
The Instruction Register: The operation code (opcode) which normally include
addressing mode bits of the instruction, help in determining the various cycles to be
performed and hence determines the related micro-operations which are needed to
be performed.
Flags: Flags are used by the control unit for determining the status of the CPU.
The outcomes of a previous operation on ALU can also be detected using flags. For
example, a zero flag will help the control unit while executing an instruction 1SZ
(skip the next instruction if zero flag is set). In case the zero flag is s t then control
unit will issue control signals which will cause Program Counter (PC) to be
incremented by 1. In effect skipping the instruction. which CPU was supposed to
execute next.
Control Signals &om Control Bus: Some of the control signals are provided to
the control unit through the control bus. These signals are issued from outside the
CPU. Some of these signals are interrupt signals and acknowledgment signals.
On the basis of the input signals the control unit activates certain output control signals
which in turn are responsible for the execution of an instruction. These output control
signals are:
Control signals which are required within the CPU : These control signals cau&
two types of micro-operahbns, viz. for data uansfer from one register to another,
and for performing an ALU operation using input and output registers.
Control signals to control bus : The basic purpose of these control signals are to.
bring or to transfer data from CPU register to memory or VO modules. These
control signals are issued on the control bus to activate a data path.
Now, let us discuss about the requirements from such a unit. A prime requirement for control
unit is that it must know all the instructions to be executed and also the nature of the results
along with the indication of possible errors. All this is achieved with the help of flags.
op-codes, clock and some control signals to itself.
A control unit contain a clock portion, whose job is to provide clock pulses. This clock
signal of control unit is used for measuring the timing of the micro-operations. In general,
the timing signals from control unit are kept sufficiently long keeping in mind the
propogational delays of signals within the CPU along various data paths. As within the same
instruction cycle, different control signals are generated at different times for performing
different micro-operations, therefore, a counter can be utilised with the clock to keep the
count. However, at the end of each insliuction cycle the counter should be reset to the initial
condition. Thus, the clock to the control unit must provide counted timing signals.
Examples, of the functionality of control units along with timing diagrams are given in the
further readings. We will not discuss about the timing diagrams in this block.
How are these control signals applied to achieve the particular operation? The control
signals are applied directly as the binary inputs to the logic gates of the logic circuits. Do
you remember the Enable input defined in Unit 2 of Block-1 or the select inputs of
multiplexers. All these inputs are the control signals which are applied to select a circuit (in
case of enable) or a path (in case of MUX)or any other operation in the logical circuits.
As one of the responsibilities of the control unit is to keep track on the instruction cycle.
Therefore, the control unit can determine when which micro-operation is to be performed.
Let us discuss this with the help of an example in the following subsection.
Control
Data path Signal
AC -' ALU
AC -' DR
DR -' AC
ALU -' AC
IR -' CU
DR -'IR
PC -' MAR
PC -' DR
DR +PC
MAR-' BUS
DR -' M A R
DR -' BUS
DR + ALU
BUS + DR
IrC
I
I MAR
DR
DR. PC
MAR, DR
System Bus
Program counter is loaded by the address
supplied by DR. however, it can send next
instruction address to MAR; or can send the
current address for storage, through DR in
the case of a subroutine call.
MAR stores the address of the memory unit
Fetch Cycle
Timing Micro-operation Comment Control signals needed
t1 W t PC Memory address c6
register is assigned
the content of Program
Count.er.
Indirect Cycle
Interrupt Cycle
t, DR t PC Store the content c
7
ofFC
l2 MAR t ADDRESS in the memory Control signals for
OF LOCATION at an address specifid preforming these
OF STORING by machine. opeations
REmY
ADDRESS
PC t Address of the
interrupt service
program's first
instruction
(BUS) t DR Save the DR Cll and control signal which
contents enables memory write
But do we have an internal CPU organisation as shown in Figure lo? Such an organisation
will have a large range of data paths hence will be very complex if more registers are there in
the CPU. A simple yet effective solutio.1 in such a case will be to use internal data bus
within CPU. 'I'his type of organisation is used in microprocessors, such as INTEL 8085. The
organisation of the machine which we have shown in Figure 10, if developed with internal
data bus will be very much simplified. This is shown in Figure 11.
Signals
Buffer -
Register
, In the above case, for each register one input and one output line is controlled by a gate and
! is connected to data bus (except for IR where we have only input). The required data
I transfer can be initiated by activating two gates (one output and one input). We have
1 provided two temporary storage with the ALU, otherwise the output of ALU will go back to
its input, as both input and output gates of ALU are open for processing, which is
undesirable.
The advantages of using internal bus arrangements are:
Simple data path interconnections which means easy layout for control
Saving of CPU space as inter-register connection space is minimised. This is very
useful in case of microprocessors.
The next question about the control unit is : How can we implement a control unit such that
it generates the necessary control signals? The control units are implemented using two
general approaches. These are called:
l iardwired Control Unit, and
- -
......................................................................................................................
.......................................................................................................................
......................................................................................................................
3.4 SUMMARY
In this unit, we have discussed about two main components of the CPU, the ALU and the
contml unit. We have explained the concepts of the basic ALU structure, floating point
ALUs and coprocessors. Coprocessors, in today's computers, are used widely and help in
implementing graphical and other computation intensive applications. As far as control unit
is concerned, we have discussed about a simple structure of a control unit along with an
example. More details on these aspects with examples can be seen from the further readings.
In this unit we have also introduced the concept of a hardwired control unit. A
microprogrammed control unit which is more commonly used is the topic of the next unit.