INTRODUCTION Programming – process of composing several instructions to perform certain tasks. Program – product of programming which contains several.

Slides:



Advertisements
Similar presentations
LC-3 Computer LC-3 Instructions
Advertisements

Execution of an instruction
TK2633: MICROPROCESSOR & INTERFACING
Computer ArchitectureFall 2007 © October 3rd, 2007 Majd F. Sakr CS-447– Computer Architecture.
Chapter 7 Low-Level Programming Languages. 2 Chapter Goals List the operations that a computer can perform Discuss the relationship between levels of.
Overview The von Neumann Machine - the programmable digital computer Introducing the LC-3 Computer - A “toy” computer for us to learn from Computer machine.
Chapters 5 - The LC-3 LC-3 Computer Architecture Memory Map
State Machines Used to Design Sequential Circuits.
Chapters 4 & 5: LC-3 Computer Architecture Machine Instructions Assembly language Programming in Machine and Assembly Language.
Chapter 11 Instruction Sets: Addressing Modes and Formats HW: 11.4, 5, 13, 16 (Due 11/15)
Part II: Addressing Modes
Assembly & Machine Languages
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.
Basic Operational Concepts of a Computer
An Introduction Chapter Chapter 1 Introduction2 Computer Systems  Programmable machines  Hardware + Software (program) HardwareProgram.
Lecture 3. Diff b/w RAM and Registers Registers are used to hold data immediately applicable to the operation at hand Registers are used to hold data.
Programmer's view on Computer Architecture by Istvan Haller.
Chapter 1 An Introduction to Processor Design 부산대학교 컴퓨터공학과.
Chapter 4 - Implementing Standard Program Structures in 8086 Assembly Language from Microprocessors and Interfacing by Douglas Hall.
CPU Design. Introduction – The CPU must perform three main tasks: Communication with memory – Fetching Instructions – Fetching and storing data Interpretation.
Execution of an instruction
Module : Algorithmic state machines. Machine language Machine language is built up from discrete statements or instructions. On the processing architecture,
The 8051 Microcontroller and Embedded Systems
9/20/6Lecture 2 - Prog Model Architecture, Data Types and Addressing Modes.
UConn CSE CSE241: Instruction Level Architecture Base CPU/Memory Architecture Registers Fetch-Execute Cycle Instructions Addressing Modes.
Von Neumann Model Computer Organization I 1 September 2009 © McQuain, Feng & Ribbens The Stored Program Computer 1945: John von Neumann –
JUMP, LOOP, AND CALL INSTRUCTIONS
Elements of Datapath for the fetch and increment The first element we need: a memory unit to store the instructions of a program and supply instructions.
Computer Organization Instructions Language of The Computer (MIPS) 2.
Chapter 2 Data Manipulation © 2007 Pearson Addison-Wesley. All rights reserved.
ECE 511: Digital System & Microprocessor
F453 Module 8: Low Level Languages 8.1: Use of Computer Architecture.
1 Contents: 3.1 Instruction format and Addressing Modes 3.2 Instruction Introduction Chapter 3 Instruction system.
Instruction sets : Addressing modes and Formats
Addressing Modes the addressing mode defines how data is accessed
Addressing Modes in Microprocessors
Immediate Addressing Mode
MIPS Instruction Set Advantages
Chapter 4 The Von Neumann Model
Chapter 4 The Von Neumann Model
Addressing Modes Immediate #<data> or Imm
Microcomputer Programming
Introduction to Computer Engineering
Instruction Format MIPS Instruction Set.
Chapter 4 The Von Neumann Model
Computer Science 210 Computer Organization
Design of the Control Unit for Single-Cycle Instruction Execution
EECE-276 Fall 2003 Microprocessors & Microcontrollers II
SCHOOL OF ELECTRONICS ENGINEERING Electronics and Communication
Computer Science 210 Computer Organization
Design of the Control Unit for One-cycle Instruction Execution
Topic 6 LC-3.
Computer Architecture and the Fetch-Execute Cycle
Under Address Modes Source: under
68000 Architecture, Data Types and Addressing Modes
Introduction to Micro Controllers & Embedded System Design
Computer Instructions
COMS 361 Computer Organization
Mastering Memory Modes
Instruction Format MIPS Instruction Set.
Instruction Set Principles
The Stored Program Computer
Computer Concept and Practice
Basic components Instruction processing
Introduction to Computer Engineering
Introduction to Computer Engineering
Introduction to Computer Engineering
Introduction to Computer Engineering
Chapter 4 The Von Neumann Model
Presentation transcript:

INTRODUCTION Programming – process of composing several instructions to perform certain tasks. Program – product of programming which contains several instructions. Skills of programming / structure of programming implementation: ▫Essential and best instructions to perform a certain task. ▫How instructions organized in subprogram (subroutine) so it can be reused as many times as possible. ▫Used minimum lines of instructions for maximum tasks. Addressing modes – procedure of fetching and sending data between source and destination.

ADDRESSING MODES MC68000 : 14 different addressing modes divided into 6 groups. By understanding the addressing modes, we have EA (effective address). EA will help us identifies the location of an operand.

REGISTER DIRECT ADDRESSING Dn – Data register direct addressing. (D1,D2,D3,D4,D5,D6,D7) An – Address register direct addressing. (A1,A2,A3,A4,A5,A6,A7) Fastest and most compact because no reference to memory.

ABSOLUTE DATA ADDRESING EA in memory. Ex : MOVE.L $1234,D4 Absolute short data: ▫16 bits address. ▫ – 007FFF FF FFFFFF Absolute long data: ▫24 bits address. ▫ – FFFFFF

PROGRAM COUNTER RELATIVE / RELATIVE Program counter relative with offset ▫EA = offset + value in PC = d16 + PC d16 will be sign-extends to 32 bits first

PROGRAM COUNTER RELATIVE / RELATIVE Program counter relative with index and offset ▫EA = index + offset + value in PC = Xn + d8 + value in PC Xn – data or address register d8 will be sign-extends to 32 bits first

REGISTER INDIRECT ADDRESSING Address register indirectly referred. 5 modes: ▫Address register indirect. ▫Postincrement address register indirect. ▫Predecrement address register indirect. ▫Address register indirect with offset. ▫Address register indirect with index and offset.

ADDRESS REGISTER INDIRECT

POSTINCREMENT ADDRESS REGISTER INDIRECT

PREDECREMENT ADDRESS REGISTER INDIRECT

ADDRESS REGISTER INDIRECT WITH OFFSET

ADDRESS REGISTER INDIRECT WITH INDEX AND OFFSET

IMMEDIATE DATA ADDRESSING

INCORRECT INSTRUCTIONS

CONCEPT OF PROGRAMMING Steps in program building: ▫Definition of problem. ▫Logical design. ▫Programming. ▫Documentation of the program. ▫Analysis the program. ▫Test run the program.

EXAMPLE Definition of problem: ▫Input data of two numbers. These two numbers are added. The product is stored in a memory location. Logical design – flow chart Programming model of the microprocessor (Figure 2.15 : Unit 2/38)

EXAMPLE (cont.) Programming.

EXAMPLE (cont.) Documentation of program.

EXAMPLE (cont.) Analysis the program

EXAMPLE (cont.) Analysis the program

EXAMPLE (cont.) Analysis the program Test run the program ▫ASM68K – assembler ▫SIM68K - simulator

IMPLEMENTATION STRUCTURE OF PROGRAMMING Effective programming is the know how to identify the best or optimum tools. (composition of instructions and selection of addressing modes) Good program is with the features of least instruction lines, least executions duration, easy alteration and modifications. Structure of programming: ▫Construct of sequential ▫Construct of loop ▫Construct of decision making by branch/jump ▫Construct of subroutine

CONSTRUCT OF SEQUENTIAL Basic, simple and straight forward. Execute one instruction after another. START Instruction-1 END Instruction-1 Instruction-n

CONSTRUCT OF LOOP Some instruction need to be repeated – loop construct. At the end of the program, assert an instruction to instruct the program execution to go back to the first instruction. Instruction-1 (a) Flow chart Instruction-2 Instruction-n START LOOP Instructions : JUMP LOOP  LOOP (b) Instructions

CONSTRUCT OF DECISION MAKING BY BRANCH/LOOP Another structure of loop construct where the program is allowed to decide whether to implement the loop or not.

CONSTRUCT OF SUBROUTINE To simplify a very long or complex program. Grouping several instructions that tend to be repeated. This subroutine need to be name for easy call.

CONSTRUCT OF SUBROUTINE