Objective Pipelining Design Processor for Alpha Subset Interesting but not overwhelming quantity High level functional blocks September 9 2003 Initial Design Topics 2 Topics 1 Data Hazards Stalling and Forwarding Systematic testing of hazard handling logic Control Hazards Stalling Predict not taken Exceptions Multicycle Instructions Objective Instruction formats Instruction processing Principles of pipelining Inserting pipe registers One instruction at a time Single cycle per instruction Follows H P Ch A 1 Refined Design 5 stage pipeline Similar to early RISC processors Follows H P Ch A 2 3 Goal approach 1 cycle per instruction but with shorter cycle time What Makes it Hard Hazards exceptions A 4 6 2 Alpha Arithmetic Instructions RR type instructions addq subq xor bis cmplt rc ra funct rb Op ra 31 26 25 21 rb 000 0 funct rc 20 16 15 13 12 11 5 4 0 RI type instructions addq subq xor bis cmplt rc ra funct ib Op ra ib 1 funct rc 31 26 25 21 20 13 Encoding ib is 8 bit unsigned literal Operation Op field 12 11 5 Alpha Load Store Instructions Load Ra Mem Rb offset Store Mem Rb offset Ra 0x10 0x10 0x11 0x11 0x11 0x20 0x29 0x20 0x40 0x24 cmplt 0x11 0x4D Op ra rb offset 31 26 25 21 20 16 15 0 Encoding offset is 16 bit signed offset Operation Op field ldq stq funct field addq subq bis xor cmoveq 3 4 0 CS 740 F 03 CS 740 F 03 4 0x29 0x2D CS 740 F 03 Branch Instructions Transfers of Control jmp jsr ret Ra PC 4 PC Rb Cond Branch PC Cond Ra PC 4 disp 4 PC 4 Op ra disp 31 26 25 21 20 0 Encoding disp is 21 bit signed displacement Operation Op field Cond beq bne 0x39 0x3D ra disp 25 21 20 0 Operation Hint 31 26 25 21 20 16 15 0 00 01 10 call pal Op field br bsr rb jmp jsr ret Branch Subroutine br bsr Ra PC 4 PC PC 4 disp 4 Op ra Encoding High order 2 bits of Hint encode jump type Remaining bits give information about predicted destination Hint does not affect functionality Jump Type Hint 15 14 Ra 0 Ra 0 31 26 0x1A 0x30 0x34 0x00 Number 31 26 25 0 Use as halt instruction 5 CS 740 F 03 6 CS 740 F 03 Instruction Encoding 0x0 40220403 addq r1 r2 r3 0x4 4487f805 xor r4 0x3f r5 0x8 a4c70abc ldq r6 2748 r7 0xc b5090123 stq r8 291 r9 0x10 e47ffffb beq r3 0 0x14 d35ffffa bsr r26 0 r31 0x18 6bfa8001 ret r31 r26 1 0x1c 000abcde call pal Decoding Examples 0x0 40220403 4 0 2 addq r1 r2 r3 2 0 4 0x8 a4c70abc 0 3 0100 0000 0010 0010 0000 0100 0000 0011 10 01 02 0x10 e47ffffb e 0xabcde 4 7 20 beq f 03 r3 0 f f 39 Instructions encoded in 32 bit words Program behavior determined by bit encodings Disassembler simply converts these words to readable instructions 7 CS 740 F 03 03 Target 8 4 c 7 f b 1ffffb 510 r6 2748 r7 0 a b c 1010 0100 1100 0111 0000 1010 1011 1100 29 06 07 0x18 6bfa8001 1110 0100 0111 1111 1111 1111 1111 1011 Object Code a ldq 6 b f 0abc 274810 ret a r31 r26 1 8 0 0 1 0110 1011 1111 1010 1000 0000 0000 0001 1a 1f 1a 2 3110 2610 16 Current PC 4 Increment 4 5 Disp 0 CS 740 F 03 Datapath IF ID instruction fetch instruction decode register fetch Hardware Units EX MEM execute address calculation memory access WB write back Zero Test Instr datIn 15 0 20 0 25 21 20 16 P C Data Mem Xtnd Instr Mem Xtnd 2 regB datW 20 13 datOut regA datA Reg Array regW datB addr aluA ALU aluB Instruction Memory Fetch 32 bit instructions Data Memory Load store 64 bit data Register Array Storage for 32 integer registers Two read ports can read two registers at once Single write port Functional Units 4 0 Wdest 25 21 4 Storage IncrPC Wdata 9 4 Xtnd ALU Zero Test CS 740 F 03 10 RR type instructions ra 31 26 25 21 rb 000 0 funct rc 20 16 15 13 12 11 5 4 0 IF Instruction fetch CS 740 F 03 Active Datapath for RR RI RR type instructions addq subq xor bis cmplt rc ra funct rb Op PC incrementer Sign extender Arithmetic and logical instructions Detect whether operand 0 Instr Data Mem 25 21 20 16 P C IR IMemory PC PC PC 4 datIn Instr Mem regB datW 20 13 ID Instruction decode register fetch regA regW datOut datA Reg Array datB 4 Wdest IncrPC Ex Execute Wdata ALUOutput A op B ALU Operation MEM Memory nop WB Write back Register IR 4 0 ALUOutput 11 ALU aluB 4 0 A Register IR 25 21 B Register IR 20 16 addr aluA CS 740 F 03 Input B selected according to instruction type datB for RR IR 20 13 for RI ALU function set according to operation type 12 Write Back To Rc CS 740 F 03 Active Datapath for RR RI Instr RI type instructions RI type instructions addq subq xor bis cmplt rc ra funct ib Op ra ib 1 funct rc datIn Data Mem IF Instruction fetch IR IMemory PC PC PC 4 ID P C regA 20 16 regB Instr Mem datW 20 13 datOut datA regW addr aluA Reg Array ALU aluB datB 4 0 4 25 21 Wdest IncrPC A Register IR 25 21 B Register IR 20 16 Wdata Ex Execute ALUOutput A op B MEM Memory ALU Operation nop WB Write back Register IR 4 0 ALUOutput Input B selected according to instruction type datB for RR IR 20 13 for RI ALU function set according to operation type Write Back To Rc 13 31 26 25 21 20 13 12 11 5 4 0 IF Instruction fetch IR IMemory PC PC PC 4 ID Instruction decode register fetch A Register IR 25 21 B IR 20 1 3 Ex Execute ALUOutput A op B MEM Memory nop WB Write back Register IR 4 0 ALUOutput CS 740 F 03 14 Load instruction CS 740 F 03 Active Datapath for Load Store Load Ra Mem Rb offset Instr Op ra rb offset 31 26 25 21 20 16 15 0 15 0 25 21 IF Instruction fetch 20 16 P C IR IMemory PC PC PC 4 Instr Mem datIn regA regB datW regW ID Instruction decode register fetch datA Reg Array datB Store aluA datOut addr ALU aluB Load Wdest B Register IR 20 16 25 21 Ex Execute 4 IncrPC ALUOutput B SignExtend IR 15 0 ALU Operation MEM Memory Used to compute address A input set to extended IR 15 0 ALU function set to add Mem Data DMemory ALUOutput WB Write back Register IR 25 21 Mem Data 15 Data Mem Xtnd CS 740 F 03 16 Wdata Memory Operation Read for load …
View Full Document
Unlocking...