CompSci 100 23.1 A Peek at the Lower Levels  It is good to have a sense of what happens at the hardware level  Not required for this course  It may.

Slides:



Advertisements
Similar presentations
Computer Architecture and the Fetch-Execute Cycle
Advertisements

Stored Program Architecture
Chapter 2 Machine Language.
 Suppose for a moment that you were asked to perform a task and were given the following list of instructions to perform:
Computer Organization and Architecture
The Little man computer
The CPU Revision Typical machine code instructions Using op-codes and operands Symbolic addressing. Conditional and unconditional branches.
Snick  snack A Working Computer Slides based on work by Bob Woodham and others.
Processor Technology and Architecture
1 ICS 51 Introductory Computer Organization Fall 2006 updated: Oct. 2, 2006.
Low-Level Programming Languages
Stored Program Concept: The Hardware View
Chapter 7 Low-Level Programming Languages. 2 Chapter Goals List the operations that a computer can perform Discuss the relationship between levels of.
Chapter 4 Processor Technology and Architecture. Chapter goals Describe CPU instruction and execution cycles Explain how primitive CPU instructions are.
Recap – Our First Computer WR System Bus 8 ALU Carry output A B S C OUT F 8 8 To registers’ input/output and clock inputs Sequence of control signal combinations.
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.
The CPU The Central Presentation Unit Language Levels Fetch execute cycle Processor speed.
An Introduction Chapter Chapter 1 Introduction2 Computer Systems  Programmable machines  Hardware + Software (program) HardwareProgram.
1 Machine Language Alex Ostrovsky. 2 Introduction Hierarchy of computer languages: 1. Application-Specific Language (Matlab compiler) 2. High-Level Programming.
IT253: Computer Organization Lecture 4: Instruction Set Architecture Tonga Institute of Higher Education.
Cosc 2150: Computer Organization
Computer Systems Organization CS 1428 Foundations of Computer Science.
CPS Today’s topics Machine Architecture More Low-level Programming Upcoming Language Translation ( G.I. Chapter 9) Reading Great Ideas, Chapters.
Microcode Source: Digital Computer Electronics (Malvino and Brown)
The CPU Central Processing Unit. 2 Reminder - how it fits together processor (CPU) memory I/O devices bus.
Chapter 4 MARIE: An Introduction to a Simple Computer.
The Central Processing Unit (CPU) and the Machine Cycle.
Execution of an instruction
Lecture 14 Today’s topics MARIE Architecture Registers Buses
Computer Operations A computer is a programmable electronic device that can store, retrieve, and process data Data and instructions to manipulate the data.
PHY 201 (Blum)1 Microcode Source: Digital Computer Electronics (Malvino and Brown)
1 Ethics of Computing MONT 113G, Spring 2012 Session 7 Computer Architecture The Internet.
Computer Architecture Memory, Math and Logic. Basic Building Blocks Seen: – Memory – Logic & Math.
1 Text Reference: Warford. 2 Computer Architecture: The design of those aspects of a computer which are visible to the programmer. Architecture Organization.
Computer Hardware A computer is made of internal components Central Processor Unit Internal External and external components.
Computer Architecture 2 nd year (computer and Information Sc.)
© 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.
1.4 Representation of data in computer systems Instructions.
Processor Structure and Function Chapter8:. CPU Structure  CPU must:  Fetch instructions –Read instruction from memory  Interpret instructions –Instruction.
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.
CompSci Today’s topics Machine Architecture The basic machine Basic programming Assembler programming Upcoming Language Translation Reading Great.
CMSC 104, Lecture 061 Stored Programs A look at how programs are executed.
CSIT 301 (Blum)1 Instructions at the Lowest Level Some of this material can be found in Chapter 3 of Computer Architecture (Carter)
1 Basic Processor Architecture. 2 Building Blocks of Processor Systems CPU.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
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.
Week 6 Dr. Muhammad Ayaz Intro. to Assembly Language.
F453 Module 8: Low Level Languages 8.1: Use of Computer Architecture.
The Little man computer
Operating System Interface between a user and the computer hardware
Control Unit Lecture 6.
COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE
Computer Architecture
The Processor and Machine Language
Introduction to Assembly Language
MARIE: An Introduction to a Simple Computer
William Stallings Computer Organization and Architecture 8th Edition
Processor Fundamentals
MARIE: An Introduction to a Simple Computer
MARIE: An Introduction to a Simple Computer
Program Execution.
Objectives Describe common CPU components and their function: ALU Arithmetic Logic Unit), CU (Control Unit), Cache Explain the function of the CPU as.
Computer Architecture Assembly Language
Presentation transcript:

CompSci A Peek at the Lower Levels  It is good to have a sense of what happens at the hardware level  Not required for this course  It may give some insights  Will use a caricature of a real machine to cover the basic ideas  Will look at machine and assembler programs

CompSci Computer Architecture  Definition of computer architecture  The programmer’s view of the computer hardware  Hardware – Software Boundary  Not well defined  Much hardware is programmed  Some hardware instantiates programming steps  An imbedded program that cannot be changed could be called hardware  Firmware  Sometimes used to describe programming that is seldom changed  Typically stored in read-only memory (cannot change)

CompSci Basic Computer  Extremely Primitive  Cannot understand any Java or English-like commands  There is no command to carry out the while statement  Make up in speed what it gives up in complexity  Use a translator to transform program to machine’s native language  Called compiler  High-level language like Java called the source language  Target language is called machine language  Machine language is what the hardware responds to

CompSci Machine Language  Machine language is the most primitive  Everything represented by numbers  At hardware level, numbers are in binary  Numbers represent instructions (code)  AND Numbers represent data  Context of use decides whether number is data or instruction  In practice, seldom program in machine language  Use a language, very close to machine language called Assembler Language  Symbolic in nature (as opposed to numeric)  Each instruction number has a mnemonic  E.g., 12 is ADD  Locations also given names (sometimes variable name)

CompSci Architectural Features  Memory  Central Processing Unit (CPU) seen as set of Registers IP: Instruction pointer IR: Instruction Register AX: Arithmetic Register/Accumulator CF: Condition Flag

CompSci Simple Program  Show in assembler rather than machine language copyax, x addax, y copyz, ax  Implements z = x + y;  Remember, really ALL NUMBERS  Could be:  If copy -into = 20, add = 12, and copy -out = 21 and x is stored in 101, y in 102, and z in 103

CompSci Fetch - Execute Cycle  Clock systematically leads machine cycle thru steps  FETCH  Get instruction from memory o IP register (also called program counter or PC) says where from  Increment IP (to point to next instruction)  EXECUTE  Decode instruction o Figure out what is wanted (add?, copy? …) o Extract memory address from instruction o If needed, get info from memory  Carry out instruction o I.e., add info to Accumulator (AX)

CompSci More Instructions  copy and add  Implicit right to left movement  Most instructions involve accumulator (AX)  in and out  Like getText and setText methods for TextFields in Java  in goes from keyboard to AX  out goes from AX to screen  Go through another example -- program to perform: { x = a.getInt(); y = b.getInt(); z = (x + y); c.setInt(z); }

CompSci sum.as 0 in ax 1 copy x, ax 2 in ax 3 copy y, ax 4 copy ax, x 5 add ax, y 6 copy z, ax 7copy ax, z 8 out ax 20x 0 21y 0 23z 0 Sample I/O: <23 <16 >39

CompSci More Instructions  Need to handle Java if and while instructions  Use cmp instruction  Compares values in AX and memory location  Sets carry flag (CF) to oB below (AX less than memory) or oNB not below (AX greater or equal to memory)  Use jump instructions to take advantage of this new info  jnb instruction jumps to new location if CF set to NB  jb instruction jump to new location if CF set to B  jmp always jumps, regardless of CF state  Can now implement code involving if

CompSci largest.as Program to write out the larger of two numbers read in: in ax copy r, ax in ax copy s, ax copy ax, s cmp ax, r jnb there copy ax, r out ax jmp quit there copy ax, s out ax quit halt r 0 s 0 Sample I/O: 44

CompSci Tracing  Tracing is often the only way to figure out assembler programs  Number your statements (for reference) o Can also use actual memory addresses if known  Set up column heading for variables (memory) expected to change  Step through the program o You play to role of computer o Use notes and/or extra columns to keep track of  Input and output  State of the Condition Flags (CF)  Trace with test data o Until done or o Until program is understood