3 - 1 BME 303 Lecture 14 • Return and go over Exam#1(Exam...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 1 BME 303 Lecture 14 • Return and go over Exam #1 (Exam answers now on Blackboard) • Finish: LC-3 Instructions • (Still haven’t had a chance to address grading issues for HW #2 & #3) 2 Instructions • Operate – Manipulate data directly: ADD, AND, NOT • Data Movement (“load” and “store”) – Move data between memory and registers: LD, LDI, LDR, LEA, ST, STI, STR • Control (jump, branch, return, …) – Change the sequence of instruction execution: BR, JMP/RET, JSR/JSRR, RTI, TRAP 3 Control Instructions • Used to alter the sequence of instructions (by changing PC) • Conditional Branches – branch is taken if a specified condition is true • offset is added to the PC to yield new PC – else, the branch is not taken • PC is not changed, points to the next sequential instruction • Unconditional Branches (or Jump) – always changes the PC 4 Condition Codes • LC-3 has three condition code registers : N – negative Z – zero P – positive (greater than zero) • Condition code registers are set by any instruction that stores a value to a register ADD, AND, NOT, LD, LDR, LDI, LEA • Only one will be set at all times – Based on the last instruction that altered a register 5 Branch Instruction • Branch specifies one or more condition codes • If the bit specified is set, the branch is taken – PC is set to the address specified in the instruction – Like direct mode addressing, target address is made by adding current (pre-incremented) PC with signed PCoffset9 (IR<8:0>) • If the branch is not taken, the next sequential instruction is executed 1 1 1 PCoffset9 n z p BR 0x101 p BR 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Operand(s) Opcode 6 Branch Instruction if ( (n AND N) OR (z AND Z) OR (p AND P) ) PC = PC +1 + SEXT(PCoffset9) For this case, PC = PC – 254 if P is set....
View Full Document

This note was uploaded on 09/06/2009 for the course BME 303 taught by Professor Ren during the Spring '08 term at University of Texas.

Page1 / 26

3 - 1 BME 303 Lecture 14 • Return and go over Exam#1(Exam...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online