Systems Architecture I (CS ) Lecture 1: Random Access Machines

Slides:



Advertisements
Similar presentations
Microprocessors.
Advertisements

The CPU Revision Typical machine code instructions Using op-codes and operands Symbolic addressing. Conditional and unconditional branches.
LC-3 Computer LC-3 Instructions
Some thoughts: If it is too good to be true, it isn’t. Success is temporary. It is hard work to make it simple. Knowing you did it right is enough reward.
Chapters 5 - The LC-3 LC-3 Computer Architecture Memory Map
Dale & Lewis Chapter 5 Computing components. Let’s design a computer Generic CPU with registers −Program counter (PC) – 5 bits (size of addresses) −Instruction.
Chapters 4 & 5: LC-3 Computer Architecture Machine Instructions Assembly language Programming in Machine and Assembly Language.
1 CS Programming Languages Random Access Machines Jeremy R. Johnson.
SAP1 (Simple-As-Possible) Computer
Machine level architecture Computer Architecture Basic units of a Simple Computer.
June 18, 2001Systems Architecture II1 Systems Architecture II Systems Architecture I Review * Jeremy R. Johnson June 18, 2001 * Most figures from Computer.
Lec 1Systems Architecture1 Systems Architecture Lecture 1: Random Access Machines Jeremy R. Johnson Anatole D. Ruslanov William M. Mongan Some material.
CS41B MACHINE David Kauchak CS 52 – Fall Admin  Midterm Thursday  Review question sessions tonight and Wednesday  Assignment 3?  Assignment.
Lecture 1 Introduction to Computing Machinery. Colossus Joseph Marie Jacquard Charles Babbage Augusta Ada Countess of Lovelace.
Chapter 8: The Very Simple Computer
Model Computer CPU Arithmetic Logic Unit Control Unit Memory Unit
1 Ethics of Computing MONT 113G, Spring 2012 Session 7 Computer Architecture The Internet.
Program Design. The design process How do you go about writing a program? –It’s like many other things in life Understand the problem to be solved Develop.
Assembly Language Friday, Week 5 Monday, Week 6. Assembly Language  Set of mnemonic names for the instructions in a particular computer's machine language.
September 26, 2001Systems Architecture I1 Systems Architecture I (CS ) Lecture 2: Implementation of a Simplified Computer Jeremy R. Johnson Wednesday,
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.
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.
Computer Systems Organization
Dale & Lewis Chapter 5 Computing components
Fundamentals of Informatics Lecture 4 From Turing Machines to Algorithms Bas Luttik.
Computer Systems – Machine & Assembly code. Objectives Machine Code Assembly Language Op-code Operand Instruction Set.
Assembly Language Programming of 8085 BY Prof. U. V. THETE Dept. of Computer Science YMA.
An Adder A Subtractor. A and B are the inputs of the adder/ subtractor R is the output of the adder/ subtractor F is the control to tell it to add or.
This is where you can reset and run your program. If your program has an “INP” (input) command, you will type it in this box here. Using the LMC These.
Jeremy R. Johnson William M. Mongan
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
Mastering LMC Coding Part #1 Introduction to Low Level Languages Introduction to Little Man computer Simple examples (demos) with video tutorials included.
Lec 4-2 Five operations of the machine cycle Fetch- fetch the next program instruction from memory. (PC+1); instruction to IR Decode- decode the instruction.
Instruction Memory value Description ADD1xx Add the value stored at memory address xx to the value in the accumulator register SUB2xx Subtract the value.
Computer Science 210 Computer Organization Machine Language Instructions: Control.
1. 2 TimeActivity 9:45Welcome and introductions 10:00What is a computer? 10:15What’s inside? 10:45Activity: A simple view of how computers work 11:15Coffee/tea.
The Little man computer
Unit 1 Instruction set M.Brindha AP/EIE
PROGRAMMING THE BASIC COMPUTER
CS 270: Mathematical Foundations of Computer Science
David Kauchak CS 52 – Spring 2017
SAP1 (Simple-As-Possible) Computer
Overview of Instruction Set Architectures
MIPS Instruction Set Advantages
Assembly Language Programming of 8085
CHAPTER 6: The Little Man Computer
PROGRAMMING THE BASIC COMPUTER
3.Instruction Set of 8085 Consists of 74 operation codes, e.g. MOV
A Closer Look at Instruction Set Architectures: Expanding Opcodes
CS-401 Assembly Language Programming
Starter Read the Feedback Click on Add new Feedback Open Realsmart
Chapter 5 The LC-3.
The Processor and Machine Language
Programming Languages (CS 550) Mini Language Compiler
Computer Science 210 Computer Organization
Systems Architecture I (CS ) Lecture 2: A Simplified Computer
Making Programming Friendlier
Sequencing, Selection, and Loops in Machine Language
Phillipa Gill SCI 199 Y Tutorial Sept. 14, 2009 Phillipa Gill
THE FETCH-EXECUTE CYCLE.
Computer Architecture
University of Gujrat Department of Computer Science
Systems Architecture I
Chapter 6 Programming the basic computer
THE FETCH-EXECUTE CYCLE.
Systems Architecture I (CS ) Lecture 1: Random Access Machines
CPSC 171 Introduction to Computer Science
Programming Languages (CS 360) Mini Language Compiler
Little Man Computer.
Presentation transcript:

Systems Architecture I (CS 281-001) Lecture 1: Random Access Machines Jeremy R. Johnson Wed. Sept. 22, 1999 Sept. 22, 1999 Systems Architecture I

Systems Architecture I September 4, 1997 Introduction Objective: To develop a simple model of computation that provides insight into how a program executes on a computer. A Random Access Machine (RAM) is an abstract model of computation that resembles a simple idealized computer. It is equivalent in computational power to a Turing machine (can perform any computation). Despite its simplicity it provides some intuition as to how a program executes on a computer. Sept. 22, 1999 Systems Architecture I

Systems Architecture I September 4, 1997 Definition of a RAM Defined by a set of instructions and a model of execution. A program for a RAM is a sequence of instructions. A RAM has an infinite memory. Instructions can read and write to memory. Items from memory are loaded into registers, where arithmetic can be performed. The state of a computation: program counter (to keep track of instruction to execute), registers, and memory. Sept. 22, 1999 Systems Architecture I

A Random Access Machine Control Unit Memory 1 2 Program 3 ... 4 5 6 AC = accumulator register ... Sept. 22, 1999 Systems Architecture I

Systems Architecture I September 4, 1997 Instruction Set LDA X; Load the AC with the contents of memory address X LDI X; Load the AC indirectly with the contents of address X STA X; Store the contents of the AC at memory address X STI X; Store the contents of the AC indirectly at address X ADD X; Add the contents of address X to the contents of the AC SUB X; Subtract the contents of address X from the AC JMP X; Jump to the instruction labeled X JMZ X; Jump to the instruction labeled X if the AC contains 0 JMN X; Jump to the instruction labeled X if the contents of the AC ; is negative HLT ; Halt execution Sept. 22, 1999 Systems Architecture I

Systems Architecture I September 4, 1997 Sample Program STOR ; algorithm to detect duplicates in an array A of size n. for i  1 to n do if B(A(I))  0 then output A(i); exit else B(A(i)) = 1 Sept. 22, 1999 Systems Architecture I

Systems Architecture I September 4, 1997 Sample RAM Program 1. LDI 3; get ith entry from A 2. ADD 4; add offset to compute index j 3. STA 5; store index j 4. LDI 5; get jth entry from B 5. JMZ 9; if entry 0, go to 9 6. LDA 3; if entry 1, get index i 7. STA 2; and store it at 2. 8. HLT ; stop execution 9. LDA 1; get constant 1 10. STI 5; and store it in B 11. LDA 3; get index i 12. SUB 4; subtract limit 13. JMZ 8; if i = limit, stop 14. LDA 3; get index i again 15. ADD 1; increment I 16. STA 3; store new value of I 17. JMP 1; AC Memory 1 constant 1 answer 2 6 Index i 3 9 Limit of A 4 Index j 5 3 6 4 7 A 2 8 2 9 10 11 B 12 13 Sept. 22, 1999 Systems Architecture I

Systems Architecture I September 4, 1997 Exercises Modify STOR so that when a computation finishes and the input sequence contained a duplicate integer, we know what that integer was. Write a RAL program which takes to two input integers at addresses 1 and 2 and multiplies them storing the result at address 4. Sept. 22, 1999 Systems Architecture I

Sample Solution (2nd exc) compute x*y, x,y >= 0 September 4, 1997 Sample Solution (2nd exc) compute x*y, x,y >= 0 AC 1. LDA 1; load x 2. JMZ 10; check if x = 0 3. LDA 4; load partial result 4. ADD 2; add y to partial result 5. STA 4; store partial result 6. LDA 1; load x 7. SUB 3; and decrement 8. STA 1; store decremented x 9. JMP 2; next iteration 10. HLT ; Memory x value of x 1 y Value of y 2 1 Constant 1 3 result 4 The program still works with y < 0; however, if x < 0, it will go into an infinite loop (x will never = 0). To allow x < 0, first check to see if x is negative with JMN, and if so we want to increment x rather than decrement it. Sept. 22, 1999 Systems Architecture I