Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation
Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement.Téléchargez la présentation en cliquant sur ce lien.Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.
Chapter Organization • Logic design conventions • Implementation of a "toy" CPU • Pipelining • Pipelining hazards • Data hazards • Control hazards • Exceptions • Parallelism IMPORTANT
Combinational/state elements • Combinational elements: • Outputs only depend on current inputs • Stateless • Adders and, more generally, arithmetic logic unit (ALU)
Combinational/state elements • State elements: • Have a memory holding a state • Output depends on current inputs and state of element • State reflects past inputs • Flip-flops, …
Judicial analogy • In our legal system • Guilty/not guilty decision is stateless • Good reasons • Sentencing decision is not • "Three strikes and you are out" laws • Good reasons
Clocking methodology • We will assume an edge-triggered clocking technology • Edge is short-enough to prevent data propagation in state elements • Can read current state of a memory element at the same time we update it
Clocking convention • Omit write control signal if state element is updated at every active clock edge
Motivation • "Toy" CPU will implement a subset of MIPS instruction set • Subset will be • Self-sufficient • Simpler to implement • Complex enough to allow a serious discussion of CPU architecture
The subset • Will include • Load and store instructions:lw (load word) and sw (store word) • Arithmetic-logic instructions:add, sub, and, or and slt (set less than) • Branch instructions:beq (branch if equal) and j (jump)
Load and store instructions • Format I • Three operands: • Two registers $r1 and $r2 • One displacement d • lw $r1, d($r2) loads into register $r1 main memory word at address contents($r2) + d • sw $r1, d($r2) stores contents of register $r1 into main memory word at address contents($r2) + d
Arithmetic-logic instructions • Format R • Three operands: • Three registers $r1, $r2 and $r3 • Store into register $r1 result of $r2 <op> $r3where <op> can be add, subtract, and, oras well as set if less than
Branch instruction • Format I • Three operands: • Two registers $r1 and $r2 • One displacement d • beq $r1, $r2, dset value of PC to PC+4 + 4×diff $r1 = $r2
The simplest data path • Assume CPU will do nothing but • Incrementing its program counter and • Deliver the next instruction
Implementing load and store • Require • An address calculation: • contents($r2) + d • An access to data memory • Before doing the address calculation, we must transform 16-bit displacement d into a 32-bit value using sign extension
The data memory • One address selector • One write data input • One read data output • Two controls • MemWrite • MemRead
0000 0000 0000 0000 0110 1010 1010 0100 Sign extension (I) • If 16-bit number has a zero as MSB • It is positive • Must add 16 zero bits 0110 1010 1010 0100
1111 1111 1111 1111 1110 1010 1010 0100 Sign extension (II) • If 16-bit number has a one as MSB • It is negative • Must add 16 one bits 1110 1010 1010 0100
The data memory MemWrite: enables memory writes Memory address Read data Write data MemRead: enables memory reads
Implementing conditional branch • Target Address: • Sign-extend 16-bit immediate part of instruction • Shift left 2 • Add to PC • Branch Control Logic: • Perform test operation on two registers • Check result
SE Implementing conditional branch Branch Destination PC+4 Add Shiftleft 2 Registerfile To branch control logic ALU d field of instruction Sign-extended d field
Note • Arithmetic-logic operations only use • Register file and ALU • Load and store use • ALU for computing memory address • Data memory
Controlling the ALU • Recall that all R-format instructions have same opcode • Operation performed by ALU is specified in the function field (bits <0:5>)
Controlling the ALU • ALU control inputs generated by two-step process • Construct two ALUOp control bits fromopcode • Construct four ALU control bits using • Two ALUop bits • Six bits from function fieldwhen they are needed
Note • Bits 4 and 5 of function field are not used • ALUOp bits only have three possible values:00, 01 and 10 • Introduces don't care conditions • All R instructions use same data paths • Other control bits depend only on opcode
The “weird" jump instruction • Uses J format • Single 26 bit operand • Implements an unconditional jump • New value of PC is obtained as follows • Bits 1:0 are zero (address is multiple of 4) • Bits 28:2 come from jump operand • Bits 31:29 come from PC+4