1.4 Representation of data in computer systems Instructions.

Slides:



Advertisements
Similar presentations
Chapter 2: Data Manipulation
Advertisements

Computer Architecture and the Fetch-Execute Cycle
Stored Program Architecture
DAP teaching computer architecture at Berkeley since 1977
CPU Review and Programming Models CT101 – Computing Systems.
 Suppose for a moment that you were asked to perform a task and were given the following list of instructions to perform:
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.
© 2008 Wayne Wolf Overheads for Computers as Components 2nd ed. Instruction sets Computer architecture taxonomy. Assembly language. 1.
1 Lecture-2 CSIT-120 Spring 2001 Revision of Lecture-1 Introducing Computer Architecture The FOUR Main Elements Fetch-Execute Cycle A Look Under the Hood.
Room: E-3-31 Phone: Dr Masri Ayob TK 2123 COMPUTER ORGANISATION & ARCHITECTURE Lecture 5: CPU and Memory.
Computer Systems. Computer System Components Computer Networks.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design First Edition by Tony Gaddis.
CSCE 121, Sec 200, 507, 508 Fall 2010 Prof. Jennifer L. Welch.
1 Lecture-2 CS-120 Fall 2000 Revision of Lecture-1 Introducing Computer Architecture The FOUR Main Elements Fetch-Execute Cycle A Look Under the Hood.
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.
Elements of the Computer (How a processor works)
1 Sec (2.3) Program Execution. 2 In the CPU we have CU and ALU, in CU there are two special purpose registers: 1. Instruction Register 2. Program Counter.
CEG 320/520: Computer Organization and Assembly Language Programming1 CEG 320/520 Computer Organization and Assembly Language Programming.
Lecture 13 - Introduction to the Central Processing Unit (CPU)
Basic Operational Concepts of a Computer
CHAPTER 4: INTRODUCTION TO COMPUTER ORGANIZATION AND PROGRAMMING DESIGN Lec. Ghader Kurdi.
Computer Fundamentals Northern College Diploma Philip Bird.
Levels of Architecture & Language CHAPTER 1 © copyright Bobby Hoggard / material may not be redistributed without permission.
Information Representation: Machine Instructions
Computer Architecture and the Fetch-Execute Cycle
Computer Systems Organization CS 1428 Foundations of Computer Science.
GCSE Computing#BristolMet Session Objectives#11 MUST identify what program instructions consist of SHOULD describe how instructions are coded as bit patterns.
What have mr aldred’s dirty clothes got to do with the cpu
Computer Architecture and the Fetch-Execute Cycle
Computer Architecture and the Fetch-Execute Cycle
The CPU Central Processing Unit. 2 Reminder - how it fits together processor (CPU) memory I/O devices bus.
The Central Processing Unit (CPU) and the Machine Cycle.
4-1 Chapter 4 - The Instruction Set Architecture Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Principles.
CS 111 – Sept. 15 Chapter 2 – Manipulating data by performing instructions “What is going on in the CPU?” Commitment: –Please read through section 2.3.
CMSC 150 PROGRAM EXECUTION CS 150: Wed 1 Feb 2012.
Computer Hardware A computer is made of internal components Central Processor Unit Internal External and external components.
Chapter 7 Low-Level Programming Languages (slides modified by Erin Chambers)
Instructions. Portability In addition to making hardware backward compatible, we have also made software portable. In describing software, “portable”
Dale Roberts Department of Computer and Information Science, School of Science, IUPUI CSCI N305 Information Representation: Machine Instructions.
© GCSE Computing Candidates should be able to:  describe the characteristics of an assembler Slide 1.
Represents different voltage levels High: 5 Volts Low: 0 Volts At this raw level a digital computer is instructed to carry out instructions.
COMPILERS CLASS 22/7,23/7. Introduction Compiler: A Compiler is a program that can read a program in one language (Source) and translate it into an equivalent.
An Example Architecture. A Paper Computer - Woody Woody's characteristics Word size – 8 bits One word.
Dale & Lewis Chapter 5 Computing components
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.
CMSC 104, Lecture 061 Stored Programs A look at how programs are executed.
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.
Chapter 20 Computer Operations Computer Studies Today Chapter 20.
Representation of Data Binary Representation of Instructions teachwithict.weebly.com.
Computer Operation. Binary Codes CPU operates in binary codes Representation of values in binary codes Instructions to CPU in binary codes Addresses in.
Representation of Data - Instructions Start of the lesson: Open this PowerPoint from the A451 page – Representation of Data/ Instructions How confident.
Machine Language Computer languages cannot be directly interpreted by the computer – they are not in binary. All commands need to be translated into binary.
Edexcel GCSE Computer Science Topic 15 - The Processor (CPU)
Lesson Objectives A note about notes: Aims
פרק 2: חיווט, זיכרונות בנקים זוגיים ואי-זוגיים
Data Representation – Instructions
The fetch-execute cycle
CS149D Elements of Computer Science
Intro to Architecture & Organization
Computer Architecture and the Fetch-Execute Cycle
MARIE: An Introduction to a Simple Computer
MARIE: An Introduction to a Simple Computer
Program Execution.
Information Representation: Machine Instructions
Objectives Describe common CPU components and their function: ALU Arithmetic Logic Unit), CU (Control Unit), Cache Explain the function of the CPU as.
Instruction execution and ALU
Presentation transcript:

1.4 Representation of data in computer systems Instructions

How are program instructions coded? The CPU can only process instructions that are in machine code, a series of binary digits. This means all other programming languages have to be translated into machine code to actually be executed. In the case of high level languages this translation is carried out by a compiler and in the case of low level assembly language the translation is carried out by an assembler.machine codehigh level languagesassembly language In machine code the instructions are usually made up of 2 parts, an operation code and a memory address. The CPU uses the operation code (for example, the bit pattern 001 could be the code for ADD) to decide what action to take with the second part, which is usually a memory location holding stored data.

How are program instructions coded? The number of memory bits needed for each instruction (operation codes plus memory address) is important. If only 8 bits were used then 3 bits could be used for the operation codes leaving 5 for the location in memory where the data is stored. This would be very limiting as there could only be 8 possible operation codes and only memory addresses from to could be accessed. A particular CPU will be designed to process a particular set of machine code instructions and will know: How many bits are used for each instruction. How many of the instruction bits are used for the operation code (OP code) and how many for the memory address.

How are program instructions coded? The table below represents 9 memory address. Address holds an instruction (using 8 bits) and address holds some data. The CPU would follow the instruction and ADD the value in memory location to the accumulator. accumulator Memory address Memory contentsExplanation This memory address has an instruction stored in it, made up of: - the operator (in this case the code for ADD) - the memory address of the data to be added to the accumulator This memory address has data stored in it (in this case the number 21 stored in binary)

How does the computer distinguish between instructions and data? In the Von Neumann architecture used by most computers memory locations are used to store both program instructions and data. The CPU cannot therefore distinguish between instructions and data just by reading the contents of a memory address. However, when a program is actually running the CPU does distinguish between them, based on which part of the fetch-execute cycle the memory address is accessed.fetch-execute cycle In the fetch part of the cycle the contents of the memory address will be treated as an instruction and copied into the instruction register.instruction register In the execute part of the cycle the contents of the memory address will be treated as data, either being read into one of the general purpose registers such as the accumulator, or being written to with the contents of such a register.accumulator The CPU program counter should therefore always contain the memory location of an instruction. If the CPU is instead pointed to a memory address that contains data (either by mistake or because an instruction has somehow been overwritten by data) then the program would fail to run correctly because the CPU would try and interpret the data as an instruction.program counter