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

Save this PDF as:

Size: px
Start display at page:

## Transcription

1 Course Schedule CS 221 Computer Architecture Week 3: Information Representation (2) Fall 2001 W1 Sep 11- Sep 14 Introduction W2 Sep 18- Sep 21 Information Representation (1) (Chapter 3) W3 Sep 25- Sep 28 Information Representation (2) (Chapter 3) W4 Oct 2- Oct 5 Computer Architecture Pep/6 (Chapter 4) W5 Oct 9- Oct 12 Assembly Language (Chapter 5) W6* Oct 16- Oct 19 High-Level Languages (1) (Chapter 6) W7* Oct 23- Oct 26 High-Level Languages (2) (Chapter 6) Midterm* W8 Oct 30- Nov 2 Instruction Sets (Tanenbaum) W9 Nov 6 - Nov 9 Devices & Interrupts (Chapter 8) W10* Nov 13- Nov 16Storage Management (Chapter 9) W11 Nov 20- Nov 23 Combinational Logic (Chapter 10) W12 Nov 27- Nov 30 Sequential Logic & Review (Chapter 11) *Marked classes will be taught by Dave Dove, same place same slot CISC 221 Fall 2001 Week 3 1 CISC 221 Fall 2001 Week 3 2 Week 3: Plan Hexadecimal Representation Character Representation Floating Point Representation Introduction to PEP/6 Readings Chapter 3 of book Next week: Chapter 4 (please start reading!) I. Hexadecimals and Character Representations CISC 221 Fall 2001 Week 3 3 CISC 221 Fall 2001 Week 3 4 Hexadecimal Representation Binary numbers are hard to read for humans. Hexadecimal and octal notations are just two different choices of the base in a weighted radix position number system. Hexadecimal is base 16, and octal base 8. Remember the Octal System 0 10 (8) (7*8 = 56) 100 (8*8 = 64) (15) 77 This is called the octal system of counting or base = 1 x x x 8 0 = 65 CISC 221 Fall 2001 Week 3 5 CISC 221 Fall 2001 Week 3 6 1

2 Hexadecimal System 0 10 (16)... F0 (15*16 = 240) 100 (16*16 = 256) For decimal 10 through 15, we use A to F 9 19 This is called the hexadecimal system A 1A or base 16 B 1B C 1C 101 = 1 x x x 16 0 = 257 D 1D E 1E F 1F (31) CISC 221 Fall 2001 Week 3 7 So Why Hexadecimal? Hexadecimal and Octal are useful because They are easier for people to deal with than a strict binary representation: a shorthand. Because the bases are powers of two, the digits in hexadecimal and octal representations map straight onto groups of bits in the binary representation. Each hexadecimal digit corresponds to 4 binary bits or a nibble Each octal digit corresponds to 3 binary bits binary binary 7 F hex A 8 hex It is easy to remember the binary nibble patterns that correspond to a hexadecimal character! CISC 221 Fall 2001 Week 3 8 F00D is a hexadecimal number F00D 15 * * * * 16 0 = 15* * * = However, to convert hexadecimal into binary, just convert each hex digit into 4 bits: F00D is The sign of a hex constant in 2 s complement is indicated by the value of the most significant bit. FOOD is negative because 'f' represents a bit pattern greater than or equal to 8. CISC 221 Fall 2001 Week 3 9 From Decimal to Hex Divide the number by 16, the base, and write down the remainder / 16 remainder d by now we have divided by by now we have divided by by now we have divided by 16 4 Now read back in reverse order: 10d9! Use hex as intermediate when converting to binary 10d9 hex is in binary! CISC 221 Fall 2001 Week 3 10 Representing Characters Since all data are represented as bits, we need to encode characters as binary numbers. ASCII Table Assignment of values to the chars can be arbitrary But use of arithmetic comparisons of the codes should be possible to do alphabetical sorting. ASCII (American Standard Code for Information Interchange) is the most common code. Encodes letters used in English, punctuation marks, and some control characters into 7 bit numbers. However, typically a full byte is used for convenience, leaving the msb empty. CISC 221 Fall 2001 Week 3 11 CISC 221 Fall 2001 Week

3 Other Coding Schemes There are standards to extend ASCII to include characters from more alphabets: Characters are commonly stored one per 8-bit byte, which gives you another bit to play with. ISO-8859-x series codes the first 128 characters the same as ASCII, and the upper 128 characters are different sets of special symbols and accented characters from various Roman alphabets. ISO is called "Latin One". Unicode is a 16-bit encoding that represents scripts for all the alphabets in the world. Char types in Java use Unicode. The least significant 8 bits of Unicode encodings are compatible with ISO-8859 and thus ASCII. CISC 221 Fall 2001 Week 3 13 II. Floating Point Representations CISC 221 Fall 2001 Week 3 14 Announcements There will be an extra tutorial on PEP/6 this Friday Details will follow So we haven t discussed fractions! So how do we represent fractions in binary? We can t use any of the schemes we ve used so far. Because they can only represent powers of 2. But instead of interpreting binary numbers using positive exponents like 2 n We could interpret them as negative exponents: 2 -n!! 1010 = 1* * * *2-4 1 * 1/2 + 0* 1/4 + 1*1/8 + 0*1/16 =.625 CISC 221 Fall 2001 Week 3 15 CISC 221 Fall 2001 Week 3 16 Fractions in Decimal Note that this works like decimal scientific notation (decimal) means 1* * * * * *10-4 = 1*10 + 2*1 + 4/10 + 5/ / /10000 In scientific notation: = * 10-5 = * 10-4 = * 10-2 = * 10-1 = * 10 1 (this is called normalized notation) Negative Fractions in Binary So how do we represent negative numbers? Simple: use 2 0 (=1). It s the MSB, and we can use it as a sign bit. So our original bit pattern should have been: = - 0* * * * *2-4 or * 1/2 + 0* 1/4 + 1*1/8 + 0*1/16 = = * 1/2 + 0* 1/4 + 1*1/8 + 0*1/16 =.375 Our notation now is called Fixed Point notation CISC 221 Fall 2001 Week 3 17 CISC 221 Fall 2001 Week

4 Floating Point Notation Note that we could have put the decimal point at any arbitrary location and make it a standard. However, it would be fixed after that. Which is why it is called fixed point However, scientific calculations often involve very small as well as very large numbers. Would be neat if one number could represent The mass of the sun: 2 * grams The mass of an electron: 9 * grams We would need a lot of bits for this in fixed point. To write them both out as complete decimal fractions that you could line up for addition would require 62 decimal digits (34 before the decimal point and 28 after it). Yet each number has only one significant digit, so the 64 digit representation would store a great many 0s. CISC 221 Fall 2001 Week 3 19 Floating Point Notation (2) The alternative would be to have a limited precision: we could not represent all numbers. Note that we can never represent all fractions! Or have a floating point, where we could adjust precision according to our needs. Scientific decimal notation actually does this. A number is represented by a fraction or mantissa which corresponds to the precision of the value. The fraction is multiplied by ten raised to the power of a specified exponent (e below): x = f * 10 e where f is the fraction or mantissa and e is the exponent CISC 221 Fall 2001 Week 3 20 So what exponent do we use? Where do we put the decimal point? In scientific notation, fractions are normalized the exponent is adjusted so that there is one digit to the left of the decimal point. Floating Point in Binary (2) Floating Points in binary work the same as in decimal, except the base is 2 rather then 10 x = f * 2 e where f is the fraction and e is the exponent = ( * 10 4 ) decimal corresponds to * 10-5 = * 10-4 = * 10-2 = * 2 0 = * 10-1 = * 10 1 (normalized notation) and then we normalize by shifting right * 2 14 = So write * 10 4 rather than * *(0* * * 2-27) CISC 221 Fall 2001 Week 3 22 CISC 221 Fall 2001 Week 3 21 Conversion to Binary: Whole part How do you convert from decimal fractions to binary ones? Convert the whole number part using familiar method of repeated divisions & remainders Conversion to Binary: Fraction How do you convert the fractional part? Repeatedly multiply the fraction by two. When the result is greater than or equal to one, subtract one from the product and record a one in the corresponding bit position. CISC 221 Fall 2001 Week 3 23 CISC 221 Fall 2001 Week

5 Conversion to Binary: Fraction (2) This counts how many many halves are in the fraction, then how many quarters, how many eighths, how many sixteenths, etc. You stop until you have reached your precision (run out of bits). Or get exactly zero after subtracting one. So What Do Floating Points Look Like? Remember x= f*2 e So how do bits represent the fraction & exponent? IEEE 754 Standard Floating Point Format. One for 32 bit precision and 64 bit precision. Corresponds to float and double in java. The resulting is the closest binary approximation for that fraction. 32-bit single precision 64-bit double precision CISC 221 Fall 2001 Week 3 25 CISC 221 Fall 2001 Week 3 26 What Do Floating Points Look Like (2) Sign bit different from integers or fixed point Simply 1 for negative numbers and 0 for positive numbers: thus 2 representations of zero (-0, +0) The fractional part thus always represents an unsigned fraction The exponent bits need also represent negative. Do not use two s complement because we want to be the smallest and the largest. Thus, we can more easily compare small and large numbers only by comparing their exponents. Exponent = value of bits - (2 n-1-1) If exponent has 8 bits, value is bits (range -127 to +127 ) If exponent has 11 bits, value is bits (range to +1023) CISC 221 Fall 2001 Week 3 27 The Fraction, Mantissa, Significant 23 bits in single precision, 52 in double precision. When a binary fraction is normalized, there will always be a 1 to the left of the binary point. It therefore isn't represented in the IEEE format The word significand is used to refer to the combination of the implied 1, the binary point, and the explicit 23 or 52 bits. So we can actually represent 24 or 53 bits x = sign * 1. fraction * 2 exponent CISC 221 Fall 2001 Week 3 28 s Decimal fraction that is easy to convert to binary is a quarter plus one eighth 0.011(binary) * 2-0 or 1.1(binary) * 2-2. The sign bit is 0 for a positive number. The exponent bits equivalent to 7D(hex) or 125(dec) represent an exponent of = -2. The remaining bits represent the significand 1.1(binary): remember that the leading 1 is not stored. Floating Point Overflow & Underflow With integers we have the problem of overflow when the absolute value of a number is too great to fit into the number of bits With floating point, there is the possibility of underflow as well: an absolute value too small to be represented. Take single-precision values. When the fraction is normalized, we can't express negative values which are less than: (binary) * (~ -2 * = , or -1.7 * ) or positive values greater than (binary) * (~ 2 * = or 1.7 * ). IEEE 754 Single-precision floating point representing CISC 221 Fall 2001 Week 3 29 Numbers whose absolute values are greater than these limits constitute an overflow. CISC 221 Fall 2001 Week

6 Floating Point Overflow & Underflow We also are unable to represent non-zero negative numbers greater than: (binary) * (-2-126, approx * ) i.e. negative fractions with tiny absolute values, or non-zero positive numbers less than: (binary) * (2-126, approx 1.2 * ) Numbers whose absolute values are less than these limits constitute an underflow. CISC 221 Fall 2001 Week 3 31 Special Values In addition to the normalized numbers, there are 4 special cases: If the exponent is 0 and the fraction is 0: the number represents + or - 0. If the exponent bits are all 1s and the fraction bits are all 0s: + or - infinity (e.g., division by zero) If the exponents are all 1s and the fractional bits are anything but all zeros this is not a number (NaN), the value used to represent undefined results like infinity divided by infinity. Also + or - If the exponent is 0 and the fractional bits are anything but all zeros this is a 'denormalized' number, with 0 instead of 1 as the implicit bit before the binary point. Used to represent smaller numbers, up to CISC 221 Fall 2001 Week 3 32 What is PEP/6 PEP/6 is a virtual computer running on your real computer as a software program II. Introduction to PEP/6 It was designed to teach you the essence of programming machine code and assembly Without becoming too hardware dependent. Without having to crash a unix box. We will use the PEP/6 simulator throughout the course as an instructional tool It s up to you to relate this to real processors. CISC 221 Fall 2001 Week 3 33 CISC 221 Fall 2001 Week 3 34 Simulated Hardware PEP/6 Hardware consists of four major components at the machine level: The central processing unit (CPU) The main memory The input device The output device Communicate with each other via a bus. Input device CPU Bus Main Memory Output device CISC 221 Fall 2001 Week 3 35 The CPU The CPU contains seven direct onboard memory locations called registers The 4-bit status register (NZVC) Negative Zero overflow Carry The 16-bit accumulator (A) Contains result of operation The 16-bit index register (X) Contains result of operation The 16-bit base register (B) Contains start address of array The 16-bit program counter (PC) Contains address of current instruction The 16-bit stack pointer (SP) Contains address of a stack The 24-bit instruction register (IR) Holds instruction after fetch from memory The CPU also holds all the circuitry to execute instructions CISC 221 Fall 2001 Week

9 ADD Add Operand to Register R Adds one word from main memory to either the index register or accumulator Affects all status bits Add A direct operand address 004A (h) in main memory Before A: FFB6 (h) After A: FFd9 (h) Mem[004A]: 0023 (h) Mem[004A]: 0023 (h) NZVC: 1000 result is negative Subtract Subtract Operand to Register R Subtracts one word from main memory from contents of either the index register or accumulator Affects all status bits Subtract X direct operand address 004A (h) in main memory Before X: 000d (h) 13 (d) After X: FFFE (h) -2 (d) Mem[004A]: 00 (h) 15 (d) Mem[004A]: 00 (h) 15 (d) NZVC: 1001 result is negative and carry because we borrowed into the msb CISC 221 Fall 2001 Week 3 49 CISC 221 Fall 2001 Week 3 50 AND AND Operand to Register R Performs logical AND operation to either the index register or accumulator with a word from memory Affects N and Z bits Handy for stripping away bits: masking AND with 0 strips bits, AND with ones keeps bits : Strip most significant 12 bits (3 nibbles) And X direct operand address 004A (h) in main memory OR OR Operand to Register R Performs logical OR operation to either the index register or accumulator with a word from memory Affects N and Z bits Handy for inserting one bits into bit patterns: fill OR with 1 always sets bit : Set most significant 12 bits to ones (3 nibbles) Or X direct operand address 004A (h) in main memory Before X: 6B5D (h) After X: 000D (h) Mem[004A]: 00 (h) Mem[004A]: 00 (h) NZVC: 0000 CISC 221 Fall 2001 Week 3 NZVC: 1000 because register turned negative 52 CISC 221 Fall 2001 Week 3 51 Before X: OC4D (h) After X: FFFD (h) Mem[004A]: FFF0 (h) Mem[004A]: FFF0 (h) Questions?? CISC 221 Fall 2001 Week

### IT 1204 Section 2.0. Data Representation and Arithmetic. 2009, University of Colombo School of Computing 1

IT 1204 Section 2.0 Data Representation and Arithmetic 2009, University of Colombo School of Computing 1 What is Analog and Digital The interpretation of an analog signal would correspond to a signal whose

### Inf2C - Computer Systems Lecture 2 Data Representation

Inf2C - Computer Systems Lecture 2 Data Representation Boris Grot School of Informatics University of Edinburgh Last lecture Moore s law Types of computer systems Computer components Computer system stack

### l l l l l l l Base 2; each digit is 0 or 1 l Each bit in place i has value 2 i l Binary representation is used in computers

198:211 Computer Architecture Topics: Lecture 8 (W5) Fall 2012 Data representation 2.1 and 2.2 of the book Floating point 2.4 of the book Computer Architecture What do computers do? Manipulate stored information

### Floating-point Arithmetic. where you sum up the integer to the left of the decimal point and the fraction to the right.

Floating-point Arithmetic Reading: pp. 312-328 Floating-Point Representation Non-scientific floating point numbers: A non-integer can be represented as: 2 4 2 3 2 2 2 1 2 0.2-1 2-2 2-3 2-4 where you sum

### ECE 2020B Fundamentals of Digital Design Spring problems, 6 pages Exam Two 26 February 2014

Instructions: This is a closed book, closed note exam. Calculators are not permitted. If you have a question, raise your hand and I will come to you. Please work the exam in pencil and do not separate

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

CS 265 Computer Architecture Wei Lu, Ph.D., P.Eng. 1 Part 1: Data Representation Our goal: revisit and re-establish fundamental of mathematics for the computer architecture course Overview: what are bits

### Module 2: Computer Arithmetic

Module 2: Computer Arithmetic 1 B O O K : C O M P U T E R O R G A N I Z A T I O N A N D D E S I G N, 3 E D, D A V I D L. P A T T E R S O N A N D J O H N L. H A N N E S S Y, M O R G A N K A U F M A N N

### CS101 Lecture 04: Binary Arithmetic

CS101 Lecture 04: Binary Arithmetic Binary Number Addition Two s complement encoding Briefly: real number representation Aaron Stevens (azs@bu.edu) 25 January 2013 What You ll Learn Today Counting in binary

### Floating Point Arithmetic

Floating Point Arithmetic CS 365 Floating-Point What can be represented in N bits? Unsigned 0 to 2 N 2s Complement -2 N-1 to 2 N-1-1 But, what about? very large numbers? 9,349,398,989,787,762,244,859,087,678

### C NUMERIC FORMATS. Overview. IEEE Single-Precision Floating-point Data Format. Figure C-0. Table C-0. Listing C-0.

C NUMERIC FORMATS Figure C-. Table C-. Listing C-. Overview The DSP supports the 32-bit single-precision floating-point data format defined in the IEEE Standard 754/854. In addition, the DSP supports an

### 10.1. Unit 10. Signed Representation Systems Binary Arithmetic

0. Unit 0 Signed Representation Systems Binary Arithmetic 0.2 BINARY REPRESENTATION SYSTEMS REVIEW 0.3 Interpreting Binary Strings Given a string of s and 0 s, you need to know the representation system

### 1. NUMBER SYSTEMS USED IN COMPUTING: THE BINARY NUMBER SYSTEM

1. NUMBER SYSTEMS USED IN COMPUTING: THE BINARY NUMBER SYSTEM 1.1 Introduction Given that digital logic and memory devices are based on two electrical states (on and off), it is natural to use a number

### 3.5 Floating Point: Overview

3.5 Floating Point: Overview Floating point (FP) numbers Scientific notation Decimal scientific notation Binary scientific notation IEEE 754 FP Standard Floating point representation inside a computer

### Number Systems and Computer Arithmetic

Number Systems and Computer Arithmetic Counting to four billion two fingers at a time What do all those bits mean now? bits (011011011100010...01) instruction R-format I-format... integer data number text

### CHAPTER 2 Data Representation in Computer Systems

CHAPTER 2 Data Representation in Computer Systems 2.1 Introduction 37 2.2 Positional Numbering Systems 38 2.3 Decimal to Binary Conversions 38 2.3.1 Converting Unsigned Whole Numbers 39 2.3.2 Converting

### CHAPTER 2 Data Representation in Computer Systems

CHAPTER 2 Data Representation in Computer Systems 2.1 Introduction 37 2.2 Positional Numbering Systems 38 2.3 Decimal to Binary Conversions 38 2.3.1 Converting Unsigned Whole Numbers 39 2.3.2 Converting

### UNIT - I: COMPUTER ARITHMETIC, REGISTER TRANSFER LANGUAGE & MICROOPERATIONS

UNIT - I: COMPUTER ARITHMETIC, REGISTER TRANSFER LANGUAGE & MICROOPERATIONS (09 periods) Computer Arithmetic: Data Representation, Fixed Point Representation, Floating Point Representation, Addition and

### Number Systems & Encoding

Number Systems & Encoding Lecturer: Sri Parameswaran Author: Hui Annie Guo Modified: Sri Parameswaran Week2 1 Lecture overview Basics of computing with digital systems Binary numbers Floating point numbers

### ECE 372 Microcontroller Design Assembly Programming Arrays. ECE 372 Microcontroller Design Assembly Programming Arrays

Assembly Programming Arrays Assembly Programming Arrays Array For Loop Example: unsigned short a[]; for(j=; j

### CMSC 313 Lecture 03 Multiple-byte data big-endian vs little-endian sign extension Multiplication and division Floating point formats Character Codes

Multiple-byte data CMSC 313 Lecture 03 big-endian vs little-endian sign extension Multiplication and division Floating point formats Character Codes UMBC, CMSC313, Richard Chang 4-5 Chapter

### Number Systems. Binary Numbers. Appendix. Decimal notation represents numbers as powers of 10, for example

Appendix F Number Systems Binary Numbers Decimal notation represents numbers as powers of 10, for example 1729 1 103 7 102 2 101 9 100 decimal = + + + There is no particular reason for the choice of 10,

### Digital Computers and Machine Representation of Data

Digital Computers and Machine Representation of Data K. Cooper 1 1 Department of Mathematics Washington State University 2013 Computers Machine computation requires a few ingredients: 1 A means of representing

### Administrivia. CMSC 216 Introduction to Computer Systems Lecture 24 Data Representation and Libraries. Representing characters DATA REPRESENTATION

Administrivia CMSC 216 Introduction to Computer Systems Lecture 24 Data Representation and Libraries Jan Plane & Alan Sussman {jplane, als}@cs.umd.edu Project 6 due next Friday, 12/10 public tests posted

### Number Systems Using and Converting Between Decimal, Binary, Octal and Hexadecimal Number Systems

Number Systems Using and Converting Between Decimal, Binary, Octal and Hexadecimal Number Systems In everyday life, we humans most often count using decimal or base-10 numbers. In computer science, it

### Chapter 2 Float Point Arithmetic. Real Numbers in Decimal Notation. Real Numbers in Decimal Notation

Chapter 2 Float Point Arithmetic Topics IEEE Floating Point Standard Fractional Binary Numbers Rounding Floating Point Operations Mathematical properties Real Numbers in Decimal Notation Representation

### 15213 Recitation 2: Floating Point

15213 Recitation 2: Floating Point 1 Introduction This handout will introduce and test your knowledge of the floating point representation of real numbers, as defined by the IEEE standard. This information

### Characters, Strings, and Floats

Characters, Strings, and Floats CS 350: Computer Organization & Assembler Language Programming 9/6: pp.8,9; 9/28: Activity Q.6 A. Why? We need to represent textual characters in addition to numbers. Floating-point

### System Programming CISC 360. Floating Point September 16, 2008

System Programming CISC 360 Floating Point September 16, 2008 Topics IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties Powerpoint Lecture Notes for Computer Systems:

### Floating Point Numbers

Floating Point Numbers Summer 8 Fractional numbers Fractional numbers fixed point Floating point numbers the IEEE 7 floating point standard Floating point operations Rounding modes CMPE Summer 8 Slides

### Co-processor Math Processor. Richa Upadhyay Prabhu. NMIMS s MPSTME February 9, 2016

8087 Math Processor Richa Upadhyay Prabhu NMIMS s MPSTME richa.upadhyay@nmims.edu February 9, 2016 Introduction Need of Math Processor: In application where fast calculation is required Also where there

### Floating Point Numbers. Lecture 9 CAP

Floating Point Numbers Lecture 9 CAP 3103 06-16-2014 Review of Numbers Computers are made to deal with numbers What can we represent in N bits? 2 N things, and no more! They could be Unsigned integers:

### Chapter 2: Number Systems

Chapter 2: Number Systems Logic circuits are used to generate and transmit 1s and 0s to compute and convey information. This two-valued number system is called binary. As presented earlier, there are many

### Chapter 2 Bits, Data Types, and Operations

Chapter 2 Bits, Data Types, and Operations How do we represent data in a computer? At the lowest level, a computer is an electronic machine. works by controlling the flow of electrons Easy to recognize

### Floating point. Today! IEEE Floating Point Standard! Rounding! Floating Point Operations! Mathematical properties. Next time. !

Floating point Today! IEEE Floating Point Standard! Rounding! Floating Point Operations! Mathematical properties Next time! The machine model Chris Riesbeck, Fall 2011 Checkpoint IEEE Floating point Floating

### The Sign consists of a single bit. If this bit is '1', then the number is negative. If this bit is '0', then the number is positive.

IEEE 754 Standard - Overview Frozen Content Modified by on 13-Sep-2017 Before discussing the actual WB_FPU - Wishbone Floating Point Unit peripheral in detail, it is worth spending some time to look at

### Digital Fundamentals

Digital Fundamentals Tenth Edition Floyd Chapter 1 Modified by Yuttapong Jiraraksopakun Floyd, Digital Fundamentals, 10 th 2008 Pearson Education ENE, KMUTT ed 2009 Analog Quantities Most natural quantities

### 9/23/15. Agenda. Goals of this Lecture. For Your Amusement. Number Systems and Number Representation. The Binary Number System

For Your Amusement Number Systems and Number Representation Jennifer Rexford Question: Why do computer programmers confuse Christmas and Halloween? Answer: Because 25 Dec = 31 Oct -- http://www.electronicsweekly.com

### CSC201, SECTION 002, Fall 2000: Homework Assignment #2

1 of 7 11/8/2003 7:34 PM CSC201, SECTION 002, Fall 2000: Homework Assignment #2 DUE DATE Monday, October 2, at the start of class. INSTRUCTIONS FOR PREPARATION Neat, in order, answers easy to find. Staple

### umber Systems bit nibble byte word binary decimal

umber Systems Inside today s computers, data is represented as 1 s and 0 s. These 1 s and 0 s might be stored magnetically on a disk, or as a state in a transistor. To perform useful operations on these

### 4/8/17. Admin. Assignment 5 BINARY. David Kauchak CS 52 Spring 2017

4/8/17 Admin! Assignment 5 BINARY David Kauchak CS 52 Spring 2017 Diving into your computer Normal computer user 1 After intro CS After 5 weeks of cs52 What now One last note on CS52 memory address binary

### Floating Point. The World is Not Just Integers. Programming languages support numbers with fraction

1 Floating Point The World is Not Just Integers Programming languages support numbers with fraction Called floating-point numbers Examples: 3.14159265 (π) 2.71828 (e) 0.000000001 or 1.0 10 9 (seconds in

### Systems I. Floating Point. Topics IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties

Systems I Floating Point Topics IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties IEEE Floating Point IEEE Standard 754 Established in 1985 as uniform standard for

### CS101 Introduction to computing Floating Point Numbers

CS101 Introduction to computing Floating Point Numbers A. Sahu and S. V.Rao Dept of Comp. Sc. & Engg. Indian Institute of Technology Guwahati 1 Outline Need to floating point number Number representation

### Representation of Information

Representation of Information CS61, Lecture 2 Prof. Stephen Chong September 6, 2011 Announcements Assignment 1 released Posted on http://cs61.seas.harvard.edu/ Due one week from today, Tuesday 13 Sept

### Floating point. Today. IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties Next time.

Floating point Today IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties Next time The machine model Fabián E. Bustamante, Spring 2010 IEEE Floating point Floating point

### But first, encode deck of cards. Integer Representation. Two possible representations. Two better representations WELLESLEY CS 240 9/8/15

Integer Representation Representation of integers: unsigned and signed Sign extension Arithmetic and shifting Casting But first, encode deck of cards. cards in suits How do we encode suits, face cards?

### CS61C L10 MIPS Instruction Representation II, Floating Point I (6)

CS61C L1 MIPS Instruction Representation II, Floating Point I (1) inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture #1 Instruction Representation II, Floating Point I 25-1-3 There is one

### Digital Logic Lecture 2 Number Systems

Digital Logic Lecture 2 Number Systems By Ghada Al-Mashaqbeh The Hashemite University Computer Engineering Department Outline Introduction. Basic definitions. Number systems types. Conversion between different

### Signed umbers. Sign/Magnitude otation

Signed umbers So far we have discussed unsigned number representations. In particular, we have looked at the binary number system and shorthand methods in representing binary codes. With m binary digits,

### COMPUTER HARDWARE. Instruction Set Architecture

COMPUTER HARDWARE Instruction Set Architecture Overview Computer architecture Operand addressing Addressing architecture Addressing modes Elementary instructions Data transfer instructions Data manipulation

### NUMBER SYSTEMS AND CODES

C H A P T E R 69 Learning Objectives Number Systems The Decimal Number System Binary Number System Binary to Decimal Conversion Binary Fractions Double-Dadd Method Decimal to Binary Conversion Shifting

### Unit 3. Analog vs. Digital. Analog vs. Digital ANALOG VS. DIGITAL. Binary Representation

3.1 3.2 Unit 3 Binary Representation ANALOG VS. DIGITAL 3.3 3.4 Analog vs. Digital The analog world is based on continuous events. Observations can take on (real) any value. The digital world is based

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

The CPU and Memory How does a computer work? How does a computer interact with data? How are instructions performed? Recall schematic diagram: 1 Registers A register is a permanent storage location within

### Octal & Hexadecimal Number Systems. Digital Electronics

Octal & Hexadecimal Number Systems Digital Electronics What, More Number Systems? Why do we need more number systems? Humans understand decimal Check out my ten digits! Digital electronics (computers)

### Floating Point Puzzles The course that gives CMU its Zip! Floating Point Jan 22, IEEE Floating Point. Fractional Binary Numbers.

class04.ppt 15-213 The course that gives CMU its Zip! Topics Floating Point Jan 22, 2004 IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties Floating Point Puzzles For

### CS367 Test 1 Review Guide

CS367 Test 1 Review Guide This guide tries to revisit what topics we've covered, and also to briefly suggest/hint at types of questions that might show up on the test. Anything on slides, assigned reading,

### CS61C : Machine Structures

inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture #10 Instruction Representation II, Floating Point I 2005-10-03 Lecturer PSOE, new dad Dan Garcia www.cs.berkeley.edu/~ddgarcia #9 bears

### Lecture 4 - Number Representations, DSK Hardware, Assembly Programming

Lecture 4 - Number Representations, DSK Hardware, Assembly Programming James Barnes (James.Barnes@colostate.edu) Spring 2014 Colorado State University Dept of Electrical and Computer Engineering ECE423

### 1DT157 Digitalteknik och datorarkitekt. Digital technology and computer architecture, 5p

1DT157 Digitalteknik och datorarkitekt Digital technology and computer architecture, 5p Homework #1 Tanenbaum Chapter 3 Problems 6,7,11,19,23 Submit electronically to the TAs: Binary Numbers Appendix A

### Logic, Words, and Integers

Computer Science 52 Logic, Words, and Integers 1 Words and Data The basic unit of information in a computer is the bit; it is simply a quantity that takes one of two values, 0 or 1. A sequence of k bits

### Binary Addition & Subtraction. Unsigned and Sign & Magnitude numbers

Binary Addition & Subtraction Unsigned and Sign & Magnitude numbers Addition and subtraction of unsigned or sign & magnitude binary numbers by hand proceeds exactly as with decimal numbers. (In fact this

### DATA REPRESENTATION. Data Types. Complements. Fixed Point Representations. Floating Point Representations. Other Binary Codes. Error Detection Codes

1 DATA REPRESENTATION Data Types Complements Fixed Point Representations Floating Point Representations Other Binary Codes Error Detection Codes 2 Data Types DATA REPRESENTATION Information that a Computer

### CS429: Computer Organization and Architecture

CS429: Computer Organization and Architecture Dr. Bill Young Department of Computer Sciences University of Texas at Austin Last updated: September 18, 2017 at 12:48 CS429 Slideset 4: 1 Topics of this Slideset

### 8/30/2016. In Binary, We Have A Binary Point. ECE 120: Introduction to Computing. Fixed-Point Representations Support Fractions

University of Illinois at Urbana-Champaign Dept. of Electrical and Computer Engineering ECE 120: Introduction to Computing Fixed- and Floating-Point Representations In Binary, We Have A Binary Point Let

### IEEE-754 floating-point

IEEE-754 floating-point Real and floating-point numbers Real numbers R form a continuum - Rational numbers are a subset of the reals - Some numbers are irrational, e.g. π Floating-point numbers are an

### 1010 2?= ?= CS 64 Lecture 2 Data Representation. Decimal Numbers: Base 10. Reading: FLD Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9

CS 64 Lecture 2 Data Representation Reading: FLD 1.2-1.4 Decimal Numbers: Base 10 Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Example: 3271 = (3x10 3 ) + (2x10 2 ) + (7x10 1 ) + (1x10 0 ) 1010 10?= 1010 2?= 1

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

IT 3123 Hardware and Software Concepts February 11 and Memory II Copyright 2005 by Bob Brown The von Neumann Architecture 00 01 02 03 PC IR Control Unit Command Memory ALU 96 97 98 99 Notice: This session

### Computer Arithmetic Ch 8

Computer Arithmetic Ch 8 ALU Integer Representation Integer Arithmetic Floating-Point Representation Floating-Point Arithmetic 1 Arithmetic Logical Unit (ALU) (2) Does all work in CPU (aritmeettis-looginen

### Computer Organization CS 206 T Lec# 2: Instruction Sets

Computer Organization CS 206 T Lec# 2: Instruction Sets Topics What is an instruction set Elements of instruction Instruction Format Instruction types Types of operations Types of operand Addressing mode

### CS/EE 260. Digital Computers Organization and Logical Design

CS/EE 260. Digital Computers Organization and Logical Design David M. Zar Computer Science and Engineering Department Washington University dzar@cse.wustl.edu http://www.cse.wustl.edu/~dzar/class/260 Digital

### Floating Point Considerations

Chapter 6 Floating Point Considerations In the early days of computing, floating point arithmetic capability was found only in mainframes and supercomputers. Although many microprocessors designed in the

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

Data Representation Data Representation Goal: Store numbers, characters, sets, database records in the computer. What we got: Circuit that stores 2 voltages, one for logic 0 (0 volts) and one for logic

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

Data Representation Data Representation Goal: Store numbers, characters, sets, database records in the computer. What we got: Circuit that stores 2 voltages, one for logic ( volts) and one for logic (3.3

### 17. Instruction Sets: Characteristics and Functions

17. Instruction Sets: Characteristics and Functions Chapter 12 Spring 2016 CS430 - Computer Architecture 1 Introduction Section 12.1, 12.2, and 12.3 pp. 406-418 Computer Designer: Machine instruction set

### JAVA Programming Fundamentals

Chapter 4 JAVA Programming Fundamentals By: Deepak Bhinde PGT Comp.Sc. JAVA character set Character set is a set of valid characters that a language can recognize. It may be any letter, digit or any symbol

### IEEE Standard 754 Floating Point Numbers

IEEE Standard 754 Floating Point Numbers Steve Hollasch / Last update 2005-Feb-24 IEEE Standard 754 floating point is the most common representation today for real numbers on computers, including Intel-based

### Data Representation Floating Point

Data Representation Floating Point CSCI 2400 / ECE 3217: Computer Architecture Instructor: David Ferry Slides adapted from Bryant & O Hallaron s slides via Jason Fritts Today: Floating Point Background:

### IEEE Floating Point Numbers Overview

COMP 40: Machine Structure and Assembly Language Programming (Fall 2015) IEEE Floating Point Numbers Overview Noah Mendelsohn Tufts University Email: noah@cs.tufts.edu Web: http://www.cs.tufts.edu/~noah

### More Programming Constructs -- Introduction

More Programming Constructs -- Introduction We can now examine some additional programming concepts and constructs Chapter 5 focuses on: internal data representation conversions between one data type and

### Numbers and Representations

Çetin Kaya Koç http://koclab.cs.ucsb.edu/teaching/cs192 koc@cs.ucsb.edu Çetin Kaya Koç http://koclab.cs.ucsb.edu Fall 2016 1 / 38 Outline Computational Thinking Representations of integers Binary and decimal

### 4 Operations On Data 4.1. Foundations of Computer Science Cengage Learning

4 Operations On Data 4.1 Foundations of Computer Science Cengage Learning Objectives After studying this chapter, the student should be able to: List the three categories of operations performed on data.

### Arithmetic Operations

Arithmetic Operations Arithmetic Operations addition subtraction multiplication division Each of these operations on the integer representations: unsigned two's complement 1 Addition One bit of binary

### Programming Studio #1 ECE 190

Programming Studio #1 ECE 190 Programming Studio #1 Announcements In Studio Assignment Introduction to Linux Command-Line Operations Recitation Floating Point Representation Binary & Hexadecimal 2 s Complement

### Arithmetic. Chapter 3 Computer Organization and Design

Arithmetic Chapter 3 Computer Organization and Design Addition Addition is similar to decimals 0000 0111 + 0000 0101 = 0000 1100 Subtraction (negate) 0000 0111 + 1111 1011 = 0000 0010 Over(under)flow For

### Objects and Types. COMS W1007 Introduction to Computer Science. Christopher Conway 29 May 2003

Objects and Types COMS W1007 Introduction to Computer Science Christopher Conway 29 May 2003 Java Programs A Java program contains at least one class definition. public class Hello { public static void

### Introduction to Microprocessor

Introduction to Microprocessor The microprocessor is a general purpose programmable logic device. It is the brain of the computer and it performs all the computational tasks, calculations data processing

### Appendix. Bit Operators

Appendix C Bit Operations C++ operates with data entities, such as character, integer, and double-precision constants and variables, that can be stored as 1 or more bytes. In addition, C++ provides for

### 2.2 THE MARIE Instruction Set Architecture

2.2 THE MARIE Instruction Set Architecture MARIE has a very simple, yet powerful, instruction set. The instruction set architecture (ISA) of a machine specifies the instructions that the computer can perform

### Chapter 3 Arithmetic for Computers (Part 2)

Department of Electr rical Eng ineering, Chapter 3 Arithmetic for Computers (Part 2) 王振傑 (Chen-Chieh Wang) ccwang@mail.ee.ncku.edu.tw ncku edu Depar rtment of Electr rical Eng ineering, Feng-Chia Unive

### Scientific Computing. Error Analysis

ECE257 Numerical Methods and Scientific Computing Error Analysis Today s s class: Introduction to error analysis Approximations Round-Off Errors Introduction Error is the difference between the exact solution

### Math 230 Assembly Programming (AKA Computer Organization) Spring 2008

Math 230 Assembly Programming (AKA Computer Organization) Spring 2008 MIPS Intro II Lect 10 Feb 15, 2008 Adapted from slides developed for: Mary J. Irwin PSU CSE331 Dave Patterson s UCB CS152 M230 L10.1

Octal and Hexadecimal Integers CS 350: Computer Organization & Assembler Language Programming A. Why? Octal and hexadecimal numbers are useful for abbreviating long bitstrings. Some operations on octal

### Signed Binary Numbers

Signed Binary Numbers Unsigned Binary Numbers We write numbers with as many digits as we need: 0, 99, 65536, 15000, 1979, However, memory locations and CPU registers always hold a constant, fixed number

### 4 Operations On Data 4.1. Foundations of Computer Science Cengage Learning

4 Operations On Data 4.1 Foundations of Computer Science Cengage Learning Objectives After studying this chapter, the student should be able to: List the three categories of operations performed on data.

### Name: CMSC 313 Fall 2001 Computer Organization & Assembly Language Programming Exam 1. Question Points I. /34 II. /30 III.

CMSC 313 Fall 2001 Computer Organization & Assembly Language Programming Exam 1 Name: Question Points I. /34 II. /30 III. /36 TOTAL: /100 Instructions: 1. This is a closed-book, closed-notes exam. 2. You

### Fundamentals of Programming Session 2

Fundamentals of Programming Session 2 Instructor: Reza Entezari-Maleki Email: entezari@ce.sharif.edu 1 Fall 2013 Sharif University of Technology Outlines Programming Language Binary numbers Addition Subtraction

### Building a Test Suite

Program #3 Is on the web Exam #1 Announcements Today, 6:00 7:30 in Armory 0126 Makeup Exam Friday March 9, 2:00 PM room TBA Reading Notes (Today) Chapter 16 (Tuesday) 1 API: Building a Test Suite Int createemployee(char

### Computer Systems C S Cynthia Lee

Computer Systems C S 1 0 7 Cynthia Lee 2 Today s Topics LECTURE: Floating point! Real Numbers and Approximation MATH TIME! Some preliminary observations on approximation We know that some non-integer numbers