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

Slides:



Advertisements
Similar presentations
Chapter 5 The LC-3.
Advertisements

Microprocessors.
Chapter 7 Introduction to LC-3 Assembly Language Assembly Language Assembly Process Using the Editor & Simulator for Assembly Language Programming.
REGISTER TRANSFER LANGUAGE (RTL)
PART 6 Programming 1.Decomposition 2.Three Constructs 3.Counting Example 4.Debugging.
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.
Introduction to Computing Systems from bits & gates to C & beyond Chapter 7 LC-2 Assembly Language.
The LC-3 – Chapter 7 COMP 2620 Dr. James Money COMP
2.3) Example of program execution 1. instruction  B25 8 Op-code B means to change the value of the program counter if the contents of the indicated register.
The LC-3 – Chapter 6 COMP 2620 Dr. James Money COMP
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.
Chapter 5 The LC-3 LC-3 Computer Architecture Memory Map
Chapter 6 Programming in Machine Language The LC-3 Simulator
Computer Hardware What goes on inside?. Deeper.
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
Chapter 4 H1 Assembly Language: Part 2. Direct instruction Contains the absolute address of the memory location it accesses. ld instruction:
Dale & Lewis Chapter 5 Computing components. Let’s design a computer Generic CPU with registers −Program counter (PC) – 5 bits (size of addresses) −Instruction.
Chapters 4 & 5: LC-3 Computer Architecture Machine Instructions Assembly language Programming in Machine and Assembly Language.
Part II: Addressing Modes
Computer Science 210 Computer Organization The Instruction Execution Cycle.
Introduction to Computing Systems from bits & gates to C & beyond Chapter 4 The Von Neumann Model Basic components Instruction processing.
The von Neumann Model – Chapter 4
Introduction to Computer Engineering ECE/CS 252, Fall 2010 Prof. Mikko Lipasti Department of Electrical and Computer Engineering University of Wisconsin.
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.
Computer Science 101 Computer Systems Organization ALU, Control Unit, Instruction Set.
Represents different voltage levels High: 5 Volts Low: 0 Volts At this raw level a digital computer is instructed to carry out instructions.
The von Neumann Model – Chapter 4 COMP 2620 Dr. James Money COMP
Chapter 6 Programming. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 6-2 Solving Problems using a Computer.
The LC-3 – Chapter 5 COMP 2620 Dr. James Money COMP
The LC-3 – Chapter 5 COMP 2620 Dr. James Money COMP
Chapter 6 Programming l Problem solving l Debugging.
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.
Compsci 210 Tutorial Five.
Computer Science 210 Computer Organization
Chapter 4 The Von Neumann Model
Computer Science 210 Computer Organization
Computer Science 210 Computer Organization
Chapter 5 The LC-3.
The Processor and Machine Language
Computer Science 210 Computer Organization
Chapter 7 LC-2 Assembly Language.
Computer Science 210 Computer Organization
Chapter 6 Programming.
Computer Science 210 Computer Organization
Topic 6 LC-3.
Computer Science 210 Computer Organization
Chapter 7 LC-2 Assembly Language.
Introduction to Computer Engineering
Sequencing, Selection, and Loops in Machine Language
Computer Science 210 Computer Organization
Computer Science 210 Computer Organization
Introduction to Computer Engineering
The Stored Program Computer
COSC121: Computer Systems
Introduction to Computer Engineering
Introduction to Computer Engineering
Introduction to Computer Engineering
Introduction to Computer Engineering
Chapter 6 Programming.
Presentation transcript:

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

Example 1: Multiplying In this example, we consider a program that should multiply two numbers that are non- negative This is needed since the LC-3 does not have a multiply instruction The numbers are in R4 and R5 and the result should be stored in R2

Example 1: Multiplying x x x x x clear R2 add R4 to R2 decrement R5 R5 = 0? HALT No Yes Set R4 = 10, R5 =3. Run program. Result: R2 = 40, not 30.

PCR2R4R5 x x x x x x x x x x x x x x PC and registers at the beginning of each instruction PCR2R4R5 x x x x Single-stepping Breakpoint at branch (x3203) Executing loop one time too many. Branch at x3203 should be based on Z bit only, not Z and P. Should stop looping here!

Example 2: Summing In this example, we want to sum an array of numbers The numbers start at location 0x3100 There are 10 numbers The result should be in R1 when the module finishes

Example 2: Summing R4 = 0? HALT No Yes R1 = 0 R4 = 10 R2 = x3100 R1 = R1 + M[R2] R2 = R2 + 1 R4 = R4 - 1 x x x x x x x x x x

Example 2: Summing Running the data below yields R1 = x0024, but the sum should be x8135. What happened? AddressContents x3100x3107 x3101x2819 x3102x0110 x3103x0310 x3104x0110 x3105x1110 x3106x11B1 x3107x0019 x3108x0007 x3109x0004 PCR1R2R4 x x x x x30040x Start single-stepping program... Should be x3100! Loading contents of M[x3100], not address. Change opcode of x3003 from 0010 (LD) to 1110 (LEA).