210 likes | 371 Vues
MIPS Data Path. Ellen Spertus MCS 111 October 23, 2001. Readings and lectures . HP has been growing in importance through the semester Now it is vital Recommendation Read before lecture Ask questions in lecture Review as needed. Big Picture.
E N D
MIPS Data Path Ellen Spertus MCS 111 October 23, 2001
Readings and lectures • HP has been growing in importance through the semester • Now it is vital • Recommendation • Read before lecture • Ask questions in lecture • Review as needed
Big Picture • Given devices that implement simple boolean functions… • Understand how a computer works • Build an actual computer that you will program • Study the MIPS architecture • Write assembly language programs • Learn the implementation of a MIPS subset
Implementing MIPS subset • Review: Mite • Definition of MIPS subset (5.1) • Elements of the data path (5.2) • Control of elements (5.3) • Optimization (6)
MIPS subset Mite • Word size: 32 bits • Number of registers: 32 • Instruction length: 32 bits • Types of instructions: • Memory: lw, sw • Arithmetic-logical: add, sub, and, or, slt • Control flow: beq, jump
S t a t e S t a t e e l e m e n t C o m b i n a t i o n a l l o g i c e l e m e n t 1 2 C l o c k c y c l e Clocking methodology • Defines when signals can be read and when they can be written. • Write values on rising edge of clock
Data path elements • Memory: PC, instruction, registers, data • ALU • Which of these does Mite have?
Sample instruction: add $t1, $t2, $t3 add $9, $10, $11 Closer look at register file
Increment PC Read registers Use ALU add $t1, $t2, $t3 add $9, $10, $11 Data path usage: arithmetic-logical 10 11 9
Increment PC Read registers Use ALU lw $t0, 1($s0) lw $8, 1($16) D a t a R e g i s t e r # A d d r e s s P C I n s t r u c t i o n R e g i s t e r s A L U A d d r e s s R e g i s t e r # I n s t r u c t i o n D a t a m e m o r y m e m o r y R e g i s t e r # D a t a Data path usage: memory
Increment PC Read registers Use ALU lw $t0, 1($s0) lw $8, 1($16) Data path usage: memory
A closer look at load/store lw $8, 1($16)
Assembly code slt $t0, $a0, 2 bne $t0, $zero, recur mov $v0, $t0 jr $ra recur: add $sp, $sp, 12 sw $ra, 8($sp) ... Machine code 0: slti $8, $4, 2 4: bne $8, $0, __ 8: add $2, $0, $8 12: jr $31 recur: 14: addi $29, $29, 12 16: sw $31, 8($29) ... Assembly of conditional branches
Increment PC Read registers Use ALU Add offset to PC beq $t1, $t2, label Data path usage: control flow