UNIT 8C Computer Organization: The Machine s Language. von Neumann Architecture

Similar documents
Teaching London Computing

CS 265. Computer Architecture. Wei Lu, Ph.D., P.Eng.

Chapter 4 The Von Neumann Model

Why learn Computer Programming? Computer-based problem solving in Science and Engineering. Why learn Fortran? Elementary Computer Organization

Little Man Computer (LMC)

Chapter 4 The Von Neumann Model

Department of Computer and Mathematical Sciences. Lab 4: Introduction to MARIE

SCRAM Introduction. Philipp Koehn. 19 February 2018

Parsing Scheme (+ (* 2 3) 1) * 1

Copyright 2000 N. AYDIN. All rights reserved. 1

Instruction : A command to the microprocessor to perform a given task on specified data. Each instruction has two parts

AS/A Level Computing Syllabus 2011

Notes: The Marie Simulator

The Von Neumann Architecture Odds and Ends. Designing Computers. The Von Neumann Architecture. CMPUT101 Introduction to Computing - Spring 2001

Introduction to Computer Engineering. CS/ECE 252 Prof. Mark D. Hill Computer Sciences Department University of Wisconsin Madison

1 Little Man Computer

Copyright The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Computing Layers

Computer Organization II CMSC 3833 Lecture 33

Chapter 4 The Von Neumann Model

C++ to assembly to machine code

Computer Architecture

Expectations. Why learn Assembly Language? Administrative Issues. Assignments. CSC 3210 Computer Organization and Programming

COMPUTER ORGANIZATION & ARCHITECTURE

The Stored Program Computer

Chapter 2 Data Manipulation

CMPUT101 Introduction to Computing - Summer 2002

Computer Architecture (part 2)

Computer Organization and Technology Processor and System Structures

Computer System. Hiroaki Kobayashi 7/25/2011. Agenda. Von Neumann Model Stored-program instructions and data are stored on memory

LC-3 Architecture. (Ch4 ish material)

Computer Organization

session 7. Datapath Design

CPU ARCHITECTURE. QUESTION 1 Explain how the width of the data bus and system clock speed affect the performance of a computer system.

The CPU and Memory. How does a computer work? How does a computer interact with data? How are instructions performed? Recall schematic diagram:

COSC121: Computer Systems: Review

C.P.U Organization. Memory Unit. Central Processing Unit (C.P.U) Input-Output Processor (IOP) Figure (1) Digital Computer Block Diagram

COMARCH. COMPUTER ARCHITECTURE TERM 3 SY COMPUTER ENGINEERING DE LA SALLE UNIVERSITY Quiz 1

CSE100 Lecture03 Machines, Instructions, and Programs Introduction to Computer Systems

Memory General R0 Registers R1 R2. Input Register 1. Input Register 2. Program Counter. Instruction Register

Page 1. Structure of von Nuemann machine. Instruction Set - the type of Instructions

bits 5..0 the sub-function of opcode 0, 32 for the add instruction

C Functions and Pointers. C Pointers. CS270 - Fall Colorado State University. CS270 - Fall Colorado State University

The Institution of Engineers - Sri Lanka

I. instruction J. instruction register K. label L. load M. load/store machine N. location counter (loc) O. MAR P. MDR

2. Computer Evolution and Performance

I ve been getting this a lot lately So, what are you teaching this term? Computer Organization. Do you mean, like keeping your computer in place?

The MIPS Instruction Set Architecture

The Von Neumann Architecture. Designing Computers. The Von Neumann Architecture. CMPUT101 Introduction to Computing - Spring 2001

16.1. Unit 16. Computer Organization Design of a Simple Processor

DC57 COMPUTER ORGANIZATION JUNE 2013

Designing Computers. The Von Neumann Architecture. The Von Neumann Architecture. The Von Neumann Architecture

Computer Architecture and Data Manipulation. Von Neumann Architecture

Objective now How are such control statements registers and other components Managed to ensure proper execution of each instruction

von Neumann Architecture Basic Computer System Early Computers Microprocessor Reading Assignment An Introduction to Computer Architecture

Basic Computer System. von Neumann Architecture. Reading Assignment. An Introduction to Computer Architecture. EEL 4744C: Microprocessor Applications

Processor (I) - datapath & control. Hwansoo Han

Computer Architecture COMP360

CS 101, Mock Computer Architecture

Computer Organization CS 206 T Lec# 2: Instruction Sets

THE MICROPROCESSOR Von Neumann s Architecture Model

What is TOY? An imaginary machine similar to: ! Ancient computers. ! Today's microprocessors.

MIPS PROJECT INSTRUCTION SET and FORMAT

CDA 3103 Computer Organization Homework #7 Solution Set

Wednesday, February 4, Chapter 4

Assembly Language Programming of 8085

EC-801 Advanced Computer Architecture

! Ancient computers. ! Today's microprocessors. Memory. ! Stores data and programs. ! 256 "words." (16 bits each) ! Special word for stdin / stdout.

The MARIE Architecture

CMSC 313 COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE PROGRAMMING LECTURE 01, SPRING 2013

Computer Organization Question Bank

General purpose registers These are memory units within the CPU designed to hold temporary data.

Practical Malware Analysis

A3 Computer Architecture

CS 265. Computer Architecture. Wei Lu, Ph.D., P.Eng.

Wednesday, September 13, Chapter 4

Computer Architecture

CMPUT101 Introduction to Computing - Summer 2002

COSC 122 Computer Fluency. Computer Organization. Dr. Ramon Lawrence University of British Columbia Okanagan

Lecture 4: MIPS Instruction Set

Preventing Stalls: 1

Introduction to Programming

For your convenience Apress has placed some of the front matter material after the index. Please use the Bookmarks and Contents at a Glance links to

ECE232: Hardware Organization and Design. Computer Organization - Previously covered

Unit II Basic Computer Organization

CPSC 121: Models of Computation

We will use the accumulator machine architecture to demonstrate pass1 and pass2.

Laboratory. Low-Level. Languages. Objective. References. Study simple machine language and assembly language programs.

Micro-programmed Control Ch 15

This simulated machine consists of four registers that will be represented in your software with four global variables.

Machine Instructions vs. Micro-instructions. Micro-programmed Control Ch 15. Machine Instructions vs. Micro-instructions (2) Hardwired Control (4)

Micro-programmed Control Ch 15

Computer Organization & Assembly Language Programming

Instruction Sets: Characteristics and Functions Addressing Modes

address ALU the operation opcode ACC Acc memory address

CIT 668: System Architecture

Introduction to Computers & Programming

Microcontroller Systems

Cambridge International Examinations Cambridge International Advanced Subsidiary and Advanced Level

Chapter 2 Instruction Set Architecture

CSC 101: Lab Manual#9 Machine Language and the CPU (largely based on the work of Prof. William Turkett) Lab due date: 5:00pm, day after lab session

Transcription:

UNIT 8C Computer Organization: The Machine s Language 1 von Neumann Architecture Most computers follow the fetch-decodeexecutecycle introduced by John von Neumann. Fetch next instruction from memory. Decode instruction and get any data it needs (possibly from memory). Execute instruction with data and store results (possibly into memory). Repeat. 2 1

Programming a Machine All instructions for a program are stored in computer memory in binary, just like data. A program is needed that translates human readable instructions (e.g. in Ruby) into binary instructions ( machine language ). An interpreter is a program that translates one instruction at a time into machine language to be executed by the computer. A compiler is a program that translates an entire program into machine language which is then executed by the computer. 3 MARS Memory Array Redcode Simulator A simulated computer system that we can use to explore how to run instructions at the machine level. To use this in Ruby, we need to run include MARSLab We can program this virtual machine in assembly language (a human readable form of machine language) called Redcode. 4 2

MARS details Memory is simulated by an array of words. Each word is either an instruction or a data value. Instructions are executed in sequence one at a time unless we execute an instruction that causes the virtual machine to jump to a location somewhere else in memory for the next instruction. 5 Simple MARS Program (simple.txt) labels opcodes operands end simple ; add x to y ; 0 is halt DAT specifies a data value. Data values can also be instructions (e.g. halt ) 6 3

Running the Program in irb (cont d) Program starts > include MARSLab at address 2 in => Object memory > m = make_test_machine( simple.txt ) => #<MiniMARS mem = [ #4,...] pc = [*2]> > m.dump 0000: #4 0001: #7 0002: ADD -2-1 0003: #0 memory addresses add the data 2 words back to the data 1 word back 7 Running the Program in irb (cont d) > m.step => ADD -2-1 > m.dump 0000: #4 0001: #11 0002: ADD -2-1 0003: #0 > m.status Run: continue PC: [ *3 ] y has been updated PC = Program Counter The PC indicates where the next instruction is located (e.g. address 3). 8 4

Running the Program in irb (cont d) > m.step => #0 > m.dump 0000: #4 0001: #11 0002: ADD -2-1 0003: #0 > m.status Run: halt nothing has changed The MARS simulator executed an instruction with opcode 0 (halt) and has halted. 9 Looping Example Multiply x * y. Algorithm: Add x to an accumulator y times. Example: Compute 5 * 9: x DAT #5 y DAT #9 acc mult ADD x, acc ; add x to acc SUB #1, y ; subtract 1 from y JMN mult, y ; jump to label mult ; if y is not zero end mult 10 5

Running the Program in irb > include MARSLab => Object > m = make_test_machine( mult.txt ) => #<MiniMARS mem = [ #5,...] pc = [*3]> > m.run => 28 > m.dump(0,2) 0000: #5 0001: #0 0002: #45 number of instructions executed dump (display) the words from memory in this range only 11 Example: Fahrenheit to Celsius cels = (fahr 32) * 5 / 9 fahr DAT #82 ; fahrenheit value cels ; store result here ftmp ; save fahr-32 here acc ; accumulate answer count DAT #5 ; counter for mult. (program continues on next page) 12 6

Example: Fahrenheit to Celsius start mult div skip next instruction if 0 is less than acc MOV fahr, ftmp SUB #32, ftmp ADD ftmp, acc SUB #1, count JMN mult, count SUB #9, acc SLT #0, acc ; halt ADD #1, cels JMP div end start set ftmp = fahr - 32 add ftmp to acc 5 times (count starts off at 5) divide acc by 9: subtract 9 from acc and add 1 to cels to see how many times 9 divides into acc always jump to label div 13 7