Systems Architecture I

Similar documents
Notes on Assembly Language

1 Classical Universal Computer 3

UNIVERSITY OF CALIFORNIA, DAVIS Department of Electrical and Computer Engineering. EEC180B Lab 7: MISP Processor Design Spring 1995

Central Processing Unit (CPU)

(Refer Slide Time: 00:01:16 min)

CPU Organisation and Operation

Computer organization

Chapter 4 Register Transfer and Microoperations. Section 4.1 Register Transfer Language

Systems I: Computer Organization and Architecture

The Little Man Computer

PART B QUESTIONS AND ANSWERS UNIT I

MICROPROCESSOR AND MICROCOMPUTER BASICS

Chapter 01: Introduction. Lesson 02 Evolution of Computers Part 2 First generation Computers

CHAPTER 4 MARIE: An Introduction to a Simple Computer

Microprocessor & Assembly Language

Central Processing Unit Simulation Version v2.5 (July 2005) Charles André University Nice-Sophia Antipolis

Comp 255Q - 1M: Computer Organization Lab #3 - Machine Language Programs for the PDP-8

MACHINE ARCHITECTURE & LANGUAGE

OAMulator. Online One Address Machine emulator and OAMPL compiler.

Summary of the MARIE Assembly Language

CHAPTER 7: The CPU and Memory

Instruction Set Architecture (ISA)

Systems I: Computer Organization and Architecture

A s we saw in Chapter 4, a CPU contains three main sections: the register section,

8085 INSTRUCTION SET

Microcontroller Basics A microcontroller is a small, low-cost computer-on-a-chip which usually includes:

CS101 Lecture 26: Low Level Programming. John Magee 30 July 2013 Some material copyright Jones and Bartlett. Overview/Questions

A3 Computer Architecture

Instruction Set Architecture. Datapath & Control. Instruction. LC-3 Overview: Memory and Registers. CIT 595 Spring 2010

MICROPROCESSOR. Exclusive for IACE Students iacehyd.blogspot.in Ph: /422 Page 1

what operations can it perform? how does it perform them? on what kind of data? where are instructions and data stored?

BASIC COMPUTER ORGANIZATION AND DESIGN

Lecture 3 Addressing Modes, Instruction Samples, Machine Code, Instruction Execution Cycle

CSCI 4717 Computer Architecture. Function. Data Storage. Data Processing. Data movement to a peripheral. Data Movement

Let s put together a Manual Processor

İSTANBUL AYDIN UNIVERSITY

Computer Organization and Architecture

PROBLEMS (Cap. 4 - Istruzioni macchina)

Instruction Set Architecture. or How to talk to computers if you aren t in Star Trek

Advanced Computer Architecture-CS501. Computer Systems Design and Architecture 2.1, 2.2, 3.2

How It All Works. Other M68000 Updates. Basic Control Signals. Basic Control Signals

a storage location directly on the CPU, used for temporary storage of small amounts of data during processing.

1. Convert the following base 10 numbers into 8-bit 2 s complement notation 0, -1, -12

Administrative Issues

Today. Binary addition Representing negative numbers. Andrew H. Fagg: Embedded Real- Time Systems: Binary Arithmetic

Digital Logic Design. Basics Combinational Circuits Sequential Circuits. Pu-Jen Cheng

Instruction Set Design

Chapter 4 Lecture 5 The Microarchitecture Level Integer JAVA Virtual Machine

Computer Architecture Lecture 2: Instruction Set Principles (Appendix A) Chih Wei Liu 劉 志 尉 National Chiao Tung University

l C-Programming l A real computer language l Data Representation l Everything goes down to bits and bytes l Machine representation Language

CS:APP Chapter 4 Computer Architecture. Wrap-Up. William J. Taffe Plymouth State University. using the slides of

Chapter 2 Topics. 2.1 Classification of Computers & Instructions 2.2 Classes of Instruction Sets 2.3 Informal Description of Simple RISC Computer, SRC

Chapter 5 Instructor's Manual

Chapter 9 Computer Design Basics!

TIMING DIAGRAM O 8085

5 Combinatorial Components. 5.0 Full adder. Full subtractor

Chapter 2 Basic Structure of Computers. Jin-Fu Li Department of Electrical Engineering National Central University Jungli, Taiwan

High level code and machine code

CSE 141L Computer Architecture Lab Fall Lecture 2

ETEC 2301 Programmable Logic Devices. Chapter 10 Counters. Shawnee State University Department of Industrial and Engineering Technologies

Central Processing Unit

Instruction Set Architecture

1 Computer hardware. Peripheral Bus device "B" Peripheral device. controller. Memory. Central Processing Unit (CPU)

CPU Organization and Assembly Language

LSN 2 Computer Processors

Chapter 2 Logic Gates and Introduction to Computer Architecture

X86-64 Architecture Guide

A single register, called the accumulator, stores the. operand before the operation, and stores the result. Add y # add y from memory to the acc

Computer Architecture

LABORATORY MANUAL EE0310 MICROPROCESSOR & MICROCONTROLLER LAB

1 Description of The Simpletron

The 104 Duke_ACC Machine

8051 MICROCONTROLLER COURSE

2) Write in detail the issues in the design of code generator.

TEACHING COMPUTER ARCHITECTURE THROUGH SIMULATION (A BRIEF EVALUATION OF CPU SIMULATORS) *

COMPUTERS ORGANIZATION 2ND YEAR COMPUTE SCIENCE MANAGEMENT ENGINEERING JOSÉ GARCÍA RODRÍGUEZ JOSÉ ANTONIO SERRA PÉREZ

Computer System: User s View. Computer System Components: High Level View. Input. Output. Computer. Computer System: Motherboard Level

Machines with Memory

Learning Outcomes. Simple CPU Operation and Buses. Composition of a CPU. A simple CPU design

The AVR Microcontroller and C Compiler Co-Design Dr. Gaute Myklebust ATMEL Corporation ATMEL Development Center, Trondheim, Norway

CHAPTER 6: Computer System Organisation 1. The Computer System's Primary Functions

MACHINE INSTRUCTIONS AND PROGRAMS

COMP 303 MIPS Processor Design Project 4: MIPS Processor Due Date: 11 December :59

Sistemas Digitais I LESI - 2º ano

EE282 Computer Architecture and Organization Midterm Exam February 13, (Total Time = 120 minutes, Total Points = 100)

Counters and Decoders

COMP 250 Fall 2012 lecture 2 binary representations Sept. 11, 2012

Exemplar Work for SAMs. Units A452 and A453

PROBLEMS #20,R0,R1 #$3A,R2,R4

Giving credit where credit is due

An Overview of Stack Architecture and the PSC 1000 Microprocessor

PROBLEMS. which was discussed in Section

Microprocessor and Microcontroller Architecture

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING Question Bank Subject Name: EC Microprocessor & Microcontroller Year/Sem : II/IV

Chapter 1 Computer System Overview

Z80 Instruction Set. Z80 Assembly Language

EC 362 Problem Set #2

ASSEMBLY PROGRAMMING ON A VIRTUAL COMPUTER

Arithmetic Coding: Introduction

High-Level Programming Languages. Nell Dale & John Lewis (adaptation by Michael Goldwasser)

Transcription:

Systems Architecture I Topics Random Access Machines Implementation of a Simplified Computer Notes Courtesy of Jeremy R. Johnson Lec 1 Systems Architecture I 1

Systems Architecture I Topic 1: Random Access Machines Lec 1 Systems Architecture I 2

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. Lec 1 Systems Architecture I 3

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. Lec 1 Systems Architecture I 4

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

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 Lec 1 Systems Architecture I 6

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 Lec 1 Systems Architecture I 7

1. LDI 3; get ith entry from A Sample RAM Program 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; Lec 1 Systems Architecture I 8 AC Memory 1 1 constant 2 0 answer 3 6 Index i 4 9 Limit of A 5 0 Index j 6 3 7 4 A 8 2 9 2 10 11 12 13 0 0 0 0 B

Exercises Modify STOR so that when a computation finishes and the input sequence contained a duplicate integer, we know what that integer was. Modify STOR so that it uses array indexing when accessing the array A instead of pointer arithmetic (i.e. the index into A should be an array index, starting with 1, rather than an address of a location in the array). Write a RAL program which takes two input integers at addresses 1 and 2 and multiplies them storing the result at address 4. Lec 1 Systems Architecture I 9

Sample Solution compute x*y, x,y >= 0 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 ; AC Memory 1 x value of x 2 y Value of y 3 1 Constant 1 4 0 result 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. Lec 1 Systems Architecture I 10

Systems Architecture I Topic 2: Implementation of a Simplified Computer Lec 1 Systems Architecture I 11

Introduction Objective: To develop a simple model of a computer and its execution that is capable of executing RAM programs. To introduce the concept of abstraction in computer design. The model will be given schematically with timing sequences. RAL instructions will be implemented using microinstructions described in a notation called Register Transfer Language (RTL). The control logic for implementing microinstructions will be described at the gate level. References: Dewdney, The New Turing Omnibus (Chapter 48). Lec 1 Systems Architecture I 12

SCRAM A Simple but Complete Random Access Machine. This computer can execute RAL instructions. 8-bit words 16 word memory (4 address bits) Instructions (4 bit opcode, 4 bit operand) 7 registers PC (program counter) IR (instruction register - IR(C) = instruction code, IR(O) = operand MAR (memory address register) MBR (memory buffer register) AC (accumulator) AD (register for addition internal to the ALU - arithmetic logic unit) Driven by the CLU (control logic unit) A timer T generates pulses that are decoded into separate input lines to the CLU Lec 1 Systems Architecture I 13

Fetch and Execute A cycle of operation consists of two stages The fetch cycle gets the next executable instruction and loads it into the IR The execute cycle performs the instruction in the IR The fetch and execute cycles are written as a sequence of micro-instructions described in a notation called Register Transfer Language (RTL) Lec 1 Systems Architecture I 14

LOAD PC INC LOAD MAR MUX 0 1 2 3 s Memory READ/ WRITE LOAD IR(C) IR(O) Decoder LOAD MBR MUX 0 1 s q 9 q 8 q 7 q 6 q 5 q 4 q 3 q 2 q 1 x 1 x 2 x 3 x 4 x 5 CLU t 9 t 8 t 7 t 6 t 5 t 4 t 3 t 2 t 1 t 0 x 13 x 12 x 11 x 10 x 9 x 8 x 7 x 6 INC 0 1 2 3 MUX s CLEAR LOAD AC ALU LOAD AD MUX 0 1 s Decoder T Lec 1 Systems Architecture I 15

Instruction Opcodes LDA 0001 X; Load contents of memory address X into the AC LDI 0010 X; Indirectly load contents of address X into the AC STA 0011 X; Store contents of AC at memory address X STI 0100 X; Indirectly store contents of AC at address X ADD 0101 X; Add contents of address X to the AC SUB 0110 X; Subtract contents of address X from the AC JMP 0111 X; Jump to the instruction labeled X JMZ 1000 X; Jump to instruction X if the AC contains 0 Lec 1 Systems Architecture I 16

MicroProgram Fetch cycle t 0 : MAR PC t 1 : MBR M; PC PC + 1 t 2 : IR MBR Execute cycle (LDA) q 1 t 3 : MAR IR(O) q 1 t 4 : MBR M q 1 t 5 : AC MBR Lec 1 Systems Architecture I 17

MicroProgram Execute cycle (LDI) q 2 t 3 : MAR IR(O) q 2 t 4 : MBR M q 2 t 5 : MAR MBR q 2 t 6 : MBR M q 2 t 7 : AC MBR Execute cycle (ADD) q 5 t 3 : MAR IR(O) q 5 t 4 : MBR M q 5 t 5 : AD MBR q 5 t 6 : AD AD + AC q 5 t 7 : AC AD Lec 1 Systems Architecture I 18

Logic for the Fetch Cycle t 0 : MAR PC t 1 : MBR M; PC PC + 1 t 2 : IR MBR t 0 x 10 x 10 x 4 t 1 x 7 x 5 x 13 x 2 t 2 x 1 Lec 1 Systems Architecture I 19

Logic for Loading the Accumulator q 3 t 3 x 10 x 10 MAR IR(0) x 4 x 2 t 4 x 7 MBR M x 5 t 5 x 11 AC MBR x 11 x 12 Lec 1 Systems Architecture I 20

CLU Logic Some of the output lines from the two previous slides appear in both circuits. It is necessary to have some logic to connect and coordinate the individual outputs to the wires leaving the CLU. Lec 1 Systems Architecture I 21

Exercises Write microprograms for STA, STI, and JMZ. Implement the microprograms in standard logic. Design the portion of the CLU that determines the two output lines labeled x 10. Input to this circuit will be one or both of the lines previously labeled x 10 in the individual circuits for LDA, LDI, and the other circuits. Convert the following program to the equivalent set of binary words, as indicated in this chapter. This is called machine code. Trace the execution of the program by listing the q, t, and x variables. LDA 1 ADD 2 STA 3 Lec 1 Systems Architecture I 22