BME303_lecture10

BME303_lecture10 - BME303 Intro to Computing Chapter 5 The...

This preview shows pages 1–6. Sign up to view the full content.

1 BME303 Intro. to Computing 1 Chapter 5: The LC-3 • ISA of LC-3 – Memory – Registers – Instruction set – Opcodes – Data types – Addressing modes – Condition codes • Instructions (machine language) – Operate – Data Movement – Control • LC3 Data Path Problem Language Machine (ISA) Architecture Algorithms Micro-architecture Circuits Devices Bottom Up BME303 Intro. to Computing 2 LC-3: Instruction Set Opcodes (total of 15) 1. Operate instructions: ADD, AND, NOT 2. Data movement instructions: LD, LDI, LDR, LEA, ST, STR, STI 3. Control instructions: BR, JSR/JSRR, JMP, RET/RTI, TRAP Opcode Operand(s) 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 0 0 1 1 1 0 0 1 0 0 0 0 1 1 0

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

View Full Document
2 BME303 Intro. to Computing 3 Control Instruction Store number in R1 R1 + 1 Standard Sequential Program Halt ADD R1 to R2 Store number in R1 R1 + 1 R1 > 10? yes no Sequence is broken BME303 Intro. to Computing 4 Condition Codes 3 single-bit registers, NZP (each: set to 1 or cleared to 0) N : value written was negative (NZP=100) Z : value written was zero (NZP=010) P : value written was positive (NZP=001) Affected each time any register is written Can two registers be written at once? Condition codes are read/used by conditional branch instructions
3 BME303 Intro. to Computing 5 Condition Codes • What is the value of NZP for the following instructions? Assume R1 = x0002 – 0001 010 001 1 0 0010 – 0001 011 001 1 1 1100 – 0001 100 001 0 00 011 BME303 Intro. to Computing 6 Condition Codes • What is the value of NZP for the following instructions? Assume R1 = x0002 – 0001 010 001 1 0 0010 (ADD R2 R1 #2) – 0001 011 001 1 1 1100 (ADD R3 R1 #-4) – 0001 100 001 0 00 011 (ADD R4 R1 R3)

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

View Full Document
4 BME303 Intro. to Computing 7 Condition Codes • Using only one LC-3 instruction and without changing the contents of any register, how might you set the condition codes based on the value of R1? BME303 Intro. to Computing 8 Control Instruction Store number in R1 R1 + 1 Standard Sequential Program Halt ADD R1 to R2 Store number in R1 R1 + 1 R1 > 10? yes no Sequence is broken
5 BME303 Intro. to Computing 9 Control Instructions Used to alter the sequence of instructions (by changing PC) Conditional Branch – 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

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

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

Page1 / 13

BME303_lecture10 - BME303 Intro to Computing Chapter 5 The...

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

View Full Document
Ask a homework question - tutors are online