Dr Verbrugge Simulated Machine Simulated Machine Problem: Find the Average of the following three numbers: 5, 7, 10 Average = 7 with a remainder of 1.

Slides:



Advertisements
Similar presentations
The CPU The Central Presentation Unit What is the CPU?
Advertisements

Senem Kumova Metin Introduction to Programming CS 115 Introduction to Computing PART I : Computer Basics PART II: Introduction to Computing/Programming.
Assembly Language for Intel-Based Computers, 4 th Edition Chapter 1: Basic Concepts (c) Pearson Education, All rights reserved. You may modify and.
The Little man computer
The CPU Revision Typical machine code instructions Using op-codes and operands Symbolic addressing. Conditional and unconditional branches.
19-1 Programming… The Pencil and Paper Computer The Pencil & Paper Instruction Set: (table on p148) The Operand specifies a memory location.
Instruction Set Architecture & Design
Assembly Language Programming CS208. Assembly Language Assembly language allows us to use convenient abbreviations (called mnemonics) for machine language.
Assembly Language Programming. CPU The CPU contains a Control Unit, Arithmetic Logic Unit (ALU) and a small number of memory locations called Registers.
The processor and main memory chapter 4, Exploring the Digital Domain The Development and Basic Organization of Computers.
Choice for the rest of the semester New Plan –assembler and machine language –Operating systems Process scheduling Memory management File system Optimization.
The central processing unit and main memory chapter 4, Exploring the Digital Domain The Development and Basic Organization of Computers.
Assembly Language for Intel-Based Computers, 5 th Edition Chapter 1: Basic Concepts (c) Pearson Education, All rights reserved. You may modify.
Computer Structure.
How Computers Work Dr. John P. Abraham Professor UTPA.
General Topics Digital Basics Instructions & Programs.
The CPU The Central Presentation Unit Main Memory and Addresses Address bus and Address Space Data Bus Control Bus The Instructions set Mnemonics Opcodes.
CSU0014 Assembly Languages Homepage: Textbook: Kip R. Irvine, Assembly Language for Intel-Based Computers,
Summer 2014 Chapter 1: Basic Concepts. Irvine, Kip R. Assembly Language for Intel-Based Computers 6/e, Chapter Overview Welcome to Assembly Language.
Assembly Language for x86 Processors 7th Edition
COP1220/CGS2423 Introduction to C++/ C for Engineers Professor: Dr. Miguel Alonso Jr. Fall 2008.
Machine Instruction Characteristics
IT253: Computer Organization Lecture 4: Instruction Set Architecture Tonga Institute of Higher Education.
Cosc 2150: Computer Organization
GCSE Computing#BristolMet Session Objectives#11 MUST identify what program instructions consist of SHOULD describe how instructions are coded as bit patterns.
Computer Science 101 Assembly Language. Problems with Machine Language Uses binary - No English-like words to make it more readable Uses binary - No English-like.
Introduction to Computer Systems and the Java Programming Language.
CPU Internal memory I/O interface circuit System bus
Logic Problems This is an assignment. There are no speaker notes.
Chapter 19 Number Systems. Irvine, Kip R. Assembly Language for Intel-Based Computers, Translating Languages English: Display the sum of A times.
The Central Processing Unit (CPU) and the Machine Cycle.
Module : Algorithmic state machines. Machine language Machine language is built up from discrete statements or instructions. On the processing architecture,
Computer Science Illuminated Programming: Controlling the Hardware.
Little Man Computer When your program gets “translated to machine code” all 0’s & 1’s The translator must know the language of the program (java) as well.
CMSC 150 PROGRAM EXECUTION CS 150: Wed 1 Feb 2012.
Computer Studies/ICT SS2
Computer Architecture CSE 3322 Lecture 3 Assignment: 2.4.1, 2.4.4, 2.6.1, , Due 2/3/09 Read 2.8.
© GCSE Computing Candidates should be able to:  describe the characteristics of an assembler Slide 1.
An Example Architecture. A Paper Computer - Woody Woody's characteristics Word size – 8 bits One word.
CPU The Central Processing Unit (CPU), has 3 main parts: Control Unit Arithmetic and Logic Unit Registers. These components are connected to the rest.
1 The Instruction Set Architecture September 27 th, 2007 By: Corbin Johnson CS 146.
Hardware Information Created by Nasih 1. Hardware  The physical components of a computer system, including any peripheral equipment such as printers,
Central Processing Unit Decode Cycle. Central Processing Unit Current Instruction Register (CIR) I1 The fetch cycle has transferred an instruction from.
Instruction Sets: Characteristics and Functions  Software and Hardware interface Machine Instruction Characteristics Types of Operands Types of Operations.
1 3 Computing System Fundamentals 3.2 Computer Architecture.
Program to multiply 2 numbers 500-Input x 291-Store acc. as x 500-Input y 292-Store acc. as y 193-Load y in to acc. (0 on 1 st parse) 391-Add x to acc.
Little Man Computer Task 1 Last lesson you were asked to write a program to multiply two numbers together. The next slide has a working program to do this.
Computer Architecture. Instruction Set “The collection of different instructions that the processor can execute it”. Usually represented by assembly codes,
The Little man computer
GCSE COMPUTER SCIENCE Computers 1.5 Assembly Language.
Computer Organization
Assembly Language Assembly Language
Starter Read the Feedback Click on Add new Feedback Open Realsmart
Data Representation – Instructions
Chapter 1: Computer Systems
Computer Electronic device Accepts data - input
Microprocessor and Assembly Language
ECEG-3202 Computer Architecture and Organization
Sequencing, Selection, and Loops in Machine Language
ECEG-3202 Computer Architecture and Organization
Chapter 4: Representing instructions
GCSE OCR 1 The CPU Computer Science J276 Unit 1
Program Execution.
Chapter 6 Programming the basic computer
Objectives Describe common CPU components and their function: ALU Arithmetic Logic Unit), CU (Control Unit), Cache Explain the function of the CPU as.
COMPUTER ORGANIZATION AND ARCHITECTURE
Computer Architecture Assembly Language
Presentation transcript:

Dr Verbrugge Simulated Machine Simulated Machine Problem: Find the Average of the following three numbers: 5, 7, 10 Average = 7 with a remainder of 1

Dr Verbrugge Simulated Machine Simulated Machine Flow logic of finding Average of three numbers Get number Add number to Sum Add 1 to Count Sum = 0 Count = 0 Get number Add number to Sum Add 1 to Count Get number Add number to Sum Add 1 to Count Stop Start Divide Sum by Count giving Answer Write Answer

Dr Verbrugge Simulated Machine CPU – Central Processing Unit

Dr Verbrugge Simulated Machine Computer structure Central Processing Unit Memory (RAM) 0……………. 1……………. Registrars Accumulator, Multiply Quotient Instruction, Instruction location, etc. Control/Logic – Instructions Add, Subtract, Transfer, etc. Input Devices Output Devices Secondary Storage

Dr Verbrugge Simulated Machine The Hardware 1000 Memory Locations (Addressed ) – Reserved for Variables and Constants – Reserved for Instructions AC -- Accumulator Register MQ -- Multiplier-Quotient Register –Both registers can hold any positive or negative value greater than or equal to –2,147,483,648 and less than or equal to 2,147,483,647. Two controlling Registers –Instruction Register -- Holds the binary instruction - viewed in Decimal –Instruction Location Register -- Holds the binary value of the memory location where the instruction was - viewed in Decimal

Dr Verbrugge Simulated Machine Machine Instructions

Dr Verbrugge Simulated Machine Program the computer Central Processing Unit Memory (RAM) 0…..… …………..0 1….… …………… (will hold the sum) 2…… …………… (will hold the count) 3…… …………… (will hold the number) Registrars Accumulator……………………. Multiply Quotient……………….. Instruction………5..100….…… Instruction location…………0…. Control/Logic – Instructions ADD(9), CLA(5), RD(13), STO(6) TRA, etc.

Dr Verbrugge Simulated Machine Assembler Instruction One to One translation to Machine Instructions LABEL: OperationCode Operand #Comment The assembler is not case sensitive. Thus cla, CLA, and Cla are the same. Some different forms of an instruction are the following: start: CLA 1 # 1 is a constant and this instruction has a label STO one #one is a variable which now holds 1 TRA next: ADD one # this instruction will be skipped Next: STP

Dr Verbrugge Simulated Machine

Simulated Machine Flow logic of finding Average of any numbers Get number Sum = 0 Count = 0 Add number to Sum Add 1 to Count Stop Start Divide Sum by Count giving Answer Write Answer Write number Is number = -9999? No 1 1 Yes

Dr Verbrugge Simulated Machine The Simulated Machine

Dr Verbrugge Simulated Machine Now in a higher level Language _ JAVA // The Java model class for the assembler find average program public class Avg { public void computeAvg() { int num = Integer.parseInt( JOptionPane.showInputDialog("Enter A Number")); int count = 0; int sum = 0; while (!(num == -9999)) { sum = sum + num; count = count + 1; num = Integer.parseInt(JOptionPane.showInputDialog("Enter A Number")); } JOptionPane.showMessageDialog(null, " Avg = " + sum / count + “Remainder = “ + sum % count ); } // end computeAvg() } // end class