The LC-3 – Chapter 5 COMP 2620 Dr. James Money COMP 2620 1.

Slides:



Advertisements
Similar presentations
Chapter 5 The LC-3.
Advertisements

Chapter 7 Introduction to LC-3 Assembly Language Assembly Language Assembly Process Using the Editor & Simulator for Assembly Language Programming.
The LC-3 – Chapter 6 COMP 2620 Dr. James Money COMP
Chapter 5 The LC-3 Instruction Set Architecture l ISA Overview l Operate instructions l Data Movement instructions l Control Instructions l LC-3 data path.
The LC-3 – Chapter 7 COMP 2620 Dr. James Money COMP
CS25410 Memory Machine Code. Common types of non-rotating memory (1) RAMRandom Access Memory In reality, read/write memory This is usually volatile, meaning.
The LC-3 – Chapter 6 COMP 2620 Dr. James Money COMP
Chapter 5 The LC-3.
Chapter 4 - ISA 1.The Von Neumann Model. 4-2 The Stored Program Computer 1943: ENIAC Presper Eckert and John Mauchly -- first general electronic computer.
LC-3 Computer LC-3 Instructions
S. Barua – CPSC 240 CHAPTER 5 THE LC-3 Topics Memory organization Registers Instruction set Opcodes.
Overview The Operate Instructions - ADD, AND, NOT The Data Movement Instructions - Load, Load Address, Store Example Using Operate & Data Movement The.
Overview Program in LC-3 machine language Use the Editor
Some thoughts: If it is too good to be true, it isn’t. Success is temporary. It is hard work to make it simple. Knowing you did it right is enough reward.
Overview Review Trap Instruction Program in LC-3 machine language Use LC-3 Simulator.
LC-3 Instruction Set Architecture (Textbook’s Chapter 5)
Memory - Registers Instruction Sets
Chapter 5 The LC-3 LC-3 Computer Architecture Memory Map
Chapter 6 Programming in Machine Language The LC-3 Simulator
Chap 4 & 5 LC-3 Computer LC-3 Instructions Chap 4 Homework – due Monday October 27 Chap 5 Homework – due Wednesday October 29 Project 2 Designs (Working.
Choice for the rest of the semester New Plan –assembler and machine language –Operating systems Process scheduling Memory management File system Optimization.
Chapters 5 - The LC-3 LC-3 Computer Architecture Memory Map
LC-3 Instruction Set Architecture
Chapters 4 & 5: LC-3 Computer Architecture Machine Instructions Assembly language Programming in Machine and Assembly Language.
Overview von Neumann Model Components of a Computer Some Computer Organization Models The Computer Bus An Example Organization: The LC-3.
Computer Science 210 Computer Organization The Instruction Execution Cycle.
Chapter 5 The LC-3. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 5-2 Instruction Set Architecture ISA.
The von Neumann Model – Chapter 4 COMP 2620 Dr. James Money COMP
Spring 2007W. Rhett Davis with slight modification by Dean Brock UNCA ECE 406Slide 1 ECE 406 – Design of Complex Digital Systems Lecture 11: Memories,
Memory and Addressing How and Where Information is Stored.
Chapter 4 The Von Neumann Model
Introduction to Computing Systems from bits & gates to C & beyond Chapter 5 The LC-3 Instruction Set Architecture ISA Overview Operate instructions Data.
Chapter 5 The LC Instruction Set Architecture ISA = All of the programmer-visible components and operations of the computer memory organization.
Chapter 5 The LC-3. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 5-2 Data Movement Instructions Load --
Introduction to Computer Engineering ECE/CS 252, Fall 2010 Prof. Mikko Lipasti Department of Electrical and Computer Engineering University of Wisconsin.
The LC-3. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 5-2 Instruction Set Architecture ISA = All of the.
Execution of an instruction
Chapter 5 The LC Instruction Set Architecture ISA = All of the programmer-visible components and operations of the computer memory organization.
Computer Architecture CSE 3322 Lecture 3 Assignment: 2.4.1, 2.4.4, 2.6.1, , Due 2/3/09 Read 2.8.
The von Neumann Model – Chapter 4 COMP 2620 Dr. James Money COMP
© BYU LC3-DC Page 1 ECEn 224 LC3-DC Designing The LC-3 Control IR PC enaMARMenaPC enaALU enaMDR ALU AB.
The LC-3 – Chapter 5 COMP 2620 Dr. James Money COMP
Spring 20067W. Rhett Davis with minor modification by Dean Brock UNCA ECE 406Slide 1 ECE 406 Design of Complex Digital Systems Lecture 11: Data Converter,
Introduction to Computing Systems and Programming The LC-2.
The LC-3 – Chapter 5 COMP 2620 Dr. James Money COMP
The LC-3 – Chapter 5 COMP 2620 Dr. James Money COMP
Computer Science 210 Computer Organization Machine Language Instructions: Control.
Chapter 6 Programming Adapted from slides provided by McGraw-Hill Companies Inc., modified by professors at University of Wisconsin-Madison.
Chapter 4 The Von Neumann Model
Computer Science 210 Computer Organization
Conditional Branches What distinguishes a computer from a simple calculator is its ability to make decisions Decisions are made using the if statement,
Computer Science 210 Computer Organization
Chapter 5 The LC-3.
The LC-3 Instruction Set Architecture Data Movement instructions
The Processor and Machine Language
LC-3 Details and Examples
Computer Science 210 Computer Organization
Chapter 5 The LC-3.
Computer Science 210 Computer Organization
MIPS Instruction Encoding
Introduction to Computer Engineering
Passing Parameters Data passed to a subroutine is called a parameter.
MIPS Instruction Encoding
Computer Science 210 Computer Organization
Computer Science 210 Computer Organization
Computer Science 210 Computer Organization
Chapter 4 The Von Neumann Model
LC-2: The Little Computer 2
Chapter 5 The LC-3.
Presentation transcript:

The LC-3 – Chapter 5 COMP 2620 Dr. James Money COMP

Data Movement Instructions Recall that there are three types of instructions: – Operate instructions – Data movement instructions – Control instructions We consider the control instructions today

Control Instructions Recall that these types of instruction affect the flow of execution That is, they directly change the PC value depending on the result of the instruction We first consider a condition branch instruction

Conditional Branches Recall the LC-3 has three condition codes: – N – negative – Z – zero – P – positive These codes are set when an instruction write to a register Only one of these are set at a time

Conditional Branches The instructions that set these flags are – ADD – AND – NOT – LD – LDR – LDI – LEA

Conditional Branches The condition branch has opcode 0000 Bits [11:9] correspond to the N, Z, and P condition codes Bits [8:0] is the PC offset address for the branch Range of offset is -256…255 Target must be 256 bytes of the PC

Conditional Branches If the particular condition code is set in the processing unit(N,Z, or P) and it is selected by the instruction, then the jump if executed If the condition code is false, the jump do not occur This corresponds to an if (condition) ->jump else do nothing;

BR (PC-Relative) What happens if bits [11:9] are all zero? All one?

Task: Compute sum of 12 integers. Assume the numbers start at location 0x3100 Assume the program code starts at location 0x3000 Using Branch Instructions

Pseudocode: – addr= 0x3100 – valsleft = 12 – sum=0 – If (valsleft==0) end – Load value from memory[addr] – Sum=sum+value – valsleft=valsleft-1 – addr=addr+1

Using Branch Instructions R1  x3100 R3  0 R2  12 R2=0? R4  M[R1] R3  R3+R4 R1  R1+1 R2  R2-1 NO YES

AddressInstructionComments x R1  0x3100 (PC+0xFF) x R3  0 x R2  0 x R2  12 x If Z, goto 0x300A (PC+5) x Load next value to R4 x Add to R3 x Increment R1 (pointer) X Decrement R2 (counter) x Goto 0x3004 (PC-6)