June 7, 2016©2011 Craig Zilles (partly adapted from slides by Howard Huang) 1 CS232: Computer Architecture II Fall 2011 Nvidia Fermi GPU.

Slides:



Advertisements
Similar presentations
1 Lecture 3: MIPS Instruction Set Today’s topic:  More MIPS instructions  Procedure call/return Reminder: Assignment 1 is on the class web-page (due.
Advertisements

Lecture 13: 10/8/2002CS170 Fall CS170 Computer Organization and Architecture I Ayman Abdel-Hamid Department of Computer Science Old Dominion University.
CS/COE0447 Computer Organization & Assembly Language
Branches Two branch instructions:
INSTRUCTION SET ARCHITECTURES
There are two types of addressing schemes:
Chapter 2.
ITCS 3181 Logic and Computer Systems 2015 B. Wilkinson slides3.ppt Modification date: March 16, Addressing Modes The methods used in machine instructions.
1 Today’s lecture  Last lecture we started talking about control flow in MIPS (branches)  Finish up control-flow (branches) in MIPS —if/then —loops —case/switch.
1 Nested Procedures Procedures that don't call others are called leaf procedures, procedures that call others are called nested procedures. Problems may.
The University of Adelaide, School of Computer Science
Instruction Set Architecture & Design
COSC 120 Computer Programming
The Analytical Engine Module 6 Program Translation.
1 ICS 51 Introductory Computer Organization Fall 2006 updated: Oct. 2, 2006.
CSCE 121, Sec 200, 507, 508 Fall 2010 Prof. Jennifer L. Welch.
CS 300 – Lecture 19 Intro to Computer Architecture / Assembly Language C Coding & The Simulator Caches.
Lecture 5 Sept 14 Goals: Chapter 2 continued MIPS assembly language instruction formats translating c into MIPS - examples.
9/29: Lecture Topics Memory –Addressing (naming) –Address space sizing Data transfer instructions –load/store on arrays on arrays with variable indices.
MIPS assembly. Computer What’s in a computer? Processor, memory, I/O devices (keyboard, mouse, LCD, video camera, speaker), disk, CD drive, …
IT253: Computer Organization Lecture 4: Instruction Set Architecture Tonga Institute of Higher Education.
DEPARTMENT OF COMPUTER SCIENCE & TECHNOLOGY FACULTY OF SCIENCE & TECHNOLOGY UNIVERSITY OF UWA WELLASSA 1 CST 221 OBJECT ORIENTED PROGRAMMING(OOP) ( 2 CREDITS.
Computer Systems Organization CS 1428 Foundations of Computer Science.
CS 147 June 13, 2001 Levels of Programming Languages Svetlana Velyutina.
Computer Architecture Instruction Set Architecture Lynn Choi Korea University.
Registers and MAL Lecture 12. The MAL Architecture MAL is a load/store architecture. MAL supports only those addressing modes supported by the MIPS RISC.
1 CISC181 Introduction to Computer Science Dr. McCoy Lecture 1 February 8, 2005.
1 CS232: Computer Architecture II Fall 2011 Intel i7 Quad-core.
CSCI 136 Lab 1: 135 Review.
4-1 Chapter 4 - The Instruction Set Architecture Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Principles.
Execution of an instruction
CS 111 – Sept. 15 Chapter 2 – Manipulating data by performing instructions “What is going on in the CPU?” Commitment: –Please read through section 2.3.
November 18, 2015Memory and Pointers in Assembly1 What does this C code do? int foo(char *s) { int L = 0; while (*s++) { ++L; } return L; }
Lecture 11: 10/1/2002CS170 Fall CS170 Computer Organization and Architecture I Ayman Abdel-Hamid Department of Computer Science Old Dominion University.
CHAPTER 6 Instruction Set Architecture 12/7/
December 21, 2015©2006 Craig Zilles (adapted from slides by Howard Huang) 1 CS232: Computer Architecture II Spring 2009.
A.Abhari CPS1251 Topic 1: Introduction to Computers Computer Hardware Computer components Connecting Computers Computer Software Operating System (OS)
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
1 The Instruction Set Architecture September 27 th, 2007 By: Corbin Johnson CS 146.
1 CS232: Computer Architecture II Fall 2010 AMD dual-core Opteron.
CBP 2002ITY 270 Computer Architecture1 Module Structure Whirlwind Review – Fetch-Execute Simulation Instruction Set Architectures RISC vs x86 How to build.
Addressing Modes. Register Addressing Immediate Addressing Base Addressing Indexed Addressing PC-Relative Addressing.
CS232: Computer Architecture II
Arrays in MIPS Assembly Computer Organization and Assembly Language: Module 6.
ACCESS IC LAB Graduate Institute of Electronics Engineering, NTU Review of RISC CPU Designs Lecturer :吳安宇 Date : 2005/3/4.
Computer Organization Instructions Language of The Computer (MIPS) 2.
1 Basic Processor Architecture. 2 Building Blocks of Processor Systems CPU.
Copyright 2006 by Timothy J. McGuire, Ph.D. 1 MIPS Programming Model CS 333 Sam Houston State University Dr. Tim McGuire.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
Hello world !!! ASCII representation of hello.c.
Operating Systems A Biswas, Dept. of Information Technology.
CSCI-365 Computer Organization Lecture Note: Some slides and/or pictures in the following are adapted from: Computer Organization and Design, Patterson.
MIPS Arithmetic is 32 bits
Computers’ Basic Organization
Computer Architecture & Operations I
Assembly language.
Advanced Computer Architecture
Microprocessor Systems Design I
© Craig Zilles (adapted from slides by Howard Huang)
Morgan Kaufmann Publishers
Microprocessor Systems Design I
A Closer Look at Instruction Set Architectures: Expanding Opcodes
Datapaths For the rest of the semester, we’ll focus on computer architecture: how to assemble the combinational and sequential components we’ve studied.
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
ECEG-3202 Computer Architecture and Organization
3.
Advanced Computer Architecture
9/27: Lecture Topics Memory Data transfer instructions
© Craig Zilles (adapted from slides by Howard Huang)
Presentation transcript:

June 7, 2016©2011 Craig Zilles (partly adapted from slides by Howard Huang) 1 CS232: Computer Architecture II Fall 2011 Nvidia Fermi GPU

2  Computer architecture is about building and analyzing computer systems  Course web page:  Piazza  Make sure you have an EWS account: —If you are not an engineering student, contact the TAs! What is computer architecture about? Memory Processor Input/Output Compiler HLLASM

June 7, 2016©2011 Craig Zilles (partly adapted from slides by Howard Huang) 3 Why should you care?  It is interesting. —How do you make a processor that runs at 3Ghz?  It will help you be a better programmer. —Understanding how your program is translated to assembly code lets you reason about correctness and performance. —Demystify the seemingly arbitrary (e.g., bus errors, segmentation faults )  Many cool jobs require an understanding of computer architecture. —The cutting edge is often pushing computers to their limits. —Supercomputing, games, portable devices, etc.  Computer architecture illustrates many fundamental ideas in computer science —Abstraction, caching, and indirection are CS staples

June 7, 2016©2011 Craig Zilles (partly adapted from slides by Howard Huang) 4 CS232: Computer Architecture II Fall 2011  Two topics: —Background: Low-level programming in High-level languages Bit-wise operations and shifting —Continuing from section: Memory & Loads/Stores in MIPS Write MIPS programs that use more than just registers

June 7, 2016©2011 Craig Zilles (partly adapted from slides by Howard Huang) 5 Bit-wise Arithmetic

June 7, 2016©2011 Craig Zilles (partly adapted from slides by Howard Huang) 6 Low-level Programming in “High-level” Languages  Very often it is necessary to store a large number of very small data items.  Example: A Social Security Number (SSN) registry —Needs to keep track of how which SSNs have already been allocated.  How much space is required?

June 7, 2016©2011 Craig Zilles (partly adapted from slides by Howard Huang) 7 Storing collections of bits as integers  Store N bits in each N-bit integer, only need 10 9 /N integers —Requires 10 9 /8 bytes = 125MBs of storage (fits on a CD)  Allocate array: int array_size = /_____________ unsigned int SSN_registry[array_size];  Want two operations on this array: —check_SSN: returns 1 if SSN is used, 0 otherwise —set_SSN: marks an SSN as used SSN #7 SSN #68

June 7, 2016©2011 Craig Zilles (partly adapted from slides by Howard Huang) 8 check_SSN int check_SSN(unsigned int SSN_registry[], int ssn) { int word_index = ssn / sizeof(int); int word = SSN_registry[word_index];

June 7, 2016©2011 Craig Zilles (partly adapted from slides by Howard Huang) 9 check_SSN int check_SSN(unsigned int SSN_registry[], int ssn) { int word_index = ssn / sizeof(int); int word = SSN_registry[word_index]; int bit_offset = ssn % sizeof(int) // % is the remainder operation word = word >> bit_offset; // >> shifts a value “right” (note: zeros are inserted at the left because it is an unsigned int)

June 7, 2016©2011 Craig Zilles (partly adapted from slides by Howard Huang) 10 check_SSN int check_SSN(unsigned int SSN_registry[], int ssn) { int word_index = ssn / sizeof(int); int word = SSN_registry[word_index]; int bit_offset = ssn % sizeof(int) word = word >> bit_offset; word = (word & 1); // & is the bit-wise logical AND operator return word;(each bit position is considered independently) } &

June 7, 2016©2011 Craig Zilles (partly adapted from slides by Howard Huang) 11 set_SSN void set_SSN(unsigned int SSN_registry[], int ssn) { int bit_offset = ssn % sizeof(int) int new_bit = (1 << bit_offset) // “left” shift the 1 to the desired spot (always shifts in 0’s at the right)

June 7, 2016©2011 Craig Zilles (partly adapted from slides by Howard Huang) 12 set_SSN void set_SSN(unsigned int SSN_registry[], int ssn) { int bit_offset = ssn % sizeof(int) int new_bit = (1 << bit_offset) int word_index = ssn / sizeof(int); int word = SSN_registry[word_index];

June 7, 2016©2011 Craig Zilles (partly adapted from slides by Howard Huang) set_SSN void set_SSN(unsigned int SSN_registry[], int ssn) { int bit_offset = ssn % sizeof(int) int new_bit = (1 << bit_offset) int word_index = ssn / sizeof(int); int word = SSN_registry[word_index]; word = word | new_bit; // bit-wise logical OR sets the desired bit |

June 7, 2016©2011 Craig Zilles (partly adapted from slides by Howard Huang) set_SSN void set_SSN(unsigned int SSN_registry[], int ssn) { int bit_offset = ssn % sizeof(int) int new_bit = (1 << bit_offset) int word_index = ssn / sizeof(int); int word = SSN_registry[word_index]; word = word | new_bit; SSN_registry[word_index] = word; // write back the word into array } Shorthand for last 3 lines: SSN_registry[word_index] |= new_bit; |

June 7, 2016©2011 Craig Zilles (partly adapted from slides by Howard Huang) 15 What you just saw  Storage of a collection of booleans in an integer  Use of bit-wise logical operations to read and write specific bits  Use of shifts to move bits with an integer  This stuff gets used all over the place in real code: —Bitmap graphics —Network packet headers —Operating system tracking free disk blocks

June 7, 2016©2011 Craig Zilles (partly adapted from slides by Howard Huang) 16 Topic 2: Memory & Loads/Stores in MIPS  Last time, we saw registers and basic arithmetic, ultimately leading to: void main() { int i = 516; int j = i*(i+1)/2; i = i + j; } main: # start of main li $t0, 516 # i = 516 addi $t1, $t0, 1 # i + 1 mul $t1, $t0, $t1 # i * (i + 1) li $t2, 2 div $t1, $t1, $t2 # j = i*(i+1)/2 add $t0, $t0, $t1 # i = i + j jr $ra # return

June 7, 2016©2011 Craig Zilles (partly adapted from slides by Howard Huang) 17 We need more space!  Registers are fast and convenient, but we have only 32 of them, and each one is just 32-bits wide. —That’s not enough to hold data structures like large arrays. —We also can’t access data elements that are wider than 32 bits.  We need to add some main memory to the system! —RAM is cheaper and denser than registers, so we can add lots of it. —But memory can be significantly slower, so registers should be used whenever possible.

June 7, 2016©2011 Craig Zilles (partly adapted from slides by Howard Huang) 18 Memory review  Memory sizes are specified much like register files; here is a 2 k x n RAM.  A chip select input CS enables or “disables” the RAM.  ADRS specifies the memory location to access.  WR selects between reading from or writing to the memory. —To read from memory, WR should be set to 0. OUT will be the n-bit value stored at ADRS. —To write to memory, we set WR = 1. DATA is the n-bit value to store in memory. CSWROperation 0xNone 10Read selected address 11Write selected address 2 k  n memory ADRSOUT DATA CS WR n k n

June 7, 2016©2011 Craig Zilles (partly adapted from slides by Howard Huang) 19 MIPS memory  MIPS memory is byte-addressable, which means that each memory address references an 8-bit quantity.  The (original) MIPS architecture can support up to 32 address lines. —This results in a 2 32 x 8 RAM, which would be 4 GB of memory. —Not all actual MIPS machines will have this much! 2 32  8 memory ADRSOUT DATA CS WR Address 8-bit data

June 7, 2016©2011 Craig Zilles (partly adapted from slides by Howard Huang) 20 Loading and storing bytes  The MIPS instruction set includes dedicated load and store instructions for accessing memory.  MIPS uses indexed addressing. —The address operand specifies a signed constant and a register. —These values are added to generate the effective address.  The MIPS “load byte” instruction lb transfers one byte of data from main memory to a register. lb $t0, 20($a0)# $t0 = Memory[$a0 + 20]  The “store byte” instruction sb transfers the lowest byte of data from a register into main memory. sb $t0, 20($a0)# Memory[$a0 + 20] = $t0

June 7, 2016©2011 Craig Zilles (partly adapted from slides by Howard Huang) 21 Byte loads  Question: if you load a byte (8 bits) into a register (32 bits), what value do those other 24 bits have?