KTU - CST202 - Computer Organization and Architecture
KTU - CST202 - Computer Organization and Architecture
4. The control functions that initiate the sequence of operations: The control functions that
initiate the sequence of operations consists of timing signals that sequence the operations one at a
time.
The most common ways to represent a register are describing below in figure
A a) Register A
b) Showing individual
A8 A7 A6 A5 A4 A3 A2 A1
Cells
12 1
MAR c) Numbering of Cells
16 9 8 1
PC (L) PC (H) d) Portions of Register
The most common way to represent a register is with a rectangular box in which name of
the register is specified within the box. In figure (b) it shows the individual cells of a register
which is marked from right to left. The numbering of cells from right to left can be marked on top
of the box as in the 12 bit register memory Buffer Register (MBR) in (c). A 16 bit register is
partitioned into two parts, one high order part (H) consisting of eight high ordered cells and one
lower order part (L) consisting of eight low ordered cells in (d).
Register transfer language(Computer hardware description language)
Symbolic notation used for registers, for specifying operations on the contents of registers
and specifying control functions . A statement in a register transfer language consists of control
function and a list of microoperations
Micro-Operation: Operations performed in data stored in registers. Elementary operation
that can be performed parallel during one clock pulse period. The result of operation may replace
the previous binary information of a register or may be transfered to another register. Example:
Shift, count, clear, add & load
A micro-operation requires one clock pulse for the execution if the operation done in
parallel In serial computer a microoperation requires a number of clock pulses equal to the word
time in the system.
Types of Binary Informations
Micro operations performed is based on the type of data kept in registers. Type of binary
information in the register can be classified into three categories:
• Numerical data such as binary numbers or binary-coded decimal numbers.
• Non-numerical data such as alphanumeric characters or other binary-coded symbols.
• Instruction codes,addresses and other control information used to specify the data
processing requirements in the system
2
KTU - CST202 - Computer Organization and Architecture Module: 2
A e) Register A
f) Showing individual
A8 A7 A6 A5 A4 A3 A2 A1
Cells
12 1
MAR g) Numbering of Cells
16 9 8 1
PC (L) PC (H) h) Portions of Register
Registers can be specified in a register transfer language with a declaration statement. For
example: Registers in the above figure can be defined with declaration statement such as
DECLARE REGISTER A(8), MBR(12), PC(16)
DECLARE SUBREGISTER PC(L) = PC(1-8), PC(H) = PC(9-16).
Information transfer from one register to another is described by a replacement operator:
A ← B. This statement denotes a transfer of the content of register B into register A and this
transfer happens in one clock cycle. After the operation, the content of the B (source) does not
3
KTU - CST202 - Computer Organization and Architecture Module: 2
change. The content of the A (destination) will be lost and replaced by the new data transferred
from B.
Conditional transfer occurs only under a control condition: Representation of a
(conditional) transfer x’T1: A ← B. A binary condition (x’T1 equals to 0 or 1) determines when
the transfer occurs. In this the content of B is transferred into A only if x is 0 and T1 is 1.
Hardware implementation of a controlled transfer: x’T1: A ← Bis as follows
Destination register receives information from two sources but not at the same time
T1 : C ← A
T2 : C ← B
The connection of two source register
to the same destination register cannot be done
directly, but requires a multiplexer circuit to
select between two possible paths. The block
diagram of the circuits that implements the two
statement is shown in the figure.
4
KTU - CST202 - Computer Organization and Architecture Module: 2
Bus transfer
A typical digital computer has many registers, and paths must be provided to transfer
information from one register to another. The number of wires will be excessive if separate lines
are used between each register and all other registers in the system. A more efficient scheme for
transferring information between registers in a multiple-register configuration is a common bus
system.
A bus structure consists of a set of common lines, one for each bit of a register, through
which binary information is transferred one at a time. Control signals determine which register is
selected by the bus during each particular register transfer.
One way of constructing a common bus system is with multiplexers. The multiplexers
select the source register whose binary information is then placed on the bus.
The diagram shows that the bits in the same significant position in each register are
connected to the data inputs of one multiplexer to form one line of the bus. Thus, MUX 0
multiplexes the four 0 bits of the registers, MUX 1 multiplexes the four 1 bits of the registers, and
similarly for the other two bits.
Memory Transfer
The transfer of information from a memory word to the outside environment is called a
read operation. The transfer of new information to be stored into the memory is called write
operation. A memory word will be symbolized by the letter M.
The read operation is a
transfer from the selected memory
register M into MDR (memory
data register).
Read: MDR←M
5
KTU - CST202 - Computer Organization and Architecture Module: 2
Write operation is the transfer from MDR to the selected memory register M.
Write: M ← MDR
It is necessary to specify the address of M when writing memory transfer operations. This
will be done by enclosing the addressin square brackets following the letter M.
Consider a memory unit that receives
the address from a register, called the address
register, symbolized by AR. The data are
transferred to another register, called the data
register, symbolized by DR. The memory
read operation can be stated as follows:
Read: DR ← M [AR]
This causes a transfer of information
into DR from the memory word M selected
by the address in AR. The memory write
operation transfers the content of a register
R1 to a memory word M selected by the
address in address AR. The notation is:
Write: M [AR] ← R1
The block diagram shows the
memory unit that communicate with multiple
registers
Arithmetic Micro-Operation
The basic arithmetic micro-operations are:
• Addition,
• Subtraction,
• Increment,
• Decrement
• Arithmetic shift.
The increment and decrement micro-operations are implemented with a combinational
circuit or with a binary up-down counter as these micro-operations use plus-one and minus-one
operation respectively.
The arithmetic add microoperations are defined by the statement
F ← A + B.
6
KTU - CST202 - Computer Organization and Architecture Module: 2
It states that the contents of register A are to be added to the contents of register B and the
sum is transfered to register F To implement this statement require 3 registers A, B and F and a
digital functon that performs the addition operation such as parallel addder.
7
KTU - CST202 - Computer Organization and Architecture Module: 2
It specifies a logic micro-operation that consider each pair of bits in the registers as a
binary variable. Let the content of register A is 1010 and the content of register B is 1100. The
exclusive-OR micro-operation stated above symbolizes the following logic computation:
1010 Content of A
1100 Content of B
0110 Content of F ← A ⊕ B
The content of F, after the execution of the micro-operation, is equal to the bit-by-bit
exclusive-OR operation on pairs of bits in B and values of A. The logic micro-operations are
seldom used in scientific computations, but they are very useful for bit manipulation of binary
data and for making logical decisions.
Logic and Shift Micro instructions are
8
KTU - CST202 - Computer Organization and Architecture Module: 2
PROCESSOR ORGANIZATION
The processor part of a computer CPU is sometimes referred to as the data path of the CPU
because the processor forms the paths for the data transfers between the registers in the unit. The
various paths are said to be controlled by means of gates that open the required path and close all
others. A processor unit can be designed to fulfill the requirements of a set of data paths for a
specific application.
In a processor unit, the data paths are formed by means of buses and other common lines.
The control gates that formulate the given path are essentially multiplexers and decoders whose
selection lines specify the required path. The processing of information is done by one common
digital function whose data path can be specified with a set of common selection variables.
Bus Organization
9
KTU - CST202 - Computer Organization and Architecture Module: 2
A bus organization for four processor registers is shown in Figure. Each register is
connected to two multiplexers (MUX) to form input buses A and B. The selection lines of each
multiplexer select one register for the particular bus. The A and B buses are applied to a common
arithmetic logic unit.The function selected in the ALU determines the particular operation that is
to be performed.
The shift micro-
operations are implemented in
the shifter.The result of the
micro-operation goes through the
output bus S into the inputs of all
registers.The destination register
that receives the information
from the output bus is selected by
a decoder.
When enabled, this
decoder activates one of the
register load inputs to provide a
transfer path between the data on
the S bus and the inputs of the
selected destination register. The
output bus S provides the
terminals for transferring data to
an external destination. One
input of multiplexer A or B can
receive data from the outside
The control unit that
supervises the processor bus
system directs the information flow through the ALU by selecting the various components in the
unit.
For example, to perform the microoperation:
R1←R2+ R3
The control must provide binary selection variables to the following selector inputs:
1. MUX A selector: to place the contents of R2 onto bus A.
2. MUX B selector: to place the contents of R3 onto bus B.
3. ALU function selector: to provide the arithmetic operation A + B.
4. Shift selector: for direct transfer from the output of the ALU onto output bus S (no
shift).
5. Decoder destination selector: to transfer the contents of bus S into R 1.
10
KTU - CST202 - Computer Organization and Architecture Module: 2
Scratchpad memory
The register in a processor unit can be enclosed in a small memory unit.When included in
a processor unit,a small memory is sometimecalled a scratchpad memory.The use of a small
memory is a cheaper alternative tocollecting processor registers through a bus system.The
difference between the two system is the manner in which information is selected for transfer into
the ALU. In a bus system, the information
transfer is selected by the multiplexer that
form thebuses.
Processor unit that uses scratchpad
memory is shown in figure. Resource
register is selected from memory and
loaded into register A. A Second source
register is selected from memory and
loaded into register B. The information in
A and B is manipulated in the ALU and
shifter. Result of the operation is
transferred to a memory register
specifying its word address and activating
the memory-write input control.
Assume that the memory has eight
words, so that an address must be specified
with three bits. To perform the operation
R1 ← R2 + R3
The control must provide binary
selection variable to perform the following sequence of micro-operations
T1: A ← M[010] read R2 to register A
T2: B ← M[011] read R3 to register B
T3: M[001] ← A + B perform operation in ALU and transfer result to R1
11
KTU - CST202 - Computer Organization and Architecture Module: 2
Control function T1 must supply an address of 010 to the memory and activate the read
and load A inputs. control function T2
must supply an address 011 to the
memory and activate the read and load B
inputs. Control function T3 must supply
the function code to the ALU and shifter
to perform an add operation, apply an
address 001 to the memory, select the
output of the shifter for the MUX and
activate the memory write input.
Some processor employ a 2 port
memory in order to overcome the delay
caused when reading two source registers.
A 2-port has two separate address lines to select two words of memory simultaneously. The
organization of a processor unit with a 2-port scratchpad memory is shown in figure.
Accumulator Register
An accumulator is a register for short-term, intermediate storage of arithmetic and logic
data in a computer's CPU (central processing unit).The most elementary use for an accumulator
is adding a sequence of numbers. The numerical value in the accumulator increases as each
number is added, exactly as it happens in a simple desktop calculator (but much faster, of course).
Once the sum has been determined, it is written to the main memory or to another register.
The accumulator register in a processor unit is a multipurpose register capable of
performing not only the add micro-operation, but many other operations as well.
The block diagram shows the processor unit that employs an accumulator units.
To form the sum of two numbers stored in processor registers, it is nessesary to add them
in the A register using the following sequence of micro-operations:
T1: A ← 0 Clear A
T2: A ← A + R1 Transfer R1 to A
T3: A ← A + R2 Add R2 to A
12
KTU - CST202 - Computer Organization and Architecture Module: 2
The sum / result formed in A may be used for other computation or may be
transfered to a required destination.
Status Registers
The relative magnitude of two numbers may be determined by subtracting one number
from the other andthen checking certain bit conditions in the resultant difference. This status bit
conditions (often calledcondition-code bits or flag bits) are stored in a status register.
Status register is a 4 bit register. The four bits are C (carry), Z (zero),S (sign) and V
(overflow).These bits are set or cleared as a result of an operation performed in the ALU.
• Bit C is set if the output carry of an ALU is 1.
• Bit S is set to 1 if the highest order bit of the result in the output of the ALU is 1.
• Bit Z is set to 1 if the output of the ALU contains all O's.
• Bit V is set if the exclusive —OR of carries C8 and C9 is 1, and cleared otherwise.
This is the condition for overflow when the numbers are in signed 2's complement
representation. For an 8 bit ALU, V is set if the result is greater than 127 or less
than -128.
After an ALU operation, status bits can be checked to determine the relationship that exist
between thevalues of A and B.
13
KTU - CST202 - Computer Organization and Architecture Module: 2
If bit V is set after the addition two signed numbers, it indicates an overflow condition. If
Z is set after anexclusive OR operation, it indicates that A=B. A single bit in A can be checked to
determine if it is 0 or 1by masking all bits except the bit in question and then checking the Z status
bit.
Relative magnitudes of A and B can be checked by compare operation. If A-B is performed
for twounsigned binary numbers, relative magnitudes of A and B can be determined from the
values transferred tothe C and Z bits. If Z=1,we knows that A=B, since A-B=0. If Z=0, then we
know that A is not equal to B.
Similarly C=1 if A>=B and C=0 if A<B. The following table lists the various conditions
14
KTU - CST202 - Computer Organization and Architecture Module: 2
The design of a typical ALU will be carried out in three stages. First, the design of the
arithmetic section will be undertaken. Second, the design of the logic section will be considered.
Finally, the arithmetic section will be modified so that it can perform both arithmetic and logic
operations.
15
KTU - CST202 - Computer Organization and Architecture Module: 2
From the above Figure, by changing the B input and Cin we get 8 operaton. So the input B
is applied in four different form by using following circuit
S0 S1 Y
0 0 0
0 1 B’1
1 0 B1
1 1 1
The input A is applied directly to the 4-bit parallel adder and the input B is modified. The
resultant arithmetic circuit is shown in below figure.
16
KTU - CST202 - Computer Organization and Architecture Module: 2
The four gate generate four logic operations OR, XOR, AND, and NOT. The two selection
variables in the multiplexer select one of the gates for the output. The function table lists the output
logic generated as a function of the two selection variables.
17
KTU - CST202 - Computer Organization and Architecture Module: 2
The logic circuit can be combined with the arithmetic circuit to produce one arithmetic
logic unit. Selection variables S1 and S0 can be made common to both sections provided we use a
third selection variable, S2, to differentiate between the two. This configuration is illustrated in
the above figure. The outputs of the logic and arithmetic circuits in each stage go through a
multiplexer with selection variable S2.
When S2 = 0, the arithmetic output is selected,
when S2 = 1, the logic output is selected.
Although the two circuits can be combined in this manner, this is not the best way to design
an ALU.A more efficient ALU can be obtained if we investigate the possibility of generating logic
operations in an already available arithmetic circuit. This can be done by inhibiting all input carries
into the full-adder circuits of the parallel adder. Consider the Boolean function that generates the
output sum in a full-adder circuit:
F=X ⊕ Y ⊕ Cin
The input carry Cin in each stage can be made to be equal to 0 when a selection variableS2is
equal to 1. The result would be:
F=X ⊕ Y
This expression is valid because of the property of the X-OR operation: X⊕0 = X
The logic circuit can be combined with the arithmetic circuit to produce one arithmetic
logic unit. Selection variables S1 and S0 can be made common to both sections provided, we are
using a third selection variable S2, to differentiate between the two.
Design steps
1. Design the arithmetic section independent of the logic section.
2. Determine the logic operations obtained from the arithmetic circuit in step 1, assuming
that the input carries to all stages are 0.
3. Modify the arithmetic circuit to obtain the required logic operations.
The third step in the design is not a straightforward procedure and requires a certain
amount of ingenuity on the part of the designer. There is no guarantee that a solution can be found
or that the solution uses the minimum number of gates. The example presented here demonstrates
the type of logical thinking sometimes required in the design of digital systems.
The final ALU is shown in figure below Only the first two stages are drawn, but the
diagram can be easily extended to more stages. The inputs to each full-adder circuit are specified
by the Boolean functions:
Xi = Ai + S2 S1’ S0’Bi + S2 S1 S0’ Bi
18
KTU - CST202 - Computer Organization and Architecture Module: 2
Yi = S0 Bi + S1 Bi’
Zi = S2’ Ci
When S2 = 0, the three functions reduce to:
Xi = Ai
Yi = S0 Bi + S1 Bi’
Zi = Ci
Which are the function for the arithmetic circuit. The logical operations are generated
when S2 = 1. For S2 S1 S0 = 1 0 1 or 1 1 1, the function reduce to:
Xi = Ai Yi = S0 Bi + S1 Bi’ Zi = 0
19
KTU - CST202 - Computer Organization and Architecture Module: 2
The function table for the Arithmetic and Logic Unit is shown below
20
KTU - CST202 - Computer Organization and Architecture Module: 2
The number of clock pulses may reduce if the shifter is implemented with a combinational
circuit. A combinational—logic shifter can be constructed with multiplexers. The above figure
will show the same.
Shifter operation can be selected by two variables H1 H0
• If H1 H0 = 0 0 No shift is executed and the signal from F go directly to S lines
• If H1 H0 = 0 1 Shift Right is executed
• If H1 H0 = 1 0 Shift Left is executed
• If H1 H0 = 1 1 No operations
PROCESSOR UNIT
21
KTU - CST202 - Computer Organization and Architecture Module: 2
Input data from an external source are also selected by the same multiplexers. The output
of the ALU goes through a shifter and then to a set of external output terminals.
The functions of all selection variables are specified in table below.
The 3-bit binary code listed in the table specifies the code for each of the five fields A, B,
D, input data, F, and H. The register selected by A, B, and D is the one whose decimal number is
equivalent to the binary number in the code. When the A or B field is 000, the corresponding
multiplexer selects the input data. When D = 000, no destination register is selected.
The three bits in the F field, together with the input carry Cin, provide the 12 operations of
the ALU as specified in above table. Note that there are two possibilities for F = A. In one case
the carry bit C is cleared, and in the other case it is set to 1.
DESIGN OF ACCUMULATOR
Some processor units distinguish one register from all others and call it an accumulator
register. The block diagram of an accumulator that forms a sequential circuit is shown in figure
below.
22
KTU - CST202 - Computer Organization and Architecture Module: 2
The A register and the associated combinational circuit constitutes a sequential circuit.
The combinational circuit replaces the ALU but cannot be separated from the register, since it is
only the combinational-circuit part of a sequential circuit. The A register is referred to as the
accumulator register and is sometimes denoted by the symbol AC. Here, accumulator refers to
both the A register and its associated combinational circuit.
The external inputs to the accumulator are the data inputs from B and the control variables
that determine the micro operations for the register. The next state of register A is a function of
its present state and of the external inputs.
Accumulator can also perform data processing operations. Total of nine operations is
considered here for the design of accumulator circuit.
In all listed microoperations A is the source register. B register is used as the second source
register. The destination register is also accumulator register itself. For a complete accumulator
there will be n stages.
23
KTU - CST202 - Computer Organization and Architecture Module: 2
The inputs and outputs of each stage can be connected in cascade to form a complete
accumulator. Here we are discussing the design of a 4 bit accumulator. The number on top of each
block represents the bit position.
All blocks receive 8 control variables P1 to P8 and the clock pulses from CP. The other six
inputs and four outputs are same as with the typical stage. The zero detect chain is obtained by
connecting the z variables in cascade, with the first block receiving a binary constant I . The last
stage produces the zero detect variable Z.
Total number of terminals in the 4 bit accumulator is 25, including terminals for the A
outputs. Incorporating two more terminals for power supply, the circuit can be enclosed within
one IC package having 27 or 28 pins.
The number of terminals for the control variable can be reduced from 9 to 4 if a decoder
is inserted in the IC. In such cases, IC pin count is also reduced to 22 and the accumulator can be
extended to 16 microoperations without adding external pins (That is, with 4 bits we can identify
16 operations).
24