Unit - 1 1. Bus Construction Techniques 2. ALU
Unit - 1 1. Bus Construction Techniques 2. ALU
4. Instruction cycle
A program residing in the memory unit of the computer consists of a sequence
of instructions. ➢ Upon the completion of step 4, the control goes back to step 1
to fetch, decode, and execute the next instruction.
The program is executed in the computer by going through a cycle for each
instruction.
In the basic computer each instruction cycle consists of the following phases:
1. Fetch an instruction from memory.
2. Decode the instruction.
3. Read the effective address from memory if the instruction has
an indirect address.
4. Execute the instruction.
Each instruction cycle in turn is subdivided into a sequence of sub cycles or
phases.
The timing for all registers in the basic computer is controlled by a master clock
generator.
The clock pulses are applied to all flip-flops and registers in the system,
including the flip-flops and registers in the control unit.
The clock pulses do not change the state of a register unless the register is
enabled by a control signal.
The control signals are generated in the control unit and provide control inputs
for the multiplexers in the common bus, control inputs in processor registers,
6. Instruction codes
The organization of the computer is defined by its internal registers, the timing and control
structure, and the set of instructions that it uses.
Internal organization of a computer is defined by the sequence of micro-operations it performs on
data stored in its registers.
Computer can be instructed about the specific sequence of operations it must perform.
User controls this process by means of a Program.
Program: set of instructions that specify the operations, operands, and the sequence by which
processing has to occur.
Instruction: a binary code that specifies a sequence of micro-operations for the computer.
The computer reads each instruction from memory and places it in a control register. The control
then interprets the binary code of the instruction and proceeds to execute it by issuing a sequence
of micro-operations. – Instruction Cycle
Instruction Code: group of bits that instruct the computer to perform specific operation.
Instruction code is usually divided into two parts: Opcode and address(operand)
Operation Code (opcode):
✓ group of bits that define the operation
✓ Eg: add, subtract, multiply, shift, complement.
✓ No. of bits required for opcode depends on no. of operations available in computer.
✓ n bit opcode >= 2n (or less) operations
Address (operand):
✓ specifies the location of operands (registers or memory words)
✓ Memory words are specified by their address
✓ Registers are specified by their k-bit binary code
✓ k-bit address >= 2k registers
7. Input - Output
Input-Output and Interrupt:
Instructions and data stored in memory must come from some input device.
Computational results must be transmitted to the user through some output
device.
To demonstrate the most basic requirements for input and output
communication, we will use as an illustration a terminal unit with a keyboard
and printer.
Input-Output Configuration:
Unit – 2
1. Addressing modes *****
The operation field of an instruction specifies the operation to be performed.
This operation will be executed on some data which is stored in computer
registers or the main memory.
The way any operand is selected during the program execution is dependent on
Disadvantages
1. Very limited address space
2. Using multiple registers helps performance but it complicates the
instructions.
Register Indirect Mode:
In this mode, the instruction specifies the register whose contents give us the
address of operand which is in memory. Thus, the register contains the address of
operand rather than the operand itself.
2. Address sequencer
Address Sequencing:
Microinstructions are stored in control memory in groups, with each group
specifying a routine.
To appreciate the address sequencing in a micro-program control unit, let us
specify the steps that the control must undergo during the execution of a single
computer instruction.
Step-1:
An initial address is loaded into the control address register when power is
turned on in the computer.
This address is usually the address of the first microinstruction that activates the
instruction fetch routine.
The fetch routine may be sequenced by incrementing the control address register
through the rest of its microinstructions.
At the end of the fetch routine, the instruction is in the instruction register of the
computer.
Step-2:
The control memory next must go through the routine that determines the
effective address of the operand.
A machine instruction may have bits that specify various addressing modes,
such as indirect address and index registers.
The effective address computation routine in control memory can be reached
through a branch microinstruction, which is conditioned on the status of the
mode bits of the instruction.
When the effective address computation routine is completed, the address of the
operand is available in the memory address register.
Step-3:
The next step is to generate the microoperations that execute the instruction
fetched from memory.
The microoperation steps to be generated in processor registers depend on the
operation code part of the instruction.
Each instruction has its own micro-program routine stored in a given location of
control memory.
The transformation from the instruction code bits to an address in control
memory where the routine is located is referred to as a mapping process.
A mapping procedure is a rule that transforms the instruction code into a control
memory address.
Step-4:
Once the required routine is reached, the microinstructions that execute the
instruction may be sequenced by incrementing the control address register.
Micro-programs that employ subroutines will require an external register for
storing the return address.
Return addresses cannot be stored in ROM because the unit has no writing
capability.
When the execution of the instruction is completed, control must return to the
fetch routine.
This is accomplished by executing an unconditional branch microinstruction to
the first address of the fetch routine.
the address sequencing capabilities required in a control memory are:
1. Incrementing of the control address register.
2. Unconditional branch or conditional branch, depending on status bit
conditions.
3. A mapping process from the bits of the instruction to an address for control
memory.
4. A facility for subroutine call and return.
block diagram of a control memory and the associated hardware needed for
selecting the next microinstruction address.
The microinstruction in control memory contains a set of bits to initiate
microoperations in computer registers and other bits to specify the method by
which the next address is obtained.
The diagram shows four different paths from which the control address register
(CAR) receives the address.
Data transfer instructions move data from one place in the computer to another
without changing the data content.
➢ The most common transfers are between memory and processor registers,
between processor registers and input or output, and between the processor
registers themselves.
➢ The load instruction has been used mostly to designate a transfer from
memory to a processor register, usually an accumulator.
➢ The store instruction designates a transfer from a processor register into
memory.
➢ The move instruction has been used in computers with multiple CPU
registers to designate a transfer from one register to another. It has also been
used for data transfers between CPU registers and memory or between two
memory words.
➢ The exchange instruction swaps information between two registers or a
register and a memory word.
➢ The input and output instructions transfer data among processor registers and
input or output terminals.
Unit – 3
1. Booth multiplication algorithm
Booth algorithm gives a procedure for multiplying binary integers in signed- 2’s
complement representation.
It operates on the fact that strings of 0’s in the multiplier require no addition but
just shifting, and a string of 1’s in the multiplier from bit weight 2k to weight
2m can be treated as 2k+1 – 2m.
For example, the binary number 001110 (+14) has a string 1’s from 23 to 21
(k=3, m=1). The number can be represented as 2k+1 – 2m. = 24 – 21 = 16 – 2 =
14. Therefore, the multiplication M X 14, where M is the multiplicand and 14
the multiplier, can be done as M X 24 – M X 21.
Thus the product can be obtained by shifting the binary multiplicand M four
times to the left and subtracting M shifted left once.
The multiplicand is subtracted from the partial product upon encountering the first
least significant 1 in a string of 1’s in the multiplier.
2. The multiplicand is added to the partial product upon encountering the first 0 in a
string of 0’s in the multiplier.
3. Thepartial product does not change when multiplier bit is identical to the
previous multiplier bit.
.53725 x 103
o A floating-point number is said to be normalized if the most significant digit of
the mantissa in nonzero.
o So the mantissa contains the maximum possible number of significant
digits.
o Assuming fraction representation for the mantissa and taking the two sign
bits into consideration, the range of numbers that can be represented is
+ (1 – 2-35) x 22047
o This number is derived from a fraction that contains 35 1’s, an exponent
of 11 bits (excluding its sign), and because 211–1 = 2047.
o The largest number that can be accommodated is approximately 10615.
o The mantissa that can accommodated is 35 bits (excluding the sign) and if
considered as an integer it can store a number as large as (235 –1).
o This is approximately equal to 1010, which is equivalent to a decimal
number of 10 digits.
o Computers with shorter word lengths use two or more words to represent
a floating-point number.
o An 8-bit microcomputer uses four words to represent one floating-point
number. One word of 8 bits are reserved for the exponent and the 24 bits
of the other three words are used in the mantissa.
o Arithmetic operations with floating-point numbers are more complicated
than with fixed-point numbers.
o Their execution also takes longer time and requires more complex
hardware.
o Adding or subtracting two numbers requires first an alignment of the
radix point since the exponent parts must be made equal before adding or
subtracting the mantissas.
o We do this alignment by shifting one mantissa while its exponent is
adjusted until it becomes equal to the other exponent.
o Consider the sum of the following floating-point numbers:
.5372400 x 102
+ .1580000 x 10-1
o Floating-point multiplication and division need not do an alignment of the
mantissas.
o Multiplying the two mantissas and adding the exponents can form the
product.
o Dividing the mantissas and subtracting the exponents perform division.
o The operations done with the mantissas are the same as in fixed-point
numbers, so the two can share the same registers and circuits.
o The operations performed with the exponents are compared and
incremented (for aligning the mantissas), added and subtracted (for
multiplication) and division), and decremented (to normalize the result).
o We can represent the exponent in any one of the three representations -
signed-magnitude, signed 2’s complement or signed 1’s complement.
o Biased exponents have the advantage that they contain only positive
numbers.
o Now it becomes simpler to compare their relative magnitude without
bothering about their signs.
o The number in the mantissa will be taken as a fraction, so they binary point
is assumed to reside to the left of the magnitude part.
Unit – 4
1. DMA
Removing the CPU from the path and letting the peripheral device manage the
memory buses directly would improve the speed of transfer.
This technique is known as DMA.
In this, the interface transfer data to and from the memory through memory bus.
A DMA controller manages to transfer data between peripherals and memory
unit.
Many hardware systems use DMA such as disk drive controllers, graphic cards,
network cards and sound cards etc.
It is also used for intra chip data transfer in multicore processors.
In DMA, CPU would initiate the transfer, do other operations while the transfer
is in progress and receive an interrupt from the DMA controller when the
transfer has been completed.
2. Cache memory mapping techniques
Cache Memory:
The data or contents of the main memory that are used again and again by CPU,
are stored in the cache memory so that we can easily access that data in shorter
time.
Whenever the CPU needs to access memory, it first checks the cache memory.
If the data is not found in cache memory then the CPU moves onto the main
memory.
It also transfers block of recent data into the cache and keeps on deleting the old
data in cache to accomodate the new one.
Hit Ratio:
The performance of cache memory is measured in terms of a quantity called hit
ratio.
When the CPU refers to memory and finds the word in cache it is said to
produce a hit.
If the word is not found in cache, it is in main memory then it counts as a miss.
The ratio of the number of hits to the total CPU references to memory is called
hit ratio.
3. Associate memory
Associative Memory: Content Addressable Memory (CAM).
The time required to find an item stored in memory can be reduced
considerably if stored data can be identified for access by the content of the
data itself rather than by an address.
A memory unit accessed by content is called an associative memory or
content addressable memory (CAM).
This type of memory is accessed simultaneously and in parallel on the basis
of data content rather than by specific address or location.
It consists of a memory array and logic form words with n bits per word.
The argument register A and key register K each have n bits, one for each bit
of a word. The match register M has m bits, one for each memory word.
Each word in memory is compared in parallel with the content of the
argument register.
The words that match the bits of the argument register set a corresponding bit
in the match register.
After the matching process, those bits in the match register that have been set
indicate the fact that their corresponding words have been matched.
Reading is accomplished by a sequential access to memory for those words
whose corresponding bits in the match register have been set.
Characteristic of RISC:
1. Simpler instruction, hence simple instruction decoding.
2. Instruction come under size of one word.
3. Instruction take single clock cycle to get executed.
4. More number of general purpose register.
5. Simple Addressing Modes.
6. Less Data types.
7. Pipeling can be achieved.
CISC Processors: -
If the control unit contains a number of micro electronic circuitry to
generate a set of control signals and each micro circuitry is activated by
a microcode, this design approach is called CISC design.
This is a software approach of designing a control unit of the processor.
Characteristic of CISC:
1. Complex instruction, hence complex instruction decoding.
2. Instruction are larger than one word size.
3. Instruction may take more than single clock cycle to get executed.
4. Less number of general purpose register as operation get performed in memory
itself.
5. Complex Addressing Modes.
6. More Data types.
a o = A x 2a
o = B x 2b
A and B are two fractions that represent the mantissas
a and b are the exponents
Four segments are used to perform the following:
3. Instruction pipeline
An instruction pipeline reads consecutive instructions from
memory while previous instructions are being executed in other
segments
This causes the instruction fetch and execute phases to overlap
and perform simultaneous operations
The pipeline may not perform at its maximum rate due to:
Reasons for the pipeline to deviate from its normal operation are:
It is assumed that the processor has separate instruction and data memories
Reasons for the pipeline to deviate from its normal operation are:
6. Cache coherence