90 likes | 178 Views
EET 4250. Ch. 4: The Processor: Datapath & Control Logic. Acknowledgements: Some s lides and lecture notes for this course adapted from Prof. Mary Jane Irwin @ Penn State, Morgan Kaufmann supplemental material for the course text. Branch Instructions. Read register operands
E N D
EET 4250 Ch. 4: The Processor: Datapath & Control Logic Acknowledgements: Some slides and lecture notes for this course adapted from Prof. Mary Jane Irwin @ Penn State, Morgan Kaufmann supplemental material for the course text.
Branch Instructions • Read register operands • Compare operands • Use ALU, subtract and check Zero output • Calculate target address • Sign-extend displacement • Shift left 2 places (word displacement) • Add to PC + 4 • Already calculated by instruction fetch EET 4250: Microcomputer Architecture
Branch Addressing – Absolute 1st Instruction 2nd Instruction EET 4250: Microcomputer Architecture • Simplified branch ADDR field • If immediate field is 3 bits instead of 16 • beq $t0, $t1, ADDR • How do we maximize how big ADDR can be? • Case 1: ADDR is an absolute address • Limit to 23 = 8 addresses in program! • Only 2 instructions (at address 0 & 4)
Branch Addressing – Byte Offset 1st Instr. Any of the 232 addresses 2nd Instr. EET 4250: Microcomputer Architecture • Simplified branch ADDR field • If immediate field is 3 bits instead of 16 • Case 2: ADDR is a byte-offset from PC • PC is 32 bits = 232 addresses • Branch can go PC ± 22 bytes = PC ± 4 bytes = PC ± 1 instructions!!
Branch Addressing – Word Offset EET 4250: Microcomputer Architecture • Simplified branch ADDR field • If immediate field is 3 bits instead of 16 • Case 3: ADDR is a word-offset from PC • PC is 32 bits = 232 addresses • Branch can go PC ± 22 words = PC ± 16 bytes = PC ± 4 instructions!!
Branch Instructions Justre-routes wires Sign-bit wire replicated EET 4250: Microcomputer Architecture
Composing the Elements • First-cut data path does an instruction in one clock cycle • Each datapath element can only do one function at a time • Hence, we need separate instruction and data memories • Use multiplexers where alternate data sources are used for different instructions EET 4250: Microcomputer Architecture
R-Type/Load/Store Datapath EET 4250: Microcomputer Architecture
Full Datapath EET 4250: Microcomputer Architecture