




























































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





























































































Register Transfer Language Bus and Memory Management Micro-operations Shift Micro-operations
UNIT 2 BASIC COMPUTER ORGANISATION & DESIGN 11
Instruction and Instruction Code Computer Instructions Timing and Control Instruction Cycle Memory Reference Instructions Input/Output and Interrupts Complete Computer Desecration Machine Language
Assembly Language
The Assembler
Program Loops
Programming Arithmetic & Logic
Subroutines
Inputs/Outputs Programming
Microprogrammed Control
Control Memory
Address Sequencing
Microprogram Example
Design Control Unit
UNIT 3 CENTRAL PROCESSING UNIT 65
Central Processing Unit General Register Organization Stack Organization Instruction Formats Addressing Modes Data Transfer and Manipulation
Program Control Reduced Instruction Set Computer Pipeline & Vector Processing Parallel Processing Pipelining Arithmetic Pipeline RISC Pipeline Vector Processing Arrays Processors
UNIT 4 COMPUTER ARITHMETIC AND INPUT-OUTPUT ORGANISATION 110
Computer Arithmetic Addition and Subtraction Multiplication Algorithms Division Algorithms Floating Point Arithmetic Operations Decimal Arithmetic Unit Decimal Arithmetic operations Peripheral Devices Input Output Interface Asynchronous Data Transfer Modes of Transfer Priority Interrupt Direct Memory Access Input Output Processors (IOP) Serial Communication Multiprocessors and their characteristics Interconnection Structures Interprocess Arbitration Interprocessor communication and Sychronisation Cache Coherence
2 COMPUTER SYSTEM ARCHITECTURE
represents the low order byte and PC(H) designates the high order byte. The statement R 2 ← R 1 refers the transfer of the content of register R 1 into register R 2. It should be noted that the content of the source register R 1 does not change after the transfer. In real applications, the transfer occurs only under a predetermined control condition. This can be shown by means of an “if-then” statement:
If P=1 then R 2 ← R 1
where P is a control signal generated in the control section of the system. For convenience we separate the control variables from the register transfer operation by specifying a control function. A control function is a Boolean variable that is equal to 1 or 0. The control function is written as follows:
P: R 2 ← R 1
Top
Since a computer has many registers, paths must be provided to transfer information from one register to another. If separate lines are used between each register and all other registers, number of wires will be excessive 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.
A common bus system can be constructed using multiplexers. These multiplexers select the source register whose binary information is then placed on the bus. A bus system will multiplex registers of a bit each to produce an n-line common bus. The number of multiplexers required to construct the bus is equal to n, where n is the number of bits in each register. The size of each multiplexer must be k × 1 since it multiplexes k data lines. A bus system can be constructed with ‘three-state gates’ instead of multiplexers. A three-state gate is a digital circuit that shows three states. Two of the states are equivalent to logic 1 and 0. The third state is a high impedance state. The high-impedance state behaves like an open circuit, which means that the output is disconnected and does not have a logic significance. The one most commonly used in the design of a bus system is the buffer gate.
The graphic symbol of a three state buffer gate is shown in the figure given below. The control input determines the output.
The construction of a bus system for four registers is shown in the figure in on the next page.
REGISTER TRANSFER AND MICRO-OPERATIONS 3
The function table of the above bus system is S 1 S 0 Register collected 0 0 A 0 1 B 1 0 C 1 1 D
The construction of a bus system with three state table buffers is shown in the following figure:
Top
A read operation implies transfer of information to the outside environment from a memory word, whereas storage of information into the memory is defined as write operation. Symbolizing a memory word by the
REGISTER TRANSFER AND MICRO-OPERATIONS 5
DR ← M[MAR]
M [MAR] ← DR
Usually a memory read or write operation requires more clock cycles than a register transfer operation.
These micro-operations perform some basic arithmetic operations on the numeric data stored in the registers. These basic operations may be addition, subtraction, incrementing a number, decrementing a number and arithmetic shift operation. An ‘add’ micro-operation can be specified as:
R 3 ← R 1 + R 2
It implies: add the contents of registers R 1 and R 2 and store the sum in register R 3.
The add operation mentioned above requires three registers along with the addition circuit in the ALU.
Subtraction, is implemented through complement and addition operation as:
R 3 ← R 1 – R 2 is implemented as
R 3 ← R 1 + (2’s complement of R 2 )
R 3 ← R 1 + (1’s complement of R 2 + 1)
R 3 ← R 1 + R 2 + 1
An increment operation can be symbolized as:
R 1 ← R 1 + 1
while a decrement operation can be symbolized as:
R 1 ← R 1 – 1
We can implement increment and decrement operations by using a combinational circuit or binary up/down counters. In most of the computers multiplication and division are implemented using add/subtract and shift micro-operations. If a digital system has implemented division and multiplication by means of combinational circuits then we can call these as the micro-operations for that system. An arithmetic circuit is normally implemented using parallel adder circuits. Each of the multiplexers (MUX) of the given circuit
6 COMPUTER SYSTEM ARCHITECTURE
has two select inputs. This 4-bit circuit takes input of two 4-bit data values and a carry-in-bit and outputs the four resultant data bits and a carry-out-bit. With the different input values we can obtain various micro- operations.
Equivalent micro-operation Micro-operation name
R ← R 1 + R 2 Add
R ← R 1 + R 2 +1 Add with carry
R ← R 1 + R 2 Subtract with borrow
R ← R 1 + 2’s Subtract
R ← R 1 Transfer
R ←R 1 + 1 Increment
R ← R 1 – 1 Decrement
These operations are performed on the binary data stored in the register. For a logic micro-operation each bit of a register is treated as a separate variable.
For example, if R 1 and R 2 are 8 bits registers and
R 1 contains 10010011 and
R 2 contains 01010101
R 1 AND R 2 00010001
Some of the common logic micro-operations are AND, OR, NOT or complements. Exclusive OR, NOR, NAND.
We can have four possible combinations of input of two variables. These are 00, 01, 10 and 11. Now, for all these 4 input combination we can have 2^4 = 16 output combinations of a function. This implies that for two variables we can have 16 logical operations.
Top
This operation sets to 1, the bits in register A, where there are corresponding 1’s in register B. For example
1010 A before
1101 B (logic operand)
1111 A after
It is clear that the OR microperation can be used to selectively set the bits of a register.
8 COMPUTER SYSTEM ARCHITECTURE
0000 1010 A after masking
and then insert the new value
0000 1010 A before
1001 0000 B (insert)
1001 1010 A after insertion
insert operation is an OR microoperation
Shift microoperation can be used for serial transfer of data. They are used generally with the arithmetic, logic, and other data-processing operations. The contents of a register can be shifted to the left or the right. During a shift-right operation the serial input transfers a bit into the leftmost position. The serial input transfers a bit into the rightmost position during a shift-left operation. There are three types of shifts, logical, circular and arithmetic.
A logical shift operation transfers 0 through the serial input. We use the symbols shl and shr for logical shift left and shift right microoperations, e.g.
R1 ← shl R
R2 ← shr R
are the two micro operations that specify a 1-bit shift left of the content of register R1 and a 1- bit shift right of the content of register R2.
The circular shift is also known as rotate operation. It circulates the bits of the register around the two ends and there is no loss of information. This is accomplished by connecting the serial output of the shift register to its serial input. We use the symbols cil and cir for the circular shift left and circular shift right. E.g. suppose Q1 register contains 01101101 then after cir operation, it contains 0110110 and after cil operation it will contain 11011010.
An arithmetic shift micro operation shifts a signed binary number to the left or right. The effect of an arithmetic shift left operation is to multiply the binary number by 2. Similarly an arithmetic shift right divides the number by 2. Because the sign of the number must remain the same arithmetic shift-right must leave the sign bit unchanged, when it is multiplied or divided by 2. The left most bit in a register holds the sign bit, and the remaining bits hold the number. The sign bit is 0 for positive and 1 for negative. Negative numbers are in 2’s complement form. Following figure shows a typical register of n bits.
Rn-1 Rn-2 → R 1 R 0
REGISTER TRANSFER AND MICRO-OPERATIONS 9
Sign bit Arithmetic shift right
Bit Rn-1 in the left most position holds the sign bit. Rn-2 is the most significant bit of the number and R 0 is the least significant bit. The arithmetic shift-right leaves the sign bit unchanged and shifts the number (including the sign bits) to the right. Thus Rn-1 remains the same, Rn-2 receives the bit from Rn-1, and so on for other bits in the register.
(i) R 2 ←M[AR]
(ii) M(AR)← R 3
(iii) R 5 ← M(R 5 )
(i) 01101101 (ii) 11111101
3 An 8-bit register contains binary value 11001010. What is the register value after a circular shift right?
Computer registers are designated by capital letters.
Symbols are a handy tool to represent the micro-operation sequences in registers and the control functions that initiate them, in a lucid & concise form. Such a symbolic notation is referred to as register transfer language.
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.
A micro-operation is an elementary operation performed with the data stored in registers.
These micro-operations perform some basic arithmetic operations on the numeric data stored in the registers.
Instruction and Instruction Code Computer Instructions Timing and Control Instruction Cycle Memory Reference Instructions Input, Output and Interrupt Complete Computer Description Machine Language Assembly Language The Assembler Programming Arithmetic and Logic Operations Subroutine Parameters and Data Linkage Input-Output Programming Control Memory Microprogram Example
After reading this unit you should appreciate the following:
12 COMPUTER SYSTEM ARCHITECTURE
Top
The collection of bits that instruct the computer to perform a specific operation is called an instruction code. Operation part is the most basic part of an instruction code. The operation code of an instruction is a group of bits that define such operations as add, subtract, multiply, shift and complement. The total number of operations available in the computer determines the number of bits required for the operation code of an
instruction. The operation code must consist of at least n bits for a given 2n (or less) distinct operations. An ‘operation’ is a binary code, that instruct the computer to perform a specific operation. The control unit gets the instruction from memory and interprets the operation code bits. It then issues a sequence of control signals to initiate micro-operations in internal computer registers. For every operation code, the control issues a sequence of micro-operations required for the hardware implementation of the specified operation.
This operation should be performed on some data stored in processor registers or on the data stored in the memory. Hence an instruction code must specify both the operation and the registers or the memory words where the operands are to be found, as well as the registers or the memory word where the operands be stored. Memory words can be specified in instruction codes by their address. Processor registers can be
specified by assigning to the instruction another binary code of K bits that specifies one of 2K registers. There are many variations for arranging the binary code of instructions. Each computer has its own particular instruction code format called its Instruction Set.
Generally a computer has one processor register and an instruction code format with two parts. The first part describes the operation to be performed and the second refers to an address. The memory address describes the control where to find an operand in memory. Instructions and data are stored in two separate
sections of memory. For a memory unit with 4096 words we need 12 bits to specify an address since 2^12 =
4096 × 16
14 COMPUTER SYSTEM ARCHITECTURE
!
The basic computer consists of eight registers, a memory unit and a control unit. To transfer information from one register to another and between memory and registers, paths must be provided. The number of wires used become excessive if connections are made between the outputs of each register and the inputs of the other registers. A common bus is an efficient scheme for transferring information in a system with many registers is to use. We have shown in previous chapter how to construct a bus system using MUXs or three state buffer gates.
Top
The basic computer uses three instruction code formats as shown in the following figure 2.3. Each format has 16 bits. The operation code (opcode) part has three bits and the meaning of the remaining 13 bits depends on the operation code. A memory reference instruction uses 12 bits to specify an address and one bit to specify the addressing mode I, which is equal to 0 for direct address and 1 for indirect address. The register reference instructions are recognized by the operation code 111 with a 0 in the left most bit (bit15) of the instruction.
A register reference instruction specifies an operation or a test of the AC register.
,
" #$
%& $
%&'! !
( ! '
An operand from memory is not needed, therefore, the other 12 bits are used to specify the operation or test to be executed. Similarly, an input-output instruction does not need a reference to memory and is recognized by the operation code 111 with a 1 in the left most bit of the instruction. The remaining 12 bits are used to specify the type of input-output operation or test performed.
BASIC COMPUTER ORGANISATION AND DESIGN 15
The type of instruction can be found by the computer control from the four bits in positions 12 through 15 of the instruction. If the three opcode bits in positions 12 though 14 are not equal to 111, the instruction is a memory reference type and the bit in position 15 is taken as the addressing mode I. If the 3 bit opcode is 111, then bit position 15 is checked. If this bit is 0, the instruction is a register reference type. If the bit is 1, the instruction is an input-output type. The bit in position 15 of the instruction code is designated by the symbol I, and it is not used when operation code is equal to 111.
Three bits of the instruction are used for the operation code. The computer is restricted to a maximum of eight distinct operations since register reference and I/O instructions use the remaining 12 bits as part of the total number of instruction chosen for the basic computer is equal to 25.
The instructions for the computer are listed in Table 2.2. The symbol reference is a three-letter word and represents an abbreviation intended for programmers and users.
! '
& - ! ! . . $ " $ --- (--- " $ / $$ --- 0--- / 1$ --- - -- 1 / ' 2--- 3--- 3*" ,--- --- 3 ) !! 3 --- $--- 3 ) 4 5 %--- 6--- 78 ) *+,, 16 +, ! 6 + ! 6 + ! 6 +( ! ) 6 1 +, ! ! 6 " + + 7 - 4 " +( 7 - 4 5 +, 7 - 8 56 + 7 - 6
BASIC COMPUTER ORGANISATION AND DESIGN 17
The program counter PC is loaded first with the address of the starting instruction in the program. The sequence counter SC is set to zero to provide a decoded timing signal T 0. Tt is required to transfer the address from PC to AR during the clock transition associated with timing signal, because only AR is connected to the address inputs of memory. The instruction read from memory is then placed in the instruction register IR with the clock transition associated with timing signal T 1. At the same moment PC is incremented by one to prepare it for the address of the next instruction in the program. At time T 2 , the
operation code in IR is decoded, the indirect bit is transferred to flip-flop I and the address part of the instruction is transferred to AR. SC is incremented after each clock pulse to produce the sequence T 0 , T 1
and T 2. During time T 3 , the control unit determines the type of instruction that was just read from memory.
Top
The seven memory-reference instructions are given in Table 2.3. The decoded output is from the decoder and it is designated by Di where i is from 0 to 6. The address register AR gives the effective address (EA) of the instruction. The EA is taken and it is placed there during timing signal T 2 (I = 0), or during timing signal T 3 when I = 1. The execution of the memory-reference instructions begins with timing signal T 4. We use register transfer notation to give the symbolic description of each instruction as it is clear from the table. In a bus system the actual execution of the instruction requires a sequence of microoperations. This is because data stored in memory cannot be processed directly. We have to read data from memory and transfer it to a register where they can be operated on with logic circuits. Now we can describe the operation of each instruction. We also give the control functions and microoperations required for their execution.
(
! !
" $ $^ ← ∧ : ; $$ $ (^) ← < : ;=6← (^)
1$ $ ← : ;
' $ 2 : ;=←
3*" $, (^) ←
3 $ : ;←=← <
5 $% (^) : ;← : ;<
# : ;< . ) ←<
This instruction performs the AND logic operation on pairs of bits in AC and the memory word specified by the effective address. The result of the operation is transferred to Accumulator. The microoperations that execute this instruction are:
D 0 T 4 : DR←M[AR]
D 0 T 5 : AC←AC ∧ DR, SC←0.
18 COMPUTER SYSTEM ARCHITECTURE
The content of the memory word specified by the effective address is added to the value of AC with the help of this instruction. The sum is transferred into accumulator and the output carry Cout is transferred to the E (extended accumlator) flip-flop. The microoperations needs to execute this instruction are:
D 1 T 4 : DR←M[AR]
D 1 T 5 : AC←AC + DR, E ← Cout, SC← 0
This instruction is used to transfers the memory word specified by the effective address to accumulator. Following microoperations are needed to execute this instruction:
D 2 T 4 : DR←M[AR]
D 2 T 5 : AC←DR, SC←0.
This Instruction is used to store the content of accumulator into the memory word specified by the effective address. Since the output of AC is applied to the bus and the data input of memory is connected to the bus, we can execute this instruction with one microoperation:
D 3 T 4 : M[AR] ←AC, SC ← 0
This instruction is used to transfer the program to the instruction located at the effective address. We already know that program counter holds the address of that instruction which is to be read from memory in the next instruction cycle. Program Counter is incremented at time T 1 to make ready it for the address of the next instruction in the program sequence. This instruction allows the programmer to specify an instruction out of sequence i.e. the program branches (or jumps) unconditionally. The instruction requires only one microoperation:
D 4 T 4 : PC ←AC, SC ← 0
With the help of common bus, the effective address from AR reaches to PC. The control transfers to T 0 by resetting SC to 0. Now the next instruction is fetched. This is then executed from the memory address given by the new value in PC.
This is a useful instruction for branching to a portion of the program called a subroutine. When BSA instruction is executed, it stores the address of the next instruction in sequence (which is available in PC) into memory location specified by the effective address. To serve as the address of the first instruction, the effective address plus one is transferred to PC in the subroutine. This operation was specified in with the following register transfer:
M[AR] ← PC, PC ← AR + 1
To demonstrate this, a numerical example shows how this instruction is used with a subroutine (Figure 2.4). Assuming that the BSA instruction is in memory at address 20. The I bit is 0 and the address part of the instruction has 135 in binary. PC will contain 21, after the fetch and decode phases. This is the address of the next instruction in the program (referred to as the return address). Address register contains the effective