Data Types. Numeric Data Types

Similar documents
ARM Cortex A9. ARM Cortex A9

Computer Organization & Assembly Language Programming

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

Bits. Binary Digits. 0 or 1

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

COMPUTER ORGANIZATION & ARCHITECTURE

CHAPTER 5 A Closer Look at Instruction Set Architectures

17. Instruction Sets: Characteristics and Functions

COSC 6385 Computer Architecture. Instruction Set Architectures

ECE 486/586. Computer Architecture. Lecture # 7

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

Computer Organization CS 206 T Lec# 2: Instruction Sets

Chapter 11. Instruction Sets: Addressing Modes and Formats. Yonsei University

CHAPTER 5 A Closer Look at Instruction Set Architectures

ECE 154A Introduction to. Fall 2012

Chapter 4: The Building Blocks: Binary Numbers, Boolean Logic, and Gates. Invitation to Computer Science, C++ Version, Third Edition

Computer Organization and Architecture (CSCI-365) Sample Final Exam

Basic Definition INTEGER DATA. Unsigned Binary and Binary-Coded Decimal. BCD: Binary-Coded Decimal

CHAPTER 5 A Closer Look at Instruction Set Architectures

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

MACHINE LEVEL REPRESENTATION OF DATA

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

Number System. Introduction. Decimal Numbers

COS 140: Foundations of Computer Science

CS4617 Computer Architecture

Instruction Sets Ch 9-10

Instruction Sets Ch 9-10

Basic data types. Building blocks of computation

Chapter 1. Computer Abstractions and Technology. Lesson 3: Understanding Performance

The type of all data used in a C (or C++) program must be specified

Zheng-Liang Lu Java Programming 45 / 79

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

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

Programmable Machines

Programmable Machines

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

06-2 EE Lecture Transparency. Formatted 14:50, 4 December 1998 from lsli

Chapter 5. A Closer Look at Instruction Set Architectures

The type of all data used in a C++ program must be specified

The MARIE Architecture

SISTEMI EMBEDDED. Basic Concepts about Computers. Federico Baronti Last version:

Instruction Sets: Characteristics and Functions Addressing Modes

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

Cpu Architectures Using Fixed Length Instruction Formats

CPSC 3740 Programming Languages University of Lethbridge. Data Types

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

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

CS313D: ADVANCED PROGRAMMING LANGUAGE

Announcements HW1 is due on this Friday (Sept 12th) Appendix A is very helpful to HW1. Check out system calls

Instruction Sets: Characteristics and Functions

DRAM uses a single capacitor to store and a transistor to select. SRAM typically uses 6 transistors.

CPE300: Digital System Architecture and Design

COMPUTER ORGANIZATION AND DESI

9/3/2015. Data Representation II. 2.4 Signed Integer Representation. 2.4 Signed Integer Representation

Trap Vector Table. Interrupt Vector Table. Operating System and Supervisor Stack. Available for User Programs. Device Register Addresses

Instructions: Language of the Computer

Advanced Parallel Architecture Lesson 3. Annalisa Massini /2015

Universität Dortmund. ARM Architecture

Pipelining. CSC Friday, November 6, 2015

Beginning C Programming for Engineers

Chapter 4. The Processor

CSCE 5610: Computer Architecture

SECONDARY SCHOOL, L-IMRIEĦEL HALF YEARLY EXAMINATIONS 2016/2017

Instruction Set Design

Problem with Scanning an Infix Expression

Lecture 4: ISA Tradeoffs (Continued) and Single-Cycle Microarchitectures

CS3350B Computer Architecture

Unsigned Binary Integers

Unsigned Binary Integers

COMPUTER ORGANIZATION AND DESIGN. 5 th Edition. The Hardware/Software Interface. Chapter 4. The Processor

M1 Computers and Data

Instruction Set Architecture ISA ISA

COMPUTER ORGANIZATION AND DESIGN. 5 th Edition. The Hardware/Software Interface. Chapter 4. The Processor

Chapter 4. Instruction Execution. Introduction. CPU Overview. Multiplexers. Chapter 4 The Processor 1. The Processor.

Behind the Curtain. Introduce TA Friday 1 st lab! (1:30-3:30) (Do Prelab before) 1 st Problem set on Thurs. Comp 411 Fall /16/13

Chapter 4. The Processor

Introduction to Computer Science. Homework 1

Chapter 4. The Processor

Final Lecture. A few minutes to wrap up and add some perspective

ECE 154A Introduction to. Fall 2012

Software and Hardware

Introduction to the MIPS. Lecture for CPSC 5155 Edward Bosworth, Ph.D. Computer Science Department Columbus State University

More Programming Constructs -- Introduction

Math 230 Assembly Programming (AKA Computer Organization) Spring 2008

CS3350B Computer Architecture MIPS Introduction

Computer System Architecture

Experimental Methods I

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

Addressing Modes. Immediate Direct Indirect Register Register Indirect Displacement (Indexed) Stack

Data Representation. DRAM uses a single capacitor to store and a transistor to select. SRAM typically uses 6 transistors.

ASSEMBLY LANGUAGE MACHINE ORGANIZATION

Processor design - MIPS

Design of CPU Simulation Software for ARMv7 Instruction Set Architecture

Bits, Words, and Integers

Chapter 2. Instruction Set Principles and Examples. In-Cheol Park Dept. of EE, KAIST

Lecture 4: Instruction Set Architecture

Chapter 2A Instructions: Language of the Computer

Set Theory in Computer Science. Binary Numbers. Base 10 Number. What is a Number? = Binary Number Example

Transcription:

Data Types Data comes in different types and different formats Integer Floating point numbers Characters A key issue is whether there is hardware support for a particular data type. Hardware support means that one or more instructions expect data in a particular format, and the user is not free to pick a different format. Which bit in a number represents the sign of that number? How many bits are used to represent a number? Explicit support for double-precision? Are calculations performed in the hardware on 64-bit numbers or in the software on two 32-bit numbers? Numeric Data Types Data types can be divided into two categories: numeric and nonnumeric. Numeric data types include Integers. They come in many lengths: 8, 16, 32, and 64 bits. Integers count things Most modern computers store integers in two s complement binary notation Some computers support unsigned as well as signed integers. Floating-point numbers Cannot be expressed as integers: 3.5 for example. They have lengths of 32, 64, or 128 bits. Most computers have instructions for doing floating-point arithmetic. Many computers have separate registers for holding integer operands and for holding floating-point operands. 1

Nonnumeric Data Types Nonnumerical applications include: email, surfing the Web, digital photography, and multimedia creation and playback. For these applications, other data types are needed and are frequently supported by ISA-level instructions. Characters are clearly important, although not every computer provides hardware support for them. The most common character codes are ASCII and Unicode. These support 7-bit characters and 16-bit characters, respectively. It is not uncommon for the ISA level to have special instructions intended for handling character strings, that is, consecutive runs of characters. These strings are sometimes delimited by a special character at the end. These instructions typically perform copy, search, edit, and other functions on strings. Nonnumeric Data Types Boolean values are also important. A Boolean value can take on one of two values: true or false. In theory, a single bit can represent a Boolean, with 0 as false and 1 as true (or vice versa). In practice, a byte or word is use represent a Boolean value because individual bits in a byte do not have their own addresses and so are not directly accessible. A common convention uses 0 for false and everything else for true. The one situation in which a Boolean value is normally represented by 1 bit is when there is a collection of them, so a 32-bit word could be interpreted and holding 32 Boolean values. Such a collection is called a bit map and is useful in many contexts. 2

Data Types on the Core i7 The Core i7 numeric data types. The Core i7 supports signed two s complement integers, unsigned integers, binary coded decimal numbers, and IEEE 754 floating-point numbers. The processor can optionally be run in 64-bit mode which supports 64-bit registers and operations. Operands do not have to be aligned in memory, but better performance is achieved if word addresses are multiples of 4 bytes. The Core i7 is also good at manipulating 8-bit ASCII characters: there are special instructions for copying and searching character strings. Data Types on the ARM The ARM numeric data types. The ARM can support 8-, 16-, and 32-bit operands, both signed and unsigned. Internally, the ARM is 32-bit machine with 32-bit datapaths and instructions. For loads and stores, the program can specify the size and sign of the value to be loaded/stored (e.g., load signed byte: LDRSB). The value is then converted by the load/store instructions into a comparable 32-bit value. All operands must be aligned in memory. Character and string data types are not supported by special hardware instructions. They are manipulated entirely in software. 3

Data Types on the Atmega 168 The Atmega 168 numeric data types. The ATmega168 has a very limited number of data types. With one exception, all the registers are 8 bits wide, so integers are also 8 bits wide Characters are also 8 bits wide. In essence the only data type that is really supported by the hardware for arithmetic operations is the 8-bit byte. To facilitate memory accesses, the ATmega168 also includes limited support for 16- bit unsigned pointers. The 16-bit pointers X, Y, and Z, can be formed from the concatenation of 8-bit register pairs R26/R27, R28/R29, and R30/R31, respectively. An instruction consists of an opcode, usually along with some additional information such as where operands should come from and where results should go. The general subject of specifying where the operands are (i.e., their addresses) is called addressing Four common instruction formats: (a) Zero-address instruction. (b) One-address instruction (c) Two-address instruction. (d) Three-address instruction. 4

Some possible relationships between instruction and word length. On some machines, all instructions have the same length; on others there may be many different lengths. Instructions may be shorter than, the same length as, or longer than the word length. Having all the instructions be the same length is simpler and makes decoding easier but often wastes space, since all instructions then have to be as long as the longest one. Instruction Format Design Criteria The difficulty of designing should not be underestimated. The decision must be made early in the design of a new computer. If the computer is commercially successful, the instruction set may survive for 40 years or more! All things being equal, short instructions are better than long ones. A program consisting of n 16-bit instructions takes up only half as much memory space as n 32-bit instructions. 5

Smaller instruction lengths require less memory bandwidth*. An increasingly common constraint on processors comes from the inability of the memory system to supply instructions and operands as rapidly as the processor can consume them. The bandwidth bottleneck applies not only to the main memory but also to all the caches. If the bandwidth of an instruction cache is t bits per second (tps) and the average instruction length is r-bits, the cache can deliver at most t/r instructions per second. This is an upper limit on the rate at which the processor can execute instructions. The rate at which instructions can be executed (i.e., the processor speed) may also be limited by the instruction length. Shorter instructions can typically be executed faster. Since modern processors can execute multiple instructions every clock cycle, fetching multiple instructions per clock cycle can be crucial. *Bandwidth refers to the amount of information that can be handled in a given time. However, minimizing the size of instructions may make them harder to overlap. Therefore, striving for minimum instruction size must be weighed against the time required to execute them individually and sequences of them. There must be sufficient room in the instruction format to express all the operations desired. If we require our machine to be able to perform 2 n operations, then we need at least n bits to hold each one. Otherwise, there simply will not be enough room in the opcode to represent all instruction opcodes not to mention operands. The number of bits in an address field is important This leads to a trade-off between the size of the instruction and how much of the memory that can be directly accessed. 6