Chapter 7 Low-Level Programming Languages (slides modified by Erin Chambers)

Slides:



Advertisements
Similar presentations
Chapter 2: Data Manipulation
Advertisements

Low-Level Programming Languages and Pseudocode
Slide 4-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 4 Computer Organization.
 Suppose for a moment that you were asked to perform a task and were given the following list of instructions to perform:
Low-Level Programming Languages and Pseudocode Chapter 6.
Low-Level Programming Languages and Pseudocode Chapter 6.
1 A Balanced Introduction to Computer Science, 2/E David Reed, Creighton University ©2008 Pearson Prentice Hall ISBN Chapter 14 Inside.
Chapter 3 Assembly Language: Part 1. Machine language program (in hex notation) from Chapter 2.
TK 2633 Microprocessor & Interfacing Lecture 3: Introduction to 8085 Assembly Language Programming (2) 1 Prepared By: Associate Prof. Dr Masri Ayob.
Low-Level Programming Languages
Room: E-3-31 Phone: Dr Masri Ayob TK 2633 Microprocessor & Interfacing Lecture 1: Introduction to 8085 Assembly Language.
Chapter 7 Low-Level Programming Languages. 2 Chapter Goals List the operations that a computer can perform Discuss the relationship between levels of.
Chapter 7 Low-Level Programming Languages Nell Dale John Lewis.
Basic Computer Organization, CPU L1 Prof. Sin-Min Lee Department of Computer Science.
Chapter 2: Impact of Machine Architectures What is the Relationship Between Programs, Programming Languages, and Computers.
EET 2261 Unit 2 HCS12 Architecture
Computer Architecture
Assembly & Machine Languages
Computer Science 210 Computer Organization The Instruction Execution Cycle.
Low-Level Programming Languages and Pseudocode
University of Texas Pan AmDr. John P. Abraham Information Technology Computer Architecture Dr. John P. Abraham.
Topics Introduction Hardware and Software How Computers Store Data
CPS120: Introduction to Computer Science
Quiz # 2 Chapters 4, 5, & 6.
4-1 Chapter 4 - The Instruction Set Architecture Computer Architecture and Organization by M. Murdocca and V. Heuring © 2007 M. Murdocca and V. Heuring.
Instruction Set Architecture
GCSE Computing#BristolMet Session Objectives#11 MUST identify what program instructions consist of SHOULD describe how instructions are coded as bit patterns.
Chapter 4 MARIE: An Introduction to a Simple Computer.
Execution of an instruction
Module : Algorithmic state machines. Machine language Machine language is built up from discrete statements or instructions. On the processing architecture,
Computer Operations A computer is a programmable electronic device that can store, retrieve, and process data Data and instructions to manipulate the data.
Chapter 7 Low-Level Programming Languages. 2 Chapter Goals List the operations that a computer can perform Discuss the relationship between levels of.
Chapter 7 Low-Level Programming Languages. 2 Chapter Goals List the operations that a computer can perform Discuss the relationship between levels of.
Indira Gandhi National Open University presents. A Video Lecture Course: Computer Platforms.
DH2T 34 – HNC Computer Architecture 1 Lecture 14 The Fetch-Decode-Execute Cycle [1]. © C Nyssen/Aberdeen College 2003 All images © C Nyssen/Aberdeen College.
Fetch-execute cycle.
Chapter 7 Low-Level Programming Languages. 2 Features in Pep/7 Figure 7.1 Pep/7’s architecture.
CMSC 150 PROGRAM EXECUTION CS 150: Wed 1 Feb 2012.
Chapter 7 Low-Level Programming Languages Nell Dale John Lewis.
Represents different voltage levels High: 5 Volts Low: 0 Volts At this raw level a digital computer is instructed to carry out instructions.
1.4 Representation of data in computer systems Instructions.
Chapter 7 Low-Level Programming Languages Nell Dale John Lewis.
Dale & Lewis Chapter 5 Computing components
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
1 The Instruction Set Architecture September 27 th, 2007 By: Corbin Johnson CS 146.
Question What technology differentiates the different stages a computer had gone through from generation 1 to present?
Simple ALU How to perform this C language integer operation in the computer C=A+B; ? The arithmetic/logic unit (ALU) of a processor performs integer arithmetic.
Computer Organization Instructions Language of The Computer (MIPS) 2.
Chapter 2 Data Manipulation © 2007 Pearson Addison-Wesley. All rights reserved.
Chapter 2 Data Manipulation © 2007 Pearson Addison-Wesley. All rights reserved.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
Low-Level Programming Languages, Pseudocode and Testing Chapter 6.
Computer Architecture. Instruction Set “The collection of different instructions that the processor can execute it”. Usually represented by assembly codes,
Control Unit Lecture 6.
Chapter 4 The Von Neumann Model
The Processor and Machine Language
Introduction to Assembly Language
Figure 8.1 Architecture of a Simple Computer System.
Processor Organization and Architecture
MARIE: An Introduction to a Simple Computer
Figure 8.1 Architecture of a Simple Computer System.
Topics Introduction Hardware and Software How Computers Store Data
Low Level Programming Languages
MARIE: An Introduction to a Simple Computer
Chapter 4: Representing instructions
CPU has 6 special locations called registers
Program Execution.
The Von Neumann Machine
Chapter 4 The Von Neumann Model
Presentation transcript:

Chapter 7 Low-Level Programming Languages (slides modified by Erin Chambers)

2 Computer Operations Computer A programmable electronic device that can store, retrieve, and process data Data and instructions to manipulate the data are all binary numbers and can be stored in the same place –Recall: this is called the von Neumann architecture

3 Machine Language Machine language The language made up of binary coded instructions built into the hardware of a particular computer and used directly by the computer Why would anyone choose to use machine language? (Hint: they had no choice. Why?)

4 Machine Language Characteristics of machine language: –Every processor type has its own set of specific machine instructions –The relationship between the processor and the instructions it can carry out is completely integrated –Each machine-language instruction does only one very low-level task

5 Pep/7: A Virtual Computer Virtual computer A hypothetical machine designed to contain the important features of a real computer that we want to illustrate Pep/7 A virtual computer designed by Stanley Warford that has 32 machine-language instructions No; we are not going to cover all of them!

6 Features in Pep/7 Figure 7.1 Pep/7’s architecture

7 Features in Pep/7 Pep/7 Registers/Status Bits Covered –The program counter (PC) (contains the address of the next instruction to be executed) –The instruction register (IR) (contains a copy of the instruction being executed)

8 More Features Pep/7 Registers/Status Bits Covered –The accumulator (A register) –Status bit N (1 if A register is negative; 0 otherwise) –Status bit Z (1 if the A register is 0; and 0 otherwise) The memory unit is made up of 4,096 bytes

9 Instruction Format Figure 7.2 The Pep/7 instruction format

10 Instruction Format Operation code –Specifies which instruction is to be carried out Register specifier –Specifies which register is to be used (only use A in this chapter) Addressing-mode specifier –Says how to interpret the operand part of the instruction

11 The Addressing Mode Specifier Figure 7.3 Difference between immediate-mode and direct-mode addressing

12 Instruction Format Is there something we are not telling you about the addressing mode specifier? How can you tell?

13 Some Sample Instructions Figure 7.3 Subset of Pep/7 instructions

14 Sample Instructions What do these instructions mean?

15 Sample Instructions What do these instructions mean?

16 Sample Instructions What do these instructions mean?

17 Sample Instructions What do these instructions mean?

18 Algorithms Write "Hello" Write "Hell" Write "H" Write "e" Write "l" Write "o" Are we concrete yet?

19 Algorithms Is this concrete enough? How can we explicitly tell the computer to print, and what to print? Write "Hell" Write "H" Write "e" Write "l" Write "o"

20 How to print: We use opcodes to tell the computer that it needs to print Now how do we tell it what to print?

21 What to print: remember ASCII? To print 'H', we need to look up ACSII code for H (and other letters) Then, write that code in binary as our operand

22 A Program Example

23 Hand Simulation What is the fetch/execute cycle? How much is the PC incremented?

24 Fetch/Execute Cycle Fetch the next instruction –How long is instruction here? Decode the instruction –Look up in table Get data if needed –If code is '01', then need to get value from memory location Execute the instruction

25 Hand Simulation What is the fetch/execute cycle here?

26 Hand Simulation What is the fetch/execute cycle here?

27 Pep/7 Simulator Pep7/Simulator A program that behaves just like the Pep/7 virtual machine behaves To run a program Enter the hexadecimal code, byte by byte with blanks between each

28 Assembly Language Assembly language A language that uses mnemonic codes to represent machine-language instructions Assembler A program that reads each of the instructions in mnemonic form and translates it into the machine-language equivalent

29 Pep/7 Assembly Language Remember the difference between immediate and direct addressing? i : immediate d: direct

30 Pep/7 Assembly Language What is the difference between operations and pseudo operations?

31 Assembly Process

32 A New Program Reading and adding three numbers Set sum to 0 Read num1 Add num1 to sum Read num2 Add num2 to sum Read num3 Addnum3 to sum Write sum Are we concrete yet?

33 Our Completed Program

34 Decision Making Remember the status bits A and Z?

35 Decision Making … Add num3 to sum If sum is negative Write "Error" Else Write sum Write "Error" if sum is negative. Are we concrete yet?

36 Decision Making Add num3 to sum If status bit N is 1 Go to NegMsg Write sum Quit: STOP NegMsg: Write the message and go to Quit Are we concrete yet?

37 Decision Making Read limit Set sum to 0 While (limit is not zero) Read number Set sum to sum + number Set limit to limit - 1 Are we concrete yet?

38 Decision Making Set the accumulator to limit Subtract one from the accumulator Compare accumulator to zero If status bit Z is 1 go to Quit Else go to Read Are we concrete yet?

39 Decision Making

40 Testing Test plan A document that specifies how many times and with what data the program must be run in order to thoroughly test it Code coverage An approach that designs test cases by looking at the code Data coverage An approach that designs test cases by looking at the allowable data values