Lecture 3 Computer Architecture Bus Architectures Buses n
Lecture 3 Computer Architecture Bus Architectures
Bus(es) n n n A bus is a hardware channel through which information can flow between components connected to the bus. It allows us to simplify our current model and to make further additions more easily. Only two components may communicate through a bus at any given time.
One Bus Design Memory MDR MAR BUS IR OP A ADDR IP 1 Decoder ALU ADD C
Instruction Set Store(01) Fetch(00) MDR<-BUS<-A Memory[MAR]<- MDR MAR <- BUS<-PC MDR <- Memory[MAR] || PC <-PC + 1 IR <-BUS<-MDR Decoder <- IR. Opcode MAR<-BUS<-IR. ADDR Load(02) MDR <-Memory[MAR] A <-BUS<-MDR ADD(03) MDR <-Memory[MAR] C <- A + MDR (ALU<-BUS<-MDR) A<-BUS<- C END(04) Stop JMP (05) PC IR. ADDR
Two Bus Design(modify) Memory MDR MAR BUS 1 A IR OP ADDR IP 1 Decoder ALU ADD BUS 2
2 Bus Design n With the added bus, 2 pairs of components may communicate in parallel. The additional bus does not change the current instruction set. Extra registers maybe need to allow data to be transferred from one bus to the other. In this example registers A, IP, and IR are used for this function.
2 -BUS Architecture A B ALU + MDR M E M O R Y C Decoder MAR OP ADDR PC 4
Instruction Formats The Format of the current instructions are OP <ADDR> n To provide instructions of the format ADD, R 1, R 2, R 3 and STORE R 3, <ADDR> where R 1, R 2 and R 3 are registers we need to add an architecture to select the appropriate register n
Register File n n n By utilizing a register file you can organize the registers in one array The control unit allows us to select the appropriate register for the operation and load it into its target location (either memory or another register) This is a crucial aspect of the Load/Store architecture
One Bus with Register File Load/Store Instruction Format Memory MDR MAR BUS OP r 3 ADRR A r 1 r 2 r 3 r 4 Select register ALU C Decoder IP Register File OP 15 R 12 11 10 <ADDR> 9 0
One Bus with Register File Register to Register Format Memory MDR MAR BUS OP r 3 A r 1 r 2 r 3 r 4 r 1 Select register ALU C Decoder IP Register File OP 15 R R 12 11 10 9 No used 8 0
2 -BUS Load/Store Architecture with Register File A MDR ALU M E M O R Y OP MAR Register File PC 4
Instruction Formats n The instruction format must be modified n Three instruction formats are used OP 15 <ADDR> 12 OP 15 11 R 12 11 OP 15 0 <ADDR> 10 9 0 R 1 12 11 R 2 8 7 R 3 4 3 0
3 -BUS Load/Store Architecture with Register File By adding a third BUS the system can load two registers at once using each BUS n Two multiplexers need to be attached to the output of the register file: one connected to each BUS to send the contents of the target register to its destination n Another multiplexer unit is added to send input from the third BUS into the correct location within the register file n
3 -BUS Load/Store Architecture with Register File MDR ALU M E M O R Y OP MAR Register File PC 4
Control Unit OP ………. . PC Decoder T 1 MAR T 2 T 3 M T 4 T 5 MDR IR
Clock Unit n n The Latch will only allow the change of the value on each clock tick By linking as a ring counter we create a clock distributor D Q 1 T 1 0 T 2 0 T 3 D Q
Clock Unit n At every clock tick the active flip-flop changes, sending a signal to execute a different step of the current instruction in turn D Q 1 0 T 1 Q T 2 D Q D 0 1 T 1 Q T 2 T 3 Q D 0 D 0 0 T 1 T 2 D 0 T 3 Q 1 T 3
Control Unit OP ………. . PC Decoder T 1 MAR T 2 T 3 M T 4 T 5 MDR IR Each line emerging from the decoder represents an operation. When the decoder is set to that operation, it sends voltage down the appropriate channel which is ANDed with the signals coming from the clock. This allows for precise timing in the step executions of instructions and makes synchronization among components possible.
Control Unit OP ………. . PC Decoder T 1 MAR T 2 T 3 M T 4 T 5 MDR IR Fetch Cycle: T 1: MAR <- PC T 2: MDR <- M[MAR] T 3: IR <- MDR T 4: MAR <- IR. ADDR T 5: Decoder <- IR. OP The chain of flip-flops will be as long in clock ticks as the longest command takes to execute.
One-Address Format n n The operation is 4 bits and the remaining 12 are address bits This gives the availability of 2 4 operations and 2 12 memory locations OP 15 <ADDR> 12 11 0
One-Address Format 15 -12 Command 0000 Fetch 0001 Add 0010 Sub 0011 Mult … 1111 OP 15 <ADDR> 12 11 0 0000 is the Fetch operation(hidden instruction) n It is a hidden instruction that cannot be accessed by the user n
Two-Address Format n The operation is performed on the memory addresses of the first and second operands and the value is stored back in the location specified by the first operand field 1 st Operand/ Result OP 15 12 11 2 nd Operand 6 5 0
Two-Address Format Add 15 100 200 12 11 CPU 100 6 5 0 This is analogous to: Load 200 Add 100 200 Store 200 all performed in one command
Three-Address Format n The operation is performed on the memory addresses of the first and second operands and the value is stored in the location specified by the result address field OP 15 n. This Result 12 11 1 st Operand 2 nd Operand 8 7 4 3 0 format is not often used because it requires three memory accesses per operation (which is very slow)
Three-Address Format Add 15 100 300 12 11 CPU 200 8 7 100 4 3 0 This is analogous to: Load 200 Add 100 200 300 Store 300 all performed in one command
Another Three-Address Format Add 15 CPU R 1 R 2 R 3 12 11 R 2 8 7 R 1 4 3 0 In a Load/Store machine, the addresses are often locations in the register file rather than in memory. This is very fast on a machine with multiple-BUS architecture.
Addressing Modes Direct n Immediate n Indirect n Register Direct n Register Indirect plus Offset n 11/27/2020 28
Direct Addressing Used for manipulating an absolute address. Example: LOAD R 1, <ADDR> will load the contents of <ADDR> into R 1 100 … Memory 5 Registers … 0 1 2 3 200 … 11/27/2020 LOAD 3, 100 5 CPU 29
Immediate Addressing Used when dealing with constants. Example: LOAD R 1, #value will load value into R 1. Registers LOAD 3, #25 0 1 2 3 11/27/2020 25 CPU 30
Indirect Addressing Typically used for accessing a value through a pointer. Example: LOAD R 1, I, <ADDR> … Memory 500 800 … 800 18 … 11/27/2020 MAR 800 Registers 0 1 2 3 LOAD 1, I, 500 18 CPU Contents of <ADDR> stores another address whose contents will be loaded into R 1 31
Register Direct Addressing Used to copy the contents of one register into another. Example: COPY R 2, R 1 or MOVE R 2, R 1 will copy contents of R 1 into R 2. Registers 11/27/2020 0 1 25 2 3 25 COPY 3, 1 CPU 32
Register Indirect Addressing Typically used for accessing a list of consecutive memory locations. Example: LOAD R 2, <R 1> … Memory 200 100 … 200 MAR 18 … 11/27/2020 Registers 0 1 2 3 LOAD 2, 1 200 18 CPU will load the contents of address stored in R 1 into R 2 33
Register Indirect Addressing plus Offset Typically used when accessing array and structures. Example: LOAD R 2, R 1, offset 0 1 100 … 600 Registers … Memory 18 2 3 LOAD 2, 1, 500 18 + CPU … 11/27/2020 will load the contents of address stored in R 1+offset into R 2 34
- Slides: 34