Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Interconnection structures
Computer consists of set of components (or modules) of 3 basic types. CPU Memory I/O These components communicate with each other. The collection of paths connecting various modules is called as Interconnection structure.
There may be different designs of interconnection structure depending upon exchanges that must be made b/w the modules.
Computer Components:
Processor Organization
Central Processing Unit :
The organization of a simple computer with one CPU and two I/O devices
Similarity between Internal structure of the Computer as whole and IS of CPU (collection of major elements) Computer : CPU, I/P, O/P and Memory
Register Organization
CPU must have some working space (fast access and close to CPU) This space is efficiently used to store intermediate values The most convenient way to communicate registers is trough common bus system
User Visible register : To minimize main memory references by optimizing register uses (enables m/c
and assembly level Programmer)
Control and Status register: Used by control unit to control the CPU operation
User visible Registers: General Purpose: Can contain the operand for any opcode. (as there are some dedicated registers like SR for
stack operations)
Condition codes: Are the bits set by CPU h/w as the result of operation(ex ,Flag Register)
R6 R7
Load (7 lines)
SELA
MUX
MUX
SELB
38 decoder
A bus
B bus
SELD OPR
Output
(a) Block diagram
SELA
SELB
SELD
OPR
3 X 8 Decoder: select the register (by SELD) that receives the information from ALU
Control word: The 14 binary selection inputs (3 bits for SELA, 3 for SELB, 3 for SELD, and 5 for OPR)
R1 R2 R3
1 ) MUX A selector (SELA) : to place the content of R2 into BUS A 2) MUX B selector (SELB) : to place the content of R3 into BUS B 3 ) ALU operation selector (OPR) : to provide the arithmetic addition R2 + R3 4) Decoder selector (SELD) : to transfer the content of the output bus into R1
SELA or SELB = 000 (External Input) : MUX selects the external data SELD = 000 (None) : no destination register is selected but the contents of the output bus are available in the external output
Example
Micro-operation : R1 R2 - R3
Control word
Field:
Symbol: Control word:
SELA
R2 010
SELB
R3 011
SELD
R1 001
OPR
SUB 00101
Stack Organization
Stack: A storage device that stores information in
such a manner that the item stored last is the first item retrieved. Also called last-in first-out (LIFO) list. Useful for compound arithmetic operations and nested subroutine calls.
A stack organization is very effective for evaluating arithmetic expressions A * B + C * D (AB *)+(CD *) AB * CD * +
( 3 * 4 ) + ( 5 * 6 ) 34 * 56 * +
STACK OPERATIONS
Evaluation procedure:
1. Scan the expression from left to right. 2. When an operator is reached, perform the operation with the two operands found on the left side of the operator. 3. Replace the two operands and the operator by the result obtained from the operation.
(Example) Infix postfix 3 * 4 + 5 * 6 = 42 34*56*+
12 5 6 * + 12 30 + 42
STACK OPERATIONS
Instruction Formats
Layout of bits in an instruction Includes op-code Includes (implicit or explicit) operand(s) Usually more than one instruction format in an instruction set Instruction code format with parts : Mode + Op. Code + Address Mode : Used to specify the type of Instruction Op. Code : Specify 8 possible operations(3bits) Address : Specify the address of an operand(12 bits). If an operation in an instruction code does not need an operand from memory, the rest of the bits in the instruction(address field) can be used for other purpose
15 14 12 11 0
Op. Code
Address
I/O Instruction
1 1 1 1 I/O Operation ( Opcode = 111 , I = 0)
Allocation of Bits
Number of addressing modes Number of operands Register versus memory Number of register sets Address range
Types of Operations
Operation Type Arithmetic/Logical(Data Manipulation) Example ADD, SUB, MULT, DIV, AND, OR, INR/DCR, Shift, Rotate
Data Transfer
Control System FP Decimal String Graphics
Instruction Types
1. Memory Reference 3. Input/output Reference 2. Register Reference
Instruction Formats
Number of operands Instruction sets may be categorized by the maximum number of operands explicitly specified in instructions. Number of operands in an instruction format depends on the internal CPU Organization:
Zero address instruction: One address instructions: Two address instructions: Three address instructions:
Stack-organized computer does not use an address field for the instructions ADD, and MUL
Evaluate X = ( A + B ) * ( C + D )
PUSH PUSH A B C D
ADD
PUSH PUSH ADD MUL
POP
Advantages: No memory addresses needed during the operation. Disadvantages: results in longer program codes.
One address instructions (1-operand m/c) So called accumulator machines, include early computers Instructions specify a single right operand (constant, a register, or a memory location), with the implicit accumulator as the left operand load a, add b, store c. All operations are done between the AC register and memory operand
AC M [ A] AC AC M [ B] M [T ] AC
Advantages: fewer bits are needed to specify the address. Disadvantages: results in writing long programs.
Two address instructions (2-operand) Two address registers or two memory locations are specified, one for the final result.
R1 M [ A] R 2 M [ B] R1 R1 R 2 M [ x] R1
Advantages: results in writing medium size programs Disadvantages: more bits are needed to specify two addresses.
R1 R2 R3
Advantages: results in writing short programs Disadvantages: more bits are needed to specify three addresses.
(A + B) * ( C+D)
Three-address instructions Two-address instructions
ADD R1, A, B
R1 M[A] + M[B]
ADD R2, C, D R2 M[C] + M[D] MUL X, R1, R2 M[X] R1 * R2
MOV R1, A R1 M[A] ADD R1, B R1 R1 + M[B] MOV R2, C R2 M[C] ADD R2, D R2 R2 + M[D] MOV X, R2 M[X] R2 MUL X, R1 M[X] R1 * M[X]
(A + B) * ( C+D)
One-address instructions Zero-address instructions
LOAD A AC M[A] ADD B AC AC + M[B] STORE T M[T ] AC LOAD C AC M[C] ADD D AC AC + M[D] MUL T AC AC * M[T ] STORE X M[X] AC Store
PUSH A
PUSH B ADD
TOS A
TOS B TOS (A+B)
PUSH C
PUSH D ADD MUL POP X
TOS C
TOS D TOS (C+D) TOS (C+D)*(A+B) M[X] TOS
Operand Locations
Accumulator (before 1960):1 address add A : acc acc + mem[A] Stack (1960s to 1970s): 0 address add : tos tos + next Memory-Memory (1970s to 1980s):2/3 address add A, B: mem[A] mem[A] + mem[B] add A, B, C: mem[A] mem[B] + mem[C] Register-Memory (1970s to present):2 address add R1, A : R1 R1 + mem[A] load R1, A: R1 mem[A] Register-Register, also called Load/Store (1960s to present):2/3 address add R1, R2,R3: R1 R2 + R3 load R1, R2 : R1 mem[R2] store R1, R2 : mem[R1] R2
Example: C = A + B
Stack
Push A
S[++tos] = M[A]
Accumulator
Load A
accum = M[A]
Reg-Mem
Load R1, A
R1 = M[A]
Load-Store
Load R1, A
R1 = M[A]
Push B
S[++tos] = M[B]
Add B
accum += M[B]
Load R2, B
R2 = M[B]
Add
t1= S[tos--]; t2= S[tos--]; S[++tos]= t1 + t2
Store C
M[C] = accum
Store R3, C
M[C] = R3
Pop C
M[C] = S[tos--]
Store R3, C
M[C] = R[3]
Summary of ISA
No of memory address 1 0 0 Max no of operands Arch Examples Advantages Disadvantages
1 0 3
Acc Stack LoadStore X86 (for FP operations) ARM, MIPS, Sparc, PowerPC
Less Hardware, high code density Less Hardware, high code density Fixed length instruction, simple code gen, CPI similar for all instr., easy decoding Data without load instruction. Easy Instr encoding.
Registermemory
Src operand (mem) destroyed. Num registers less. CPI varies. Variable length instructions. Mem access bottleneck.
2 Or 3
2 Or 3
VAX
Memory addressing
Endianness: How is byte ordered in a word: where is the LSB?
Small End Big End
00 01 10 11 12 34 56 78 78 56 34 12
Register
Immediate
Memory
Direct [displacement]
Indirect
Register [Base]
Based-indexed [ scaled]
Scalefactor No scale factor [Base + (index *scale) [Base + Index + disp] + disp ]
Instruction Cycle