Computer Architecture COMP360

Similar documents
Parallelism. Execution Cycle. Dual Bus Simple CPU. Pipelining COMP375 1

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

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

CMPUT101 Introduction to Computing - Summer 2002

Assembly Language: Overview!

CS1004: Intro to CS in Java, Spring 2005

CMPUT101 Introduction to Computing - Summer 2002

A B C ((NOT A) AND B) OR C

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

BASIC COMPUTER ORGANIZATION. Operating System Concepts 8 th Edition

Computer Architecture (part 2)

Processor design - MIPS

Compiler Code Generation COMP360

The von Neumann Architecture. IT 3123 Hardware and Software Concepts. The Instruction Cycle. Registers. LMC Executes a Store.

RAID 0 (non-redundant) RAID Types 4/25/2011

Processing Unit CS206T

Introduction to Computers & Programming

William Stallings Computer Organization and Architecture. Chapter 11 CPU Structure and Function

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

CPU Structure and Function. Chapter 12, William Stallings Computer Organization and Architecture 7 th Edition

Micro-programmed Control Ch 15

CPU Structure and Function

Chapter 5 12/2/2013. Objectives. Computer Systems Organization. Objectives. Objectives (continued) Introduction. INVITATION TO Computer Science 1

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

Micro-programmed Control Ch 15

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

Instruction-set Design Issues: what is the ML instruction format(s) ML instruction Opcode Dest. Operand Source Operand 1...

Assembly Language: Overview

MICROPROGRAMMED CONTROL

Introduction to Computer Science. Homework 1

Class Notes. Dr.C.N.Zhang. Department of Computer Science. University of Regina. Regina, SK, Canada, S4S 0A2

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

COS 140: Foundations of Computer Science

Micro-programmed Control Ch 17

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

Hardwired Control (4) Micro-programmed Control Ch 17. Micro-programmed Control (3) Machine Instructions vs. Micro-instructions

DC57 COMPUTER ORGANIZATION JUNE 2013

These actions may use different parts of the CPU. Pipelining is when the parts run simultaneously on different instructions.

Chapter 5:: Target Machine Architecture (cont.)

ASSEMBLY LANGUAGE MACHINE ORGANIZATION

Knowledge Organiser. Computing. Year 10 Term 1 Hardware

CPU Structure and Function

Register-Level Design

Second Part of the Course

Outcomes. Lecture 13 - Introduction to the Central Processing Unit (CPU) Central Processing UNIT (CPU) or Processor

Computer Architecture Review. ICS332 - Spring 2016 Operating Systems

CS 101, Mock Computer Architecture

Digital Forensics Lecture 3 - Reverse Engineering

Assembly Language Programming of 8085

1. Fundamental Concepts

Data Manipulation. Chih-Wei Tang ( 唐之瑋 ) Department of Communication Engineering National Central University JhongLi, Taiwan

COMPUTER ORGANIZATION & ARCHITECTURE

CMPUT 101 with Solutions Quiz 2 (50 minutes) November 16, 2000

Computer Architecture 2/26/01 Lecture #

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

Computer Architecture and Organization. Instruction Sets: Addressing Modes and Formats

CS Computer Architecture

Control Hazards - branching causes problems since the pipeline can be filled with the wrong instructions.

Computer Science 324 Computer Architecture Mount Holyoke College Fall Topic Notes: MIPS Instruction Set Architecture

SCRAM Introduction. Philipp Koehn. 19 February 2018

Problem Set 1 Solutions

William Stallings Computer Organization and Architecture

Binghamton University. CS-140 Fall Pippin

Multiple Choice Type Questions

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

COMP375 Practice Final Exam

Instruction-set Design Issues: what is the ML instruction format(s) ML instruction Opcode Dest. Operand Source Operand 1...

Topic Notes: MIPS Instruction Set Architecture

Low-Level Essentials for Understanding Security Problems Aurélien Francillon

Little Man Computer (LMC)

C86 80C88 DS-186

COMP 303 MIPS Processor Design Project 3: Simple Execution Loop

Digital System Design Using Verilog. - Processing Unit Design

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

CSCE 5610: Computer Architecture

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

INSTRUCTION SET COMPARISONS

Lecture1: introduction. Outline: History overview Central processing unite Register set Special purpose address registers Datapath Control unit

Latches. IT 3123 Hardware and Software Concepts. Registers. The Little Man has Registers. Data Registers. Program Counter

Project - RTL Model. III. Design Decisions. Part 4 - May 17, Jason Nemeth. model is capable of modeling both provided benchmarks.

Blog -

AS/A Level Computing Syllabus 2011

Instruction Set Architecture. "Speaking with the computer"

Chapter 2: Instructions How we talk to the computer

Module 5 - CPU Design

Introduction. Datapath Basics

Overview. EE 4504 Computer Organization. Much of the computer s architecture / organization is hidden from a HLL programmer

Single cycle MIPS data path without Forwarding, Control, or Hazard Unit

101 Assembly. ENGR 3410 Computer Architecture Mark L. Chang Fall 2009

Input. Output. Datapath: System for performing operations on data, plus memory access. Control: Control the datapath in response to instructions.

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

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

Chapter 5: Computer Systems Organization

UNIT-II. Part-2: CENTRAL PROCESSING UNIT

Instruction Set II. COMP 212 Computer Organization & Architecture. COMP 212 Fall Lecture 7. Instruction Set. Quiz. What is an Instruction Set?

Chapter 5: Computer Systems Organization. Invitation to Computer Science, C++ Version, Third Edition

CS 24: INTRODUCTION TO. Spring 2018 Lecture 3 COMPUTING SYSTEMS

The MARIE Architecture

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

Transcription:

Computer Architecture COMP360

It s hardware that makes a machine fast. It's software that makes a fast machine slow. Craig Bruce

Basic Computer Components CPU I/O Device Cache I/O Controller Bus Memory

Logical Program Memory Organization Heap Stack Global data Program instructions

Logical Program Memory Organization Heap Stack Global data Intel method Program instructions

Logical Memory Use Program machine language instructions Global constants and global data (not in classes or methods) Heap dynamically acquired memory. Used when you create a new object Stack holds parameters, local variables and method call information

Hardware Memory Organization Some architectures provide mechanisms to separate the different memory types Other architectures just support one big piece of memory and let the software use it as necessary

Program Counter User registers Parts of CPU Instruction register including the address field Arithmetic Logic Unit (ALU) has circuits to do arithmetic Control Unit to run the fetch execute cycle

Fetch Execute Cycle 1. Fetch the instruction from the memory address in the Program Counter register 2. Increment the Program Counter 3. Decode the type of instruction 4. Fetch the operands 5. Execute the instruction 6. Store the results

Machine Language The instructions fetches are machine language All other computer languages are translated to machine language for execution by a compiler Machine language is unique to each architecture

Simple Instructions Machine language instructions are simple Move data to and from registers and memory Do arithmetic with two operands Go To is the only control structure

Imaginary Computer The computer has 16 registers labeled R0 to R15 All numbers are integers Instructions Load move a word from memory to a register Store move a word from a register to memory Add, sub, mult, div do arithmetic jump go to a new location jumpxx go to a location based on a comparison

Load & Store Instructions These two instructions move data between the registers and the memory You can load a register with a constant Load R2, dog Store R2, cow Load R6, 47

Names I use animals as variable names In assembler, a variable represents a memory location When you see an animal name, you know it is just a name I made up to represent a memory location

Arithmetic Instructions The add, subtract, multiple and divide instructions use three registers The first two are the input operands and the last is the output add R2, R5, R12 mult R3, R5, R3

Jump Instructions An unconditional jump goes to a new location rabbit add R2, R3, R6 // some other stuff jump rabbit

Conditional Jump A conditional jump compares two registers and jumps if the comparison is true If the comparison is false, the computer just goes to the next line of the program All logical comparisons are supported jumpeq jumpne jumpge R1, R7, someplace R3, R4, again R2, R11, proglocation

Whatever Instruction You Need This is an imaginary computer, you can imagine it to be whatever you need You can make up a new instruction if needed New instructions have to work within the rest of the architecture Only the load and store instructions access memory

Example Program cat = dog + cat * cow; load R4, cat load load mult add store R7, cow R12, dog R4, R7, R8 R8, R12, R3 R3, cat

Example Program with IF if (cow > dog) { cat = cow + dog; } else { cat = cow + goat; } load R1, cow load R2, dog jumple R1, R2, bigdog add R1, R2, R3 jump around bigdog load R4, goat add R1, R4, R3 around store R3, cat

Example Program with Loop cat = 9; while ( cat > 0) { goat = goat + cow; cat = cat 1; } more done load R3, 9 store R3, cat load R0, 0 load R1, 1 jumple R3, R0, done load R7, goat load R5, cow add R7, R5, R9 store R9, goat add R3, R1, R3 store R3, cat jump more

Optimized Example Program with Loop cat = 9; while ( cat > 0) { goat = goat + cow; cat = cat 1; } load R3, 9 load R0, 0 load R1, 1 load R7, goat load R5, cow more jumple R3, R0, done add R7, R5, R7 add R3, R1, R3 jump more done store R3, cat store R7, goat

Memory Hierarchy

Convert this to assembler cat = 5; if (dog > cat) { cat = cat + goat; }

Possible Solution cat = 5; if (dog > cat) { cat = cat + goat; } load R5, 5 load R1, dog jumple R1, R5, bigcat load R2, goat add R5, R2, R5 bigcat store R5, cat

Compile This to Assembler if (cat > goat) { bull = cow; } else { bull = bull + 1; }

Possible Solution if (cat > goat) { bull = cow; } else { bull = bull + 1; } load R1, cat load R2, goat jumpgt R1, R2, bigcat load R3, bull load R4, 1 add R3, R4, R3 jump done bigcat load R3, cow done store R3, bull

Convert to assembler better = number; do { good = better; better = (better + number/ better) / 2; }while (good!= better);

Possible Solution better = number; do { good = better; better = (better + number/ better) / 2; }while (good!= better); // R1=number, R2 = better, R3=good load R1, number load R2, R1 load R12, 2 againload R3, R2 div R1, R2, R5 add R5, R2, R5 div R5, R12, R2 jumpne R3, R2, again store R2, better

Reading In the next class we will discuss parameter passing Read textbook sections 9.1 & 9.2 https://en.wikipedia.org/wiki/parameter_(computer_ programming)