Coa - Notes - Module 2
Coa - Notes - Module 2
BASIC DEFINITIONS:
The symbolic notation used to describe the micro-operation transfer among registers is called RTL
(Register Transfer Language).
The use of symbols instead of a narrative explanation provides an organized and concise manner
for listing the micro-operation sequences in registers and the control functions that initiate them.
A register transfer language is a system for expressing in symbolic form the microoperation sequences among
the registers of a digital module.
It is a convenient tool for describing the internal organization of digital computers in concise and
precise manner.
Registers:
Computer registers are designated by upper case letters (and optionally followed by digits or
letters) to denote the function of the register.
For example, the register that holds an address for the memory unit is usually called a memory
address register and is designated by the name MAR.
Other designations for registers are PC (for program counter), IR (for instruction register, and R1
(for processor register).
The individual flip-flops in an n-bit register are numbered in sequence from 0 through n-1, starting
from 0 in the rightmost position and increasing the numbers toward the left.
Figure 4-1 shows the representation of registers in block diagram form.
The most common way to represent a register is by a rectangular box with the name of the
register inside, as in Fig. 4-1(a).
The individual bits can be distinguished as in (b).
The numbering of bits in a 16-bit register can be marked on top of the box as shown in (c).
16-bit register is partitioned into two parts in (d). Bits 0 through 7 are assigned the symbol L (for
low byte) and bits 8 through 15 are assigned the symbol H (for high byte).
The name of the 16-bit register is PC. The symbol PC (0-7) or PC (L) refers to the low-order
byte and PC (8-15) or PC (H) to the high-order byte.
Register Transfer:
Information transfer from one register to another is designated in symbolic form by means of a
replacement operator.
The statement R2← R1 denotes a transfer of the content of register R1 into register R2.
It designates a replacement of the content of R2 by the content of R1.
By definition, the content of the source register R 1 does not change after the transfer.
If we want the transfer to occur only under a predetermined control condition then it can be
shown by an if-then statement.
if (P=1) then R2← R1
P may go back to 0 at time t+1; otherwise, the transfer will occur with every clock pulse transition
while P remains active.
Even though the control condition such as P becomes active just after time t, the actual transfer
does not occur until the register is triggered by the next positive transition of the clock at time
t +1.
The basic symbols of the register transfer notation are listed in below table
A comma is used to separate two or more operations that are executed at the same time.
The statement
T : R2← R1, R1← R2 (exchange operation)
denotes an operation that exchanges the contents of two rgisters during one common clock pulse
provided that T=1.
The multiplexers select the source register whose binary information is then placed
on the bus.
The construction of a bus system for four registers is shown in below Figure.
The bus consists of four 4 x 1 multiplexers each having four data inputs, 0 through 3, and two
selection inputs, S1 and S0.
For example, output 1 of register A is connected to input 0 of MUX 1 because this input is labelled
A1.
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.
The two selection lines Si and So are connected to the selection inputs of all four multiplexers.
The selection lines choose the four bits of one register and transfer them into the four-line
common bus.
When S1S0 = 00, the 0 data inputs of all four multiplexers are selected and applied to the outputs
that form the bus.
This causes the bus lines to receive the content of register A since the outputs of this register are
connected to the 0 data inputs of the multiplexers.
Similarly, register B is selected if S1S0 = 01, and so on.
Table 4-2 shows the register that is selected by the bus for each of the four possible binary value
of the selection lines.
R1← C
Three-State Bus Buffers:
It is distinguished from a normal buffer by having both a normal input and a control input.
The control input determines the output state. When the control input is equal to 1, the output is
enabled and the gate behaves like any conventional buffer, with the output equal to the normal
input.
When the control input is 0, the output is disabled and the gate goes to a high-impedance state,
regardless of the value in the normal input.
The construction of a bus system with three-state buffers is shown in Fig. 4
The outputs of four buffers are connected together to form a single bus line.
The control inputs to the buffers determine which of the four normal inputs will communicate with
the bus line.
No more than one buffer may be in the active state at any given time. The connected buffers must
be controlled so that only one three-state buffer has access to the bus line while all other buffers
are maintained in a high impedance state.
One way to ensure that no more than one control input is active at any given time is to use a
decoder, as shown in the diagram.
When the enable input of the decoder is 0, all of its four outputs are 0, and the bus line is in a
high-impedance state because all four buffers are disabled.
When the enable input is active, one of the three-state buffers will be active, depending on the
binary value in the select inputs of the decoder.
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 a write operation.
A memory word will be symbolized by the letter M.
The particular memory word among the many available is selected by the memory address during
the transfer.
It is necessary to specify the address of M when writing memory transfer operations.
This will be done by enclosing the address in 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 read operation can be stated as follows:
This causes a transfer of information into DR from the memory word M selected by the address in
AR.
The write operation transfers the content of a data register to a memory word M selected by the
address. Assume that the input data are in register R1 and the address is in AR.
The write operation can be stated as follows:
Write: M [AR] <- R1
Types of Micro-operations:
Register Transfer Micro-operations: Transfer binary information from one register to another.
Arithmetic Micro-operations: Perform arithmetic operation on numeric data stored in registers.
Logical Micro-operations: Perform bit manipulation operations on data stored in registers.
Shift Micro-operations: Perform shift operations on data stored in registers.
Register Transfer Micro-operation doesn’t change the information content when the binary
information moves from source register to destination register.
Other three types of micro-operations change the information change the information content
during the transfer.
Arithmetic Micro-operations:
R3 ← R1 + R2 + 1
instead of minus operator, we can write as
R2 is the symbol for the 1’s complement of R2
Adding 1 to 1’s complement produces 2’s complement
Adding the contents of R1 to the 2's complement of R2 is equivalent to R1-R2.
Binary Adder:
Digital circuit that forms the arithmetic sum of 2 bits and the previous carry is called FULL
ADDER.
Digital circuit that generates the arithmetic sum of 2 binary numbers of any lengths is called
BINARY ADDER.
Figure 4-6 shows the interconnections of four full-adders (FA) to provide a 4-bit binary adder.
The augends bits of A and the addend bits of B are designated by subscript numbers from
right to left, with subscript 0 denoting the low-order bit.
The carries are connected in a chain through the full-adders. The input carry to the
binary adder is Co and the output carry is C4. The S outputs of the full-adders generate
the required sum bits.
An n-bit binary adder requires n full-adders.
The addition and subtraction operations can be combined into one common circuit by including an
exclusive-OR gate with each full-adder.
A 4-bit adder-subtractor circuit is shown in Fig. 4-7.
The mode input M controls the operation. When M = 0 the circuit is an adder and when M = 1 the
circuit becomes a subtractor.
Each exclusive-OR gate receives input M and one of the inputs of B
When M = 0, we have B xor 0 = B. The full-adders receive the value of B, the input carry is 0,
and the circuit performs A plus B.
When M = 1, we have B xor 1 = B' and Co = 1.
The B inputs are all complemented and a 1 is added through the input carry.
The circuit performs the operation A plus the 2's complement of B.
Binary Incrementer:
One of the inputs to the least significant half-adder (HA) is connected to logic-1 and the other
input is connected to the least significant bit of the number to be incremented.
The output carry from one half-adder is connected to one of the inputs of the next-higher-order
half-adder.
The circuit receives the four bits from A0 through A3, adds one to it, and generates the
incremented output in S0 through S3.
The output carry C4 will be 1 only after incrementing binary 1111. This also causes outputs S0
through S3 to go to 0.
The circuit of Fig. 4-8 can be extended to an n -bit binary incrementer by extending the diagram to
include n half-adders.
The least significant bit must have one input connected to logic-1. The other inputs receive the
number to be incremented or the carry from the previous stage.
Arithmetic Circuit:
Addition:
When S1S0= 00, the value of B is applied to the Y inputs of the adder.
If Cir, = 0, the output D =A+B.
If Cin = 1, output D=A+B + 1.
Both cases perform the add microoperation with or without adding the input carry.
Subtraction:
When S1S0 = 01, the complement of B is applied to the Y inputs of the adder.
When S1S0 = 10, the inputs from B are neglected, and instead, all 0's are inserted into the Y inputs.
The output becomes D = A + 0 + Cin. This gives D = A when Cin = 0 and D = A + 1 when Cin = 1.
In the first case we have a direct transfer from input A to output D.
In the second case, the value of A is incremented by 1.
Decrement:
When S1S0= 11, all l's are inserted into the Y inputs of the adder to produce the decrement
operation D = A -1 when Cin = 0.
This is because a number with all 1's is equal to the 2's complement of 1 (the 2's complement of
binary 0001 is 1111). Adding a number A to the 2's complement of 1 produces F = A + 2's
complement of 1 = A — 1. When Cin = 1, then D = A -1 + 1=A, which causes a direct transfer
from input A to output D.
Logic Micro-operations:
Logic microoperations specify binary operations for strings of bits stored in registers.
These operations consider each bit of the register separately and treat them as binary variables.
For example, the exclusive-OR microoperation with the contents of two registers RI and R2 is
symbolized by the statement
It specifies a logic microoperation to be executed on the individual bits of the registers provided
that the control variable P = 1.
There are 16 different logic operations that can be performed with two binary variables.
They can be determined from all possible truth tables obtained with two binary variables as
shown in Table 4-5.
The 16 Boolean functions of two variables x and y are expressed in algebraic form in the first
column of Table 4-6.
The 16 logic microoperations are derived from these functions by replacing variable x by the
binary content of register A and variable y by the binary content of register B.
The logic micro-operations listed in the second column represent a relationship between the
binary content of two registers A and B.
Hardware Implementation:
The hardware implementation of logic microoperations requires that logic gates be inserted for
each bit or pair of bits in the registers to perform the required logic function.
Although there are 16 logic microoperations, most computers use only four--AND, OR,
XOR (exclusive-OR), and complement from which all others can be derived.
Figure 4-10 shows one stage of a circuit that generates the four basic logic microoperations.
It consists of four gates and a multiplexer. Each of the four logic operations is generated through a
gate that performs the required logic.
The outputs of the gates are applied to the data inputs of the multiplexer. The two selection inputs
S1 and S0 choose one of the data inputs of the multiplexer and direct its value to the output.
Some Applications:
Logic micro-operations are very useful for manipulating individual bits or a portion of a word
stored in a register.
They can be used to change bit values, delete a group of bits or insert new bits values into a register.
The following example shows how the bits of one register (designated by A) are manipulated
by logic microoperations as a function of the bits of another register (designated by B).
Selective set
The selective-set operation sets to 1 the bits in register A where there are
corresponding l's in register B. It does not affect bit positions that have 0's in B. The
following numerical example clarifies this operation:
Selective complement
The selective-complement operation complements bits in A where there are corresponding
1's in B. It does not affect bit positions that have 0's in B. For example:
Insert
The insert operation inserts a new value into a group of bits. This is done by first masking
the bits and then ORing them with the required value.
For example, suppose that an A register contains eight bits, 0110 1010. To replace the four
leftmost bits by the value 1001 we first mask the four unwanted bits:
Clear
The clear operation compares the words in A and B and produces an all 0's result if the two
numbers are equal. This operation is achieved by an exclusive-OR microoperation as shown
by the following example
Shift Microoperations:
Logical Shift:
o A logical shift is one that transfers 0 through the serial input.
o The symbols shl and shr for logical shift-left and shift-right microoperations.
o The microoperations that specify a 1-bit shift to the left of the content of register R and a
1-bit shift to the right of the content of register R shown in table 4.7.
o The bit transferred to the end position through the serial input is assumed to be 0 during a
logical shift.
Circular Shift:
o The circular shift (also known as a rotate operation) circulates the bits of the register
around the two ends without loss of information.
o This is accomplished by connecting the serial output of the shift register to its serial input.
o We will use the symbols cil and cir for the circular shift left and right, respectively.
Arithmetic Shift:
o An arithmetic shift is a microoperation that shifts a signed binary number to the left or
right.
o An arithmetic shift-left multiplies a signed binary number by 2.
o An arithmetic shift-right divides the number by 2.
o Arithmetic shifts must leave the sign bit unchanged because the sign of the number
remains the same when it is multiplied or divided by 2.
Hardware Implementation:
A combinational circuit shifter can be constructed with multiplexers as shown in Fig. 4-12.
The 4-bit shifter has four data inputs, A0 through A3, and four data outputs, H0 through H3.
There are two serial inputs, one for shift left (IL) and the other for shift right (IR).
When the selection input S=0 the input data are shifted right (down in the diagram).
When S = 1, the input data are shifted left (up in the diagram).
The function table in Fig. 4-12 shows which input goes to each output after the shift.
A shifter with n data inputs and outputs requires n multiplexers.
The two serial inputs can be controlled by another multiplexer to provide the three possible types
of shifts.
Arithmetic Logic Shift Unit:
Instead of having individual registers performing the microoperations directly, computer systems
employ a number of storage registers connected to a common operational unit called an arithmetic
logic unit, abbreviated ALU.
The ALU is a combinational circuit so that the entire register transfer operation from the
source registers through the ALU and into the destination register can be performed during one clock
pulse period.
The shift microoperations are often performed in a separate unit, but sometimes the shift unit is
made part of the overall ALU.
The arithmetic, logic, and shift circuits introduced in previous sections can be combined into one
ALU with common selection variables. One stage of an arithmetic logic shift unit is shown in Fig.
4- 13.
Particular microoperation is selected with inputs S1 and S0. A 4 x 1 multiplexer at the output
chooses between an arithmetic output in Di and a logic output in Ei.
The data in the multiplexer are selected with inputs S3 and S2. The other two data inputs to the
multiplexer receive inputs Ai-1 for the shift-right operation and Ai+1 for the shift-left operation.
The circuit whose one stage is specified in Fig. 4-13 provides eight arithmetic operation, four logic
operations, and two shift operations.
Each operation is selected with the five variables S3, S2, S1, S0 and Cin.
The input carry Cin is used for selecting an arithmetic operation only.
Table 4-8 lists the 14 operations of the ALU. The first eight are arithmetic operations
and are selected with S3S2 = 00.
The next four are logic and are selected with S3S2 = 01.
The input carry has no effect during the logic operations and is marked with don't-care x’s.
The last two operations are shift operations and are selected with S3S2= 10 and 11.
The other three selection inputs have no effect on the shift.
MICRO PROGRAMMED CONTROL:
Control Memory:
Addressing words stored in control memory is via the address select logic for each of the
register groups. There can be up to five register groups in control memory. These groups select a
register for fetching data for programmed CPU operation or for maintenance console or equivalent
display or storage of data via maintenance console or equivalent. During programmed CPU
operations, these registers are accessed directly by the CPU logic. Data routing circuits are used by
control memory to interconnect the registers used in control memory. Some of the registers
contained in a control memory that operate in the task and the executive modes include the
following: Accumulators Indexes Monitor clock status indicating registers Interrupt data registers
• The control memory address register specifies the address of the microinstruction
• The control data register holds the microinstruction read from memory
• The microinstruction contains a control word that specifies one or more micro operations for the
data processor
• The location for the next micro instruction may, or may not be the next in sequence
• Some bits of the present micro instruction control the generation of the address of the next micro
instruction
• The next address may also be a function of external input conditions
• While the micro operations are being executed, the next address is computed in the next address
generator circuit (sequencer) and then transferred into the CAR to read the next micro instructions
Addressing Sequencing:
Each machine instruction is executed through the application of a sequence of
microinstructions. Clearly, we must be able to sequence these; the collection of microinstructions
which implements a particular machine instruction is called a routine.
The MCU typically determines the address of the first microinstruction which implements a
machine instruction based on that instruction's opcode. Upon machine power- up, the CAR should
contain the address of the first microinstruction to be executed.
The MCU must be able to execute microinstructions sequentially (e.g., within routines), but must also
be able to ``branch'' to other microinstructions as required; hence, the need for a sequencer.
The microinstructions executed in sequence can be found sequentially in the CM, or can be
found by branching to another location within the CM. Sequential retrieval of microinstructions can
be done by simply incrementing the current CAR contents; branching requires determining the
desired CW address, and loading that into the CAR.
CAR
Control Address Register
control ROM
control memory (CM); holds CWs
opcode
opcode field from machine instruction
mapping logic
hardware which maps opcode into microinstruction address
branch logic
determines how the next CAR value will be determined from all the various possibilities
multiplexors
implements choice of branch logic for next CAR value
incrementer
generates CAR + 1 as a possible next CAR value
SBR
used to hold return address for subroutine-call branch operations
Conditional branches are necessary in the micro program. We must be able to perform some
sequences of micro-ops only when certain situations or conditions exist (e.g., for conditional
branching at the machine instruction level); to implement these, we need to be able to conditional
execute or avoid certain microinstructions within routines.
Subroutine branches are helpful to have at the micro program level. Many routines contain
identical sequences of microinstructions; putting them into subroutines allows those routines to be
shorter, thus saving memory. Mapping of opcodes to microinstruction addresses can be done very
simply. When the CM is designed, a ``required'' length is determine for the machine instruction
routines (i.e., the length of the longest one). This is rounded up to the next power of 2, yielding a
value k such that 2 k microinstructions will be sufficient to implement any routine.
The first instruction of each routine will be located in the CM at multiples of this
``required'' length. Say this is N. The first routine is at 0; the next, at N; the next, at 2*N; etc. This can
be accomplished very easily. For instance, with a four-bit opcode and routine length of four
microinstructions, k is two; generate the microinstruction address by appending two zero bits to the
opcode:
Alternately, the n-bit opcode value can be used as the ``address'' input of a 2n x M ROM; the contents
of the selected ``word'' in the ROM will be the desired M-bit CAR address for the beginning of the
routine implementing that instruction. (This technique allows for variable- length routines in the
CM.) >pp We choose between all the possible ways of generating CAR values by feeding them all
into a multiplexor bank, and implementing special branch logic which will determine how the
muxes will pass on the next address to the CAR.
As there are four possible ways of determining the next address, the multiplexor bank is
made up of N 4x1 muxes, where N is the number of bits in the address of a CW. The branch logic
is used to determine which of the four possible ``next address'' values is to be passed on to the
CAR; its two output lines are the select inputs for the muxes.
MICRO PROGRAM EXAMPLE
The micro operations are subdivided into three fields of three bits each.
The three bits in each field are encoded to specify seven distinct micro operations
The CD (condition) field consists of two bits which are encoded to specify four status bit
conditions
The BR (branch) field consists of two bits. It is used, in conjunction with the address field AD
The micro operations are subdivided into three fields of threebits each.
The three bits in each field are encoded to specify seven distinct micro operations
The CD (condition) field consists of two bits which are encoded to specify four status bit
conditions
The BR (branch) field consists of two bits. It is used, in conjunction with the address field AD
2. The microoperations field consists of one, two, or three symbols, separated by commas, . There
may be no more than one symbol from each F field. The NOP symbol is used when the
microinstruction has no micro operations. This will be translated by the assembler to nine zeros.
On the other hand, a micro-programmed control unit is a control unit that uses a microcode to execute instructions.
Implementing, modifying, and decoding micro-programmed control units is very easy. The micro-programmed control
unit is also able to handle complex instructions.
With the help of control signals generated by microprogrammed and hardwired CUs, we are able to fetch
and execute the instructions
THE MEMORY SYSTEM: Basic concepts, semiconductor RAM types of read ‐ only memory (ROM), cache
memory, performance considerations, virtual memory, secondary storage, raid, direct memory access (DMA).
Book: Carl Hamacher, Zvonks Vranesic, SafeaZaky (2002), Computer Organization, 5th edition, McGraw Hill:
Unit-5 Pages: 292-366