CS 300 – Lecture 19 Intro to Computer Architecture / Assembly Language C Coding & The Simulator Caches.

Slides:



Advertisements
Similar presentations
Lecture 9: MIPS Instruction Set
Advertisements

Week 3. Assembly Language Programming  Difficult when starting assembly programming  Have to work at low level  Use processor instructions >Requires.
INSTRUCTION SET ARCHITECTURES
1 ECE369 ECE369 Chapter 2. 2 ECE369 Instruction Set Architecture A very important abstraction –interface between hardware and low-level software –standardizes.
Chapter 2 Instructions: Language of the Computer
Instruction Set Architecture Classification According to the type of internal storage in a processor the basic types are Stack Accumulator General Purpose.
Computer Organization and Architecture
The CPU Revision Typical machine code instructions Using op-codes and operands Symbolic addressing. Conditional and unconditional branches.
Instruction Set Architecture & Design
1 ICS 51 Introductory Computer Organization Fall 2006 updated: Oct. 2, 2006.
CS 300 – Lecture 22 Intro to Computer Architecture / Assembly Language Virtual Memory.
CS 300 – Lecture 20 Intro to Computer Architecture / Assembly Language Caches.
Computer System Overview
CS 300 – Lecture 23 Intro to Computer Architecture / Assembly Language Virtual Memory Pipelining.
Choice for the rest of the semester New Plan –assembler and machine language –Operating systems Process scheduling Memory management File system Optimization.
CS 300 – Lecture 21 Intro to Computer Architecture / Assembly Language Virtual Memory.
What is an instruction set?
Data Transfer & Decisions I (1) Fall 2005 Lecture 3: MIPS Assembly language Decisions I.
IT253: Computer Organization Lecture 4: Instruction Set Architecture Tonga Institute of Higher Education.
Dr Mohamed Menacer College of Computer Science and Engineering Taibah University CS-334: Computer.
Computer Architecture and Organization
1 ICS 51 Introductory Computer Organization Fall 2009.
Computer Architecture EKT 422
CHAPTER 6 Instruction Set Architecture 12/7/
COMPUTER ORGANIZATION AND ASSEMBLY LANGUAGE Lecture 21 & 22 Processor Organization Register Organization Course Instructor: Engr. Aisha Danish.
Processor Structure and Function Chapter8:. CPU Structure  CPU must:  Fetch instructions –Read instruction from memory  Interpret instructions –Instruction.
1 The Instruction Set Architecture September 27 th, 2007 By: Corbin Johnson CS 146.
Lecture 2: Instruction Set Architecture part 1 (Introduction) Mehran Rezaei.
Ass. Prof. Dr Masri Ayob TK 2123 Lecture 14: Instruction Set Architecture Level (Level 2)
1 Computer Architecture. 2 Basic Elements Processor Main Memory –volatile –referred to as real memory or primary memory I/O modules –secondary memory.
1 TM 1 Embedded Systems Lab./Honam University ARM Microprocessor Programming Model.
CHAPTER 2 Instruction Set Architecture 3/21/
Datapath and control Dr. ir. A.B.J. Kokkeler 1. What is programming ? “Programming is instructing a computer to do something for you with the help of.
F453 Module 8: Low Level Languages 8.1: Use of Computer Architecture.
Computer Architecture. Instruction Set “The collection of different instructions that the processor can execute it”. Usually represented by assembly codes,
PROGRAMMING THE BASIC COMPUTER
David Kauchak CS 52 – Spring 2017
CS/COE 0447 (term 2181) Jarrett Billingsley
Overview of Instruction Set Architectures
Control Unit Lecture 6.
Instruction Set Architecture
Microprocessor Systems Design I
Morgan Kaufmann Publishers
PROGRAMMING THE BASIC COMPUTER
Microprocessor Systems Design I
Introduction to Assembly Language
BIC 10503: COMPUTER ARCHITECTURE
The University of Adelaide, School of Computer Science
Instruction encoding We’ve already seen some important aspects of processor design. A datapath contains an ALU, registers and memory. Programmers and compilers.
ECEG-3202 Computer Architecture and Organization
Chapter 9 Instruction Sets: Characteristics and Functions
MIPS History MIPS is a computer family
Other ISAs Next, we’ll first we look at a longer example program, starting with some C code and translating it into our assembly language. Then we discuss.
Other ISAs Next, we’ll first we look at a longer example program, starting with some C code and translating it into our assembly language. Then we discuss.
MARIE: An Introduction to a Simple Computer
ECEG-3202 Computer Architecture and Organization
COMS 361 Computer Organization
Introduction to Microprocessor Programming
Instructions in Machine Language
MIPS History MIPS is a computer family
Chapter 6 Programming the basic computer
CPU Structure CPU must:
Instruction Set Architecture
Chapter 10 Instruction Sets: Characteristics and Functions
Chapter 4 The Von Neumann Model
Presentation transcript:

CS 300 – Lecture 19 Intro to Computer Architecture / Assembly Language C Coding & The Simulator Caches

A Test We'll have a test on Thursday. 45 minutes. Open book / notes but no computing allowed. You'll need to understand MIPS programming and C. Also numeric stuff. We'll review the worksheet and Quicksort before the test. You WILL be writing code!

Assembly Language Coding Why is assembly language so hard? The instructions are so far removed from what's really going on. It's up to you to place GOOD comments in your code so that others can read it. And so you can understand it too. Remember this on the test!

Good / Bad Comments The bad: (from an anonymous student) j done # Jump to done addi $s2, $s1, 1 # increment $s1 into $s2 The good: addi $s2, $zero, 1 # set flag to say a swap happened noswap: addi $s0, $s0, 4 # bump pointer to next element of arr ($s0) addi $s1, $s1, -1 # number of remaining compares

What's The Problem? * Registers don't have names that make sense – if you increment $s1, what's really in $s1? * Control flow is hard to understand: refer back to C code, use good labels, state what condition the program is in at a code point * Data structures are implicit: relate your code to C level structures to make it more readable.

Optimizing Quicksort How fast can we make quicksort run? As assembly language programmers we have a lot of control over this … What are some concrete ideas? How do these ideas translate into compiler optimizations?

Next Homework This is a C project that will last two weeks – I'll collect it on the 21 st. There will be a turnin next week to demonstrate progress – I will get the details in the wiki. Will anyone be gone Thanksgiving week?

A Mini Homework This will be due Thursday. It's mainly to help you with the test – I won't grade it in detail but you do have to turn it in. Let's do a few problems in class.

My Little Buddy

Writing Your Own SPIM Need to decode and execute NOVA instructions. We'll skip the IO instructions except for a few special ones. Two basic instructions: arithmetic (add, subtract, …) memory reference (LDA, STA, JMP, JSR, ISZ, DSZ)

Machine Layout 16 Bit Architecture 4 Registers: 0,1,2,3 1 "Carry bit" PC (15 bits) Memory: 15 bit address (max is 32K words), 16 bits per word.

Arithmetics Instruction layout: Op code (1 bit) (topmost bit = 1) Source AC (2 bits) (AC number) Destination AC (2 bits) (AC Number) Arithmetic function (3 bits) (ADD, SUB, ADC, MOV, INC, COM, NEG) Initial carry (2 bits) (O, Z, C) Shift (2 bits) (L, R, S) Skip condition (3 bits) (SZR, SNR, SZC, SNC, SEZ, SBN, SKP) No Load (1 bit) (#)

Memory References Address: 8 bit unsigned (page 0) or 8 bit signed + PC / AC2 / AC3 Indirect addressing uses top bit of an address

Functionality * Load programs into memory * Start at a given address * Inspect processor state * Set a breakpoint (one will be enough) * Simple IO (just printing a character) * Statistics (# of instructions executed) * Performance of your C code is important!

The Memory Hierarchy This is an essential part of the course … How do we manage storage? Where is the storage? * Network (the entire WWW!) * Disk (may cache network) * Memory (may cache disk) * On chip / off chip caches * Registers Each is smaller / faster than the one above.

Prediction Storage strategies often need to predict what will happen next: * If a program opens a file, it usually needs to read it starting at the beginning * If a program reads a memory address, it will likely use adjacent addresses too * If a program writes a memory address it will usually read the value again soon Hardware / software often has to take a guess at what will happen next.

Locations We address data using locations (pointers). These may refer to url, disk, memory word, or register number. Locations have to work "correctly" when a value is shared in any way. The operation of the storage device requires that readers see what the most recent writer has written.

Cache A cache replicates a portion of a larger memory. It makes use of the fact that most references are to a relatively small number of locations.