Representation of Data - Instructions Start of the lesson: Open this PowerPoint from the A451 page – Representation of Data/ Instructions How confident.

Slides:



Advertisements
Similar presentations
Chapter 2: Data Manipulation
Advertisements

GCSE Computing Lesson 5.
compilers and interpreters
Dr. Ken Hoganson, © August 2014 Programming in R COURSE NOTES 2 Hoganson Language Translation.
 Suppose for a moment that you were asked to perform a task and were given the following list of instructions to perform:
ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Lecture 1: Overview of Computers & Programming
Programming Types of Testing.
Creating a Program In today’s lesson we will look at: what programming is different types of programs how we create a program installing an IDE to get.
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.
CSE115: Introduction to Computer Science I
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall 1.
Lecture 2: Do you speak Java?. From Problem to Program Last Lecture we looked at modeling with objects! Steps to solving a business problem –Investigate.
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.
Chapter 2: Impact of Machine Architectures What is the Relationship Between Programs, Programming Languages, and Computers.
Lecture 2: Do you speak Java?. From Problem to Program Last Lecture we looked at modeling with objects! Steps to solving a business problem –Investigate.
Compilers and Interpreters. Translation to machine language Every high level language needs to be translated to machine code There are different ways.
Introduction to Computers and Programming. Some definitions Algorithm: Algorithm: A procedure for solving a problem A procedure for solving a problem.
The CPU The Central Presentation Unit Language Levels Fetch execute cycle Processor speed.
CEN 226: Computer Organization & Assembly Language :CSC 225 (Lec#1) By Dr. Syed Noman.
Activity 1 - WBs 5 mins Go online and spend a moment trying to find out the difference between: HIGH LEVEL programming languages and LOW LEVEL programming.
CHAPTER 4: INTRODUCTION TO COMPUTER ORGANIZATION AND PROGRAMMING DESIGN Lec. Ghader Kurdi.
Computer Organization
Topics Introduction Hardware and Software How Computers Store Data
Levels of Architecture & Language CHAPTER 1 © copyright Bobby Hoggard / material may not be redistributed without permission.
IT253: Computer Organization Lecture 4: Instruction Set Architecture Tonga Institute of Higher Education.
What is a Computer? An, electrical machine, that can be programmed to accept data (input), process it into useful information (output) and store it away.
Chapter 1 What is Programming? Lecture Slides to Accompany An Introduction to Computer Science Using Java (2nd Edition) by S.N. Kamin, D. Mickunas, E.
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
The Central Processing Unit (CPU) and the Machine Cycle.
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.
CMSC 150 PROGRAM EXECUTION CS 150: Wed 1 Feb 2012.
D75P 34 – HNC Computer Architecture
1 3. Computing System Fundamentals 3.1 Language Translators.
Stored Programs In today’s lesson, we will look at: what we mean by a stored program computer how computers store and run programs what we mean by the.
© 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.
1.4 Representation of data in computer systems Instructions.
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall
Dale & Lewis Chapter 5 Computing components
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.
Compilers and Interpreters
Representation of Data Binary Representation of Instructions teachwithict.weebly.com.
Introduction to computer software. Programming the computer Program, is a sequence of instructions, written to perform a specified task on a computer.
Computer Systems Nat 5 Computing Science
Software Development Environment
Why don’t programmers have to program in machine code?
Component 1.6.
Machine and Assembly Language
Computer Systems Nat 5 Computing Science
ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Data Representation – Instructions
TRANSLATORS AND IDEs Key Revision Points.
CSCE Fall 2013 Prof. Jennifer L. Welch.
Lesson Objectives Aims Key Words Compiler, interpreter, assembler
Instruction encoding We’ve already seen some important aspects of processor design. A datapath contains an ALU, registers and memory. Programmers and compilers.
Computer Architecture and the Fetch-Execute Cycle
MARIE: An Introduction to a Simple Computer
CSCE Fall 2012 Prof. Jennifer L. Welch.
ICT Programming Lesson 1:
1.3.7 High- and low-level languages and their translators
Programming language translators
Presentation transcript:

Representation of Data - Instructions Start of the lesson: Open this PowerPoint from the A451 page – Representation of Data/ Instructions How confident do you feel in: (p) (q)

Quick revision – what is a computer system?

Quick revision CPU? RAM program executed address data decoded logic ? ? ?

Computer Source Code As human beings we find it easier to read and write computer programs if they are written in a language similar to the one we use in everyday life ie English SOURCE CODE IF count < 10 Display “Enter number” accept number END IF

Machine Code However computers only understand binary ie machine code Therefore the source code we write must be converted to machine code MACHINE CODE SOURCE CODE IF count < 10 Display “Enter number” accept number END IF

Turning Source Code into Machine Code Programming languages that are very similar to “human” languages are called high-level languages Examples: COBOL, Python, C++, Java Usually computer programmes in these languages, once written, are compiled into machine code and saved as executables ready for use. This is performed by a compiler. For some languages, however, the source code is converted on the fly as each instruction needs to be performed. This is performed by an interpreter. Programming languages that are very similar to machine code already are called low-level languages Example: Assembly language Assembly language is converted to machine code by an assembler.

High level programming language Low level programming language Machine Code Easier to read for a human Easier for the computer to process Drag and drop so the diagram makes sense. Add examples too!

Compiler Interpreter Converts high level code into a machine code based executable file. Creates an executable file that is normally machine specific (PC/Mac/Linux/iOS/Android) Example: Java Virtual Machine Example: creating an executable file using Python to run on a PC Each line of code is processed and converted to machine code in real time (‘on the fly’) Allows high level coding to be run on a variety of platforms

Little Man Computer

BBC Revise Wise hv/revision hv/revision Read though the revision guide and complete the test.

Cambridge Mooc esentation-of-data-in-computer-systems-main esentation-of-data-in-computer-systems-main 39 Instructions – complete the test and Activity 1

Instructions in Machine Code In machine code the instructions are usually made up of 2 parts, an operation code and a memory address. Example: 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 with some stored data. 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. The set of instructions for a CPU is know as the Instruction Set.

Instructions and Memory 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.

The Von Neumann Architecture In computers based upon the Von Neumann Architecture, all program instructions are stored in memory, the same as the data is. The CPU cannot therefore distinguish between instructions and data just by reading the contents of memory since they are both just bit patterns.

How does the computer distinguish between instructions and data? etc Memory addresses Instruction (Op code + memory address) Data The program pointer will point to the memory address of the first instruction eg As the CPU performs the Fetch-Decode-Execute cycle: the contents of the memory address obtained by the Fetch will be treated as an Instruction during the Execute stage the memory address referred to by the instruction will be treated as data and data will either placed copied from it or saved to it Sometimes the CPU will Fetch a value that is really data and not an instruction, usually because the memory address has been overwritten. This will cause an error.

Finally… How confident are you feeling now? Let’s quickly revisit our definition of software..