Extra-credit QUIZ Pipelining -due next time-

Similar documents
Low-level software. Components Circuits Gates Transistors

QUIZ. Name all the 4 parts of the fetch-execute cycle.

QUIZ. Name all the 4 parts of the fetch-execute cycle.

LOW-LEVEL PROGRAMMING LANAGUAGES AND PSEUDOCODE. Introduction to Computer Engineering 2015 Spring by Euiseong Seo

Low-Level Programming Languages and Pseudocode

Write "Nell" Write "N" Write "e" Write "l" Write "l" Write "N" Write 4E (hex) Write "e" W rite 65 (hex) Write "l" W rite 6C (hex)

Chapter. Assembly Language

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

EE 3170 Microcontroller Applications

Monday, February 16, 2015

EE 5340/7340 Motorola 68HC11 Microcontroler Lecture 1. Carlos E. Davila, Electrical Engineering Dept. Southern Methodist University

CS 101, Mock Computer Architecture

Copyright 2000 N. AYDIN. All rights reserved. 1

CSC 221: Computer Organization, Spring 2009

COMPUTER ORGANIZATION & ARCHITECTURE

Wednesday, February 4, Chapter 4

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

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

Teaching London Computing

Wednesday, February 7, 2018

Wednesday, September 13, Chapter 4

Unified Engineering Fall 2004

CS 31: Intro to Systems Digital Logic. Kevin Webb Swarthmore College February 2, 2016

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

2.2 THE MARIE Instruction Set Architecture

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

Advanced Parallel Architecture Lesson 3. Annalisa Massini /2015

Processor design - MIPS

Wednesday, September 21, 2016

CS 31: Intro to Systems Digital Logic. Kevin Webb Swarthmore College February 3, 2015

CSCI170 Lecture 1: Analysis of Programming Languages. John Magee 1 September 2011 Some material copyright Jones and Bartlett

Monday, February 11, 2013

address ALU the operation opcode ACC Acc memory address

Microcontroller Systems

Chapter. Computer Architecture

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

Introduction to Computers - Chapter 4

Notes: The Marie Simulator

In this lecture, we will look at how storage (or memory) works with processor in a computer system. This is in preparation for the next lecture, in

User. Application program. Interfaces. Operating system. Hardware

Instruction Sets: Characteristics and Functions

Dec Hex Bin ORG ; ZERO. Introduction To Computing

Question 1: What criteria define Von Neumann architecture? Identify clearly and coherently. Solution

Advanced Parallel Architecture Lesson 3. Annalisa Massini /2015

Show how to connect three Full Adders to implement a 3-bit ripple-carry adder

Chapter 5. Computer Architecture Organization and Design. Computer System Architecture Database Lab, SANGJI University

Course Schedule. CS 221 Computer Architecture. Week 3: Plan. I. Hexadecimals and Character Representations. Hexadecimal Representation

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

William Stallings Computer Organization and Architecture 8 th Edition. Chapter 11 Instruction Sets: Addressing Modes and Formats

Wednesday, March 12, 2014

Lecture-15 W-Z: Increment-Decrement Address Latch:

Information Science 1

William Stallings Computer Organization and Architecture

COSC121: Computer Systems: Review

Computer Organization CS 206 T Lec# 2: Instruction Sets

THE MICROPROCESSOR Von Neumann s Architecture Model

CS61C Machine Structures. Lecture 13 - MIPS Instruction Representation I. 9/26/2007 John Wawrzynek. www-inst.eecs.berkeley.

Binghamton University. CS-140 Fall Pippin

Week 6: Processor Components

A Review of Chapter 5 and. CSc 2010 Spring 2012 Instructor: Qian Hu

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

Blog -

Instruction Sets: Characteristics and Functions Addressing Modes

Computer Systems. Binary Representation. Binary Representation. Logical Computation: Boolean Algebra

CS1004: Intro to CS in Java, Spring 2005

CHAPTER SIX BASIC COMPUTER ORGANIZATION AND DESIGN

ECE260: Fundamentals of Computer Engineering

Chapter 2 Instruction Set Architecture

2. Computer Evolution and Performance

8/16/12. Computer Organization. Architecture. Computer Organization. Computer Basics

Computer Architecture (part 2)

Computer Architecture 2/26/01 Lecture #

Where Does The Cpu Store The Address Of The

Lecture 01: Basic Structure of Computers

Dr. Chuck Cartledge. 7 Nov. 2017

Mark II Aiken Relay Calculator

EE 3170 Microcontroller Applications

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

QUIZ: Generations of computer technology. Hardware:

the SAP-2 I. Intro cmpt-150-arc Sections 8-8, 8-9, 9-4, 9-5, 9.6, We ll do this in bits and pieces, doing the beginning of each section first.

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

Let s put together a Manual Processor

Little Man Computer (LMC)

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

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

Arab Open University. Computer Organization and Architecture - T103

C++ to assembly to machine code

LC-3 Assembly Language. (Textbook Chapter 7)"

Math 230 Assembly Programming (AKA Computer Organization) Spring 2008

Wednesday, September 20, 2017

SCRAM Introduction. Philipp Koehn. 19 February 2018

Load -- read data from memory to register. Store -- write data from register to memory. Load effective address -- compute address, save in register

EC-801 Advanced Computer Architecture

Chapter 1. Microprocessor architecture ECE Dr. Mohamed Mahmoud.

18. Machine Language. Computer Systems. COMP1917: Computing 1. Machine Language Programming. History of Computer Technology

COSC121: Computer Systems: Review

CS311 Lecture: The Architecture of a Simple Computer

CHAPTER ASSEMBLY LANGUAGE PROGRAMMING

Chapter 3. Z80 Instructions & Assembly Language. Von Neumann Architecture. Memory. instructions. program. data

Transcription:

QUIZ Pipelining A computer pipeline has 4 processors, as shown above. Each processor takes 15 ms to execute, and each instruction must go sequentially through all 4 processors. A program has 10 instructions. Calculate how long it takes to run it: without pipelining with pipelining 1

Extra-credit QUIZ Pipelining -due next time- 2

Low-level software Components Circuits Gates Transistors

Abstractions and more abstractions You are here 4

6.1 Computer Operations Computer = programmable electronic device that can store, retrieve, and process data Von Neumann architecture: Data and instructions to manipulate the data are represented in the same way (binary) and are stored in the same place (memory) For processing, both data and instructions have to be brought into the CPU (fetch-execute cycle) 5

6.2 Machine Language Machine language = The language made up of binary coded instructions built into the hardware of a particular computer and used directly by the computer Why would anyone use machine language? (Hint: they had no choice. Why?) Image source: http://www.alpcentauri.info/chapter_18.html 6

Remember: The Fetch-Execute Cycle According to the CPU s machine language 7

Characteristics of machine language: Every processor type has its own set of specific machine instructions The relationship between the processor and the instructions it can carry out is completely integrated Each machine-language instruction does only one very low-level task 8

Pep/8 Virtual Computer Virtual computer A hypothetical machine designed to contain the important features of a real machine Pep/8 A virtual computer designed by Stanley Warford that has 39 machine-language instructions (We re going to cover only a few of them!) 9

Pep/8 Virtual Computer Virtual computer Extra-credit for next time: Figure out what Pep and 8 stand for! A hypothetical machine designed to contain the important features of a real machine Pep/8 A virtual computer designed by Stanley Warford that has 39 machine-language instructions (We re going to cover only a few of them!) 10

Pep/8 Registers The program counter (PC) (contains the address of the next instruction to be executed) The instruction register (IR) (contains a copy of the instruction being executed) The accumulator (register A) The memory unit is made up of 65,636 Bytes of storage Can you figure out how long the Pep/8 address is? 11

QUIZ The previous version of Pep, Pep/7, could use only 12 bits for memory addresses. How many Bytes of memory could Pep/7 address? 12

24 bits 16 bits Explain the address format! 13

Can you show what instructions look like in memory? Explain the address format! 14

Instruction Format 15

Instruction Format Operation code, a.k.a. opcode Specifies which instruction is to be carried out Register specifier Specifies which register is to be used (only use A in this chapter) Addressing-mode specifier Says how to interpret the operand part of the instruction: Direct Immediate Say that again?!? 16

Instruction Format Addressing-mode specifier Says how to interpret the operand part of the instruction: Direct Immediate?? 2 + 3 Immediate A + B Direct 17

Immediate and direct addressing modes 18

Immediate and direct addressing modes Example: ADD 42 to accumulator A What exactly am I to add? 19

Instruction Format Addressing modes: immediate direct Is there something we are not telling you about Pep s addressing modes? 20

QUIZ Pipelining A computer pipeline has 5 stages. Each stage takes 12 ns (nanosec.) to execute, and each instruction must go sequentially through all 5 stages. A program has 20 instructions. Calculate how long it takes to run it: without pipelining with pipelining 21

QUIZ Name all the 4 parts of the fetch-execute cycle. What do IR, A, and PC stand for in the computer s architecture? Name and explain the 2 addressing modes we ve covered. 22

QUIZ: Immediate and direct addressing SUB 31 from accumulator A What exactly am I to subtract? modes 23

PEP/8 machine instructions 24

What does this instruction mean, what is its hex code, and what exactly does it do? 25

What does this instruction mean, what is its hex code, and what exactly does it do? 26

What do these instructions mean, what are their hex codes, and what exactly do they do? 27

Wait a second... 28

Conclusions It is useless to write operands into IR. IR should be written only in the FETCH stage of the Fetch-Execute cycle, when the 3 bytes of the instruction are brought from memory. Operands can be written only to: Accumulator Memory Some instructions cannot have the immediate addressing mode 29

What do these instructions mean, what are their hex codes, and what exactly do they do? 30

What does this instruction mean, what is its hex code, and what exactly does it do? Why is there only one on this page?

32 What do these instructions mean, what are their hex codes, and what exactly do they do?

QUIZ Name all the 4 parts of the fetch-execute cycle. What do IR, A, and PC stand for in the computer s architecture? Name and explain the 2 addressing modes we ve covered. 33

Trick QUIZ: Immediate and direct addressing modes We have this Pep instruction: LOAD 20 (decimal) into accum. A What exactly am I to load? 34

Problem 16 / 189 The PEP/8 memory has the following contents: 0001 A2 0002 11 0003 00 0004 FF What are the contents of reg. A after this instruction is executed: C1 00 01 35

0001 A2 0002 11 0003 00 0004 FF Instruction executed: C1 00 01 36

Problem 17 / 190 The PEP/8 memory has the following contents: 0001 A2 0002 11 0003 00 0004 FF What are the contents of reg. A after this instruction is executed: C1 00 02 The first step is 37

Problem 17 / 190 The PEP/8 memory has the following contents: 0001 A2 0002 11 0003 00 0004 FF What are the contents of reg. A after this instruction is executed: C1 00 02 1100 0001 0000 0000 0000 0010 38

6.3 Program to write "Hello" Every program ends with this! 39

Hand Simulation 0 0 0 0 What is the fetch/execute cycle? How much is the PC incremented? What ASCII character is this? 0000 50 0001 00 0002 48 0003 50 40

Hand Simulation 0 0 0 0 What is the fetch/execute cycle here? What ASCII character is this? 41

Your turn! What does this program do? 1111 0000 1 0000 1111

Steps for executing a machine-language program Machine code program in a file on disk Loader Execute Program in memory 43

SKIP Pep/8 Simulator 44

Problem 33 / 191 The PEP/8 computer has the following program in memory (in hex): 0001 49 0002 00 0003 08 0004 51 0005 00 0006 08 0007 00 Convert the program to binary and explain in your own words what it does. 45

Problem 33 / 191 The PEP/8 computer has the following program in memory (in hex): 0001 49 0002 00 0003 08 0004 51 0005 00 0006 08 0007 00 0008?? Character input, direct mode, to memory address 0x0008 Character output, direct mode, from memory address 0x0008 STOP ASCII code of character entered by user 46

Code (instructions) Remember: In a Von Neumann architecture, code and data are stored in the same memory! 0001 49 0002 00 0003 08 0004 51 0005 00 0006 08 0007 00 0008?? Character input, direct mode, to memory address 0x0008 Character output, direct mode, from memory address 0x0008 STOP ASCII code of character entered by user data 47

Fact: Writing programs in machine language sucks! (i.e. it is time-consuming, boring, errorprone, unintuitive, etc.) 48

that s why they invented assembly language 49

6.4 Assembly Language Assembly language A language that uses mnemonic codes to represent machine-language instructions Assembler A program that reads each of the instructions in mnemonic form and translates it into the machine-language equivalent 50

Steps for executing an assembly-language program Loader 51 Execute Program in memory

Pep/8 Assembly Language Opcode is 04 Opcode is 31 Opcode is 38 Opcode is 39 52

Hello program in assembly mnemonic operand addressing mode comments CHARO CHARO CHARO CHARO CHARO STOP.END 0x0048, i ;Outputs character 'H' 0x0065, i 0x006C, i 0x006C, i 0x006F, i What in the world is this?! 53

A New Program Problem: Read and sum three values and print the sum How would you do it by hand? 54

Declaring variables in assembly: We simply reserve space in memory for them! These are labels. They are placeholders for memory addresses - the assembler will replace them with numeric addresses when generating the machine code! 55

Assembler directives, a.k.a. pseudo-ops What is the difference between operations and pseudo operations? 56

Completed Program sum:.word 0x0000 num1:.block 2 num2:.block 2 num3:.block 2 main: LDA sum,d DECI num1,d ADDA num1,d DECI num2,d ADDA num2,d DECI num3,d ADDA num3,d STA sum,d DECO sum,d STOP.END 57

Completed Program Houston, we have a problem! How does the CPU know that the program starts here? sum:.word 0x0000 num1:.block 2 num2:.block 2 Num3:.BLOCK 2 main: LDA sum,d DECI num1,d ADDA num1,d DECI num2,d ADDA num2,d DECI num3,d ADDA num3,d STA sum,d DECO sum,d STOP.END 58

Solution: Branch instruction BR main sum:.word 0x0000 num1:.block 2 num2:.block 2 num3:.block 2 main: LDA sum, d DECI num1, d ADDA num1, d DECI num2, d ADDA num2, d DECI num3, d ADDA num3, d STA sum, d DECO sum, d STOP.END 59

QUIZ: Show the memory contents! BR main sum:.word 0x0000 num1:.block 2 num2:.block 2 num3:.block 2 main: LDA sum, d DECI num1, d ADDA num1, d DECI num2, d ADDA num2, d DECI num3, d ADDA num3, d STA sum, d DECO sum, d STOP.END Memory map on next slide 60

61

sum num1 num2 num3 BR LDA DECI ADDA DECI 62

Challenge: Write all the machine code (in hex) sum num1 num2 num3 BR LDA DECI ADDA DECI 63

Extra-credit sum num1 num2 num3 BR LDA DECI ADDA DECI 64

Your turn! Change the program so it adds up four numbers 65

We have covered sections 6.1, 6.2, 6.3, and part of 6.4. Read the text carefully and make sure you can explain in your own words what each instruction accomplishes. Individual work (to do in notebook for next time): 16, 17, 19, 21-26 EoL2 66