Topics Power tends to corrupt; absolute power corrupts absolutely. Computer Organization CS Data Representation

Similar documents
Instruction Set Design

Typical Processor Execution Cycle

CSCI 402: Computer Architectures. Instructions: Language of the Computer (1) Fengguang Song Department of Computer & Information Science IUPUI

ECE232: Hardware Organization and Design

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

COMPUTER ORGANIZATION & ARCHITECTURE

Computer Organization CS 206 T Lec# 2: Instruction Sets

ISA and RISCV. CASS 2018 Lavanya Ramapantulu

CSCI 402: Computer Architectures. Instructions: Language of the Computer (1) Fengguang Song Department of Computer & Information Science IUPUI

Instruction Sets: Characteristics and Functions Addressing Modes

Instruction Set Architecture

Lecture 4: Instruction Set Architecture

Math 230 Assembly Programming (AKA Computer Organization) Spring 2008

17. Instruction Sets: Characteristics and Functions

Introduction to C. Why C? Difference between Python and C C compiler stages Basic syntax in C

COS 140: Foundations of Computer Science

CHAPTER 5 A Closer Look at Instruction Set Architectures

EN164: Design of Computing Systems Topic 03: Instruction Set Architecture Design

CHAPTER 5 A Closer Look at Instruction Set Architectures

Computer Systems Architecture I. CSE 560M Lecture 3 Prof. Patrick Crowley

EC 413 Computer Organization

Computer Architecture. The Language of the Machine

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

CSEE 3827: Fundamentals of Computer Systems

CS4617 Computer Architecture

COSC 6385 Computer Architecture. Instruction Set Architectures

Assembly Language Design

COMP2121: Microprocessors and Interfacing. Instruction Set Architecture (ISA)

Chapter 2. Instructions: Language of the Computer. Adapted by Paulo Lopes

CSCE 5610: Computer Architecture

55:132/22C:160, HPCA Spring 2011

ECE 486/586. Computer Architecture. Lecture # 7

Rui Wang, Assistant professor Dept. of Information and Communication Tongji University.

William Stallings Computer Organization and Architecture 8 th Edition. Chapter 10 Instruction Sets: Characteristics and Functions

Instruction Sets: Characteristics and Functions

Machine Language Instructions Introduction. Instructions Words of a language understood by machine. Instruction set Vocabulary of the machine

CHAPTER 5 A Closer Look at Instruction Set Architectures

Real instruction set architectures. Part 2: a representative sample

Instruction Sets Ch 9-10

Page 1. Structure of von Nuemann machine. Instruction Set - the type of Instructions

Instruction Sets Ch 9-10

Instructions: Language of the Computer

Problem with Scanning an Infix Expression

Basic operators, Arithmetic, Relational, Bitwise, Logical, Assignment, Conditional operators. JAVA Standard Edition

Lecture 4: MIPS Instruction Set

Computer Organisation CS303

ENGN1640: Design of Computing Systems Topic 03: Instruction Set Architecture Design

COMP3221: Microprocessors and. and Embedded Systems. Instruction Set Architecture (ISA) What makes an ISA? #1: Memory Models. What makes an ISA?

EC-801 Advanced Computer Architecture

CS 61C: Great Ideas in Computer Architecture. (Brief) Review Lecture

When an instruction is initially read from memory it goes to the Instruction register.

General Purpose Processors

Problem with Scanning an Infix Expression

Page 1. Where Have We Been? Chapter 2 Representing and Manipulating Information. Why Don t Computers Use Base 10?

Instruction Set. Instruction Sets Ch Instruction Representation. Machine Instruction. Instruction Set Design (5) Operation types

Instruction Set Architecture. "Speaking with the computer"

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

EITF20: Computer Architecture Part2.1.1: Instruction Set Architecture

Chapter 13 Reduced Instruction Set Computers

Unsigned Binary Integers

Unsigned Binary Integers

Why Don t Computers Use Base 10? Lecture 2 Bits and Bytes. Binary Representations. Byte-Oriented Memory Organization. Base 10 Number Representation

Chapter 2. Instructions: Language of the Computer. HW#1: 1.3 all, 1.4 all, 1.6.1, , , , , and Due date: one week.

Chapter 2A Instructions: Language of the Computer

CSE 141 Computer Architecture Spring Lecture 3 Instruction Set Architecute. Course Schedule. Announcements

Introduction to Computers & Programming

MIPS R-format Instructions. Representing Instructions. Hexadecimal. R-format Example. MIPS I-format Example. MIPS I-format Instructions

Final Exam. 11 May 2018, 120 minutes, 26 questions, 100 points

Final Exam. 12 December 2018, 120 minutes, 26 questions, 100 points

Chapter 2. Instruction Set. RISC vs. CISC Instruction set. The University of Adelaide, School of Computer Science 18 September 2017

Zheng-Liang Lu Java Programming 45 / 79

COMP2611: Computer Organization. Data Representation

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

Computer Organization MIPS ISA

Why Don t Computers Use Base 10? Lecture 2 Bits and Bytes. Binary Representations. Byte-Oriented Memory Organization. Base 10 Number Representation

Instruction Set Architecture (ISA)

CSIS1120A. 10. Instruction Set & Addressing Mode. CSIS1120A 10. Instruction Set & Addressing Mode 1

Chapter 5:: Target Machine Architecture (cont.)

Chapter 2: Instructions How we talk to the computer

ECE 486/586. Computer Architecture. Lecture # 8

Inf2C - Computer Systems Lecture 2 Data Representation

CS 261 Fall Binary Information (convert to hex) Mike Lam, Professor

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

Topics in computer architecture

Lecture Topics. Branch Condition Options. Branch Conditions ECE 486/586. Computer Architecture. Lecture # 8. Instruction Set Principles.

CMSC Computer Architecture Lecture 2: ISA. Prof. Yanjing Li Department of Computer Science University of Chicago

Understand the factors involved in instruction set

Chapter 5. A Closer Look at Instruction Set Architectures

Chapter 5. A Closer Look at Instruction Set Architectures. Chapter 5 Objectives. 5.1 Introduction. 5.2 Instruction Formats

Processor. Han Wang CS3410, Spring 2012 Computer Science Cornell University. See P&H Chapter , 4.1 4

Chapter 5. A Closer Look at Instruction Set Architectures. Chapter 5 Objectives. 5.1 Introduction. 5.2 Instruction Formats

Representation of Information

Topic Notes: MIPS Instruction Set Architecture

Lecture 5: Instruction Set Architectures II. Take QUIZ 2 before 11:59pm today over Chapter 1 Quiz 1: 100% - 29; 80% - 25; 60% - 17; 40% - 3

Chapter 5. A Closer Look at Instruction Set Architectures

Stored Program Concept. Instructions: Characteristics of Instruction Set. Architecture Specification. Example of multiple operands

Lecture 4: Instruction Set Design/Pipelining

Bits and Bytes. Why bits? Representing information as bits Binary/Hexadecimal Byte representations» numbers» characters and strings» Instructions

The Arithmetic Operators. Unary Operators. Relational Operators. Examples of use of ++ and

The Arithmetic Operators

Transcription:

Computer Organization CS 231-01 Data Representation Dr. William H. Robinson November 12, 2004 Topics Power tends to corrupt; absolute power corrupts absolutely. Lord Acton British historian, late 19 th and early 20 th centuries Viewpoint of a high-level language Viewpoint of the microarchitecture Example microarchitectures http://eecs.vanderbilt.edu/courses/cs231/ 1 2 Structured Computer Organization Java TM as a High-Level Language The Java programming language is strongly typed Every variable and every expression has a type that is known at compile time Data types limit the following: Values that a variable can hold Values that an expression can produce Operations supported on those values Determines the meaning of those operations Strong typing helps detect errors at compile time 3 From the Java Virtual Machine Specification Second Edition. Copyright 1999 UCB. 4

Primitive Types Predefined by the Java programming language and named by a reserved keyword Includes the boolean type Restricted to TRUE and FALSE values Includes integral types byte, short, int, and long, whose values are 8-bit, 16-bit, 32- bit, and 64-bit signed two's-complement integers, respectively char, whose values are 16-bit unsigned integers representing Unicode characters Includes floating-point types float and double, which are associated with the 32-bit singleprecision and 64-bit double-precision IEEE Floating Point Standard 754 Operations on Data Types Operators on boolean Values Includes relational operators and logical operators Operators on Integral Values Includes numerical comparison, arithmetic operators, increment and decrement, bitwise logical and shift operators Operators on Floating-Point Values Includes numerical comparison, arithmetic operators, increment and decrement From the Java Virtual Machine Specification Second Edition. Copyright 1999 UCB. 5 From the Java Virtual Machine Specification Second Edition. Copyright 1999 UCB. 6 Error Checking by the Compiler Verifies each operation has proper inputs and outputs e.g. Boolean expressions used in control flow statements e.g. arithmetic operations are of compatible types e.g. strings (of characters) are properly displayed Some operations don t make sense e.g. (char x char) e.g. if (byte) then e.g. int = double + double software hardware Instruction Set Design instruction set Interface between software and hardware Both compilers and hardware must understand ISA Compilers translate high-level language into object code Hardware must directly execute or interpret ISA 7 Adapted from John Kubiatowicz s CS 252 lecture notes. Copyright 2003 UCB. 8

ISA: What Must be Specified? Instruction Fetch Instruction Decode Operand Fetch Execute Result Store Next Instruction Instruction format or encoding how is it decoded? Location of operands and result where other than memory? how many explicit operands? how are memory operands located? which operands can or cannot be in memory? Data type and size Operations what are supported Successor instruction jumps, conditions, branches fetch-decode-execute is implicit! Typical Operations (little change since 1960) Data Movement Arithmetic Shift Logical Control (Jump/Branch) Subroutine Linkage Interrupt Synchronization String Graphics (MMX) Load (from memory) Store (to memory) memory-to-memory move register-to-register move input (from I/O device) output (to I/O device) push, pop (to/from stack) integer (binary + decimal) or FP Add, Subtract, Multiply, Divide shift left/right, rotate left/right not, and, or, set, clear unconditional, conditional call, return trap, return test & set (atomic r-m-w) search, translate parallel subword ops (4 16-bit add) Adapted from John Kubiatowicz s CS 152 lecture notes. Copyright 2003 UCB. 9 Adapted from John Kubiatowicz s CS 152 lecture notes. Copyright 2003 UCB. 10 Data Types Bit: 0, 1 Bit String: sequence of bits of a particular length 4 bits is a nibble 8 bits is a byte 16 bits is a half-word 32 bits is a word 64 bits is a double-word Character: ASCII 7 bit code UNICODE 16 bit code IEEE Floating Point Standard 754 Provided designers with a correct model Allowed FP data to be exchanged among different computer systems Decimal: digits 0-9 encoded as 0000b thru 1001b two decimal digits packed per 8 bit byte Integers: 2's Complement Defines three formats Single precision (32 bits) Double precision (64 bits) Extended precision (80 bits) Only occurs within FP units Floating Point: exponent How many +/- #'s? Single Precision Double Precision M x R E Where is decimal pt? How are +/- exponents Extended Precision base represented? mantissa Adapted from John Kubiatowicz s CS 152 lecture notes. Copyright 2003 UCB. 11 12

Data Storage in Memory Memory is just a collection of bits The user defines the context or meaning ISA level instructions could use this data after placed in a register Big Endian Example: String Layout String layout starting at word address 100 char a[16] = WILLIAM ROBINSON Each byte contains the ASCII representation see Figure 2-41 on page 110 Big Endian Big Endian 100 0x57494C4C 100 0x57494C4C 100 W I L L 104 0x49414D20 104 0x49414D20 104 I A M 108 0x524F4249 108 0x524F4249 108 R O B I 112 0x4E534F4E 112 0x4E534F4E 112 N S O N 13 +0 +1 +2 +3 14 Sample data set From Program 2 1111 1111 1111 1111 1111 1111 1111 1111 1111 0000 0000 0000 0000 0000 0000 0001 0000 0000 0000 0000 0000 0000 0000 0000 1111 1000 1000 1000 1000 1000 1000 1000 1111 0000 0000 0000 0000 0000 0000 0000 What is represented by this? Could view it as 2 s complement integer Could parse it into ASCII characters Could be 32-bit color values Absolute Power The ISA has access to all the hardware features of the microarchitecture 1:1 mapping of assembly to ISA Does not restrict operands to data types e.g. a register that holds a 2 s complement integer could also be interpreted as unicode characters Compilers are designed to prevent this But we re not working at that level! 15 16

Computer Quotes "0x2B ~0x2B." Hamlet "There are 10 kinds of people in the world, those that understand binary and those that don't." "If you give someone a program, you will frustrate them for a day; if you teach them how to program, you will frustrate them for a lifetime." http://www.geocities.com/siliconvalley/orchard/4218/humor/quotes.html Summary Data forwarding hardware can eliminate stalls due to true data dependencies Scoreboarding is a technique to monitor the dynamic scheduling of instructions A typical machine will have in-order issue, out-of-order execution, and in-order completion 17 18 Example Microarchitectures Microarchitecture for IA-32 ISA IA-32 (Pentium II) CISC Version 9 SPARC (UltraSPARC II) RISC Java Virtual Machine (picojava II) Stack machine 19 20

Microarchitecture for IA-32 ISA Microarchitecture for IA-32 ISA 21 22 Microarchitecture for Version 9 SPARC ISA Microarchitecture for Version 9 SPARC ISA 23 24

Microarchitecture for JVM ISA Microarchitecture for JVM ISA 25 26 Instruction Folding Example Architectures Pentium II CISC UltraSPARC II RISC picojava II Stack machine 27 28

Similarity Among Architectures Implementation of the execution unit Use an opcode, 2 source registers, and a destination register (3-register format) Execute a micro-instruction in one cycle Deep pipelines and branch prediction Split I-cache and D-cache Difference Among Architectures How the instructions get to the execution unit Pentium II has to break CISC instructions into 3-register format picojava II must fold instructions into 3-register format UltraSPARC II already has the 3-register format 29 30