CDA 3200 Digital Systems. Instructor: Dr. Janusz Zalewski Developed by: Dr. Dahai Guo Spring 2012



Similar documents
Oct: 50 8 = 6 (r = 2) 6 8 = 0 (r = 6) Writing the remainders in reverse order we get: (50) 10 = (62) 8

Computer Science 281 Binary and Hexadecimal Review

Useful Number Systems

3. Convert a number from one number system to another

Solution for Homework 2

Binary Representation. Number Systems. Base 10, Base 2, Base 16. Positional Notation. Conversion of Any Base to Decimal.

Lecture 2. Binary and Hexadecimal Numbers

EE 261 Introduction to Logic Circuits. Module #2 Number Systems

Binary Numbers. Binary Octal Hexadecimal

Base Conversion written by Cathy Saxton

CS101 Lecture 11: Number Systems and Binary Numbers. Aaron Stevens 14 February 2011

The string of digits in the binary number system represents the quantity

Chapter 2. Binary Values and Number Systems

Binary Representation

CSI 333 Lecture 1 Number Systems

2011, The McGraw-Hill Companies, Inc. Chapter 3

CPEN Digital Logic Design Binary Systems

Number Representation

Number and codes in digital systems

Lecture 11: Number Systems

Goals. Unary Numbers. Decimal Numbers. 3,148 is s 100 s 10 s 1 s. Number Bases 1/12/2009. COMP370 Intro to Computer Architecture 1

Section 1.4 Place Value Systems of Numeration in Other Bases

LSN 2 Number Systems. ECT 224 Digital Computer Fundamentals. Department of Engineering Technology

NUMBER SYSTEMS. 1.1 Introduction

CS201: Architecture and Assembly Language

Number Conversions Dr. Sarita Agarwal (Acharya Narendra Dev College,University of Delhi)

Chapter 4: Computer Codes

Digital Design. Assoc. Prof. Dr. Berna Örs Yalçın

Binary, Hexadecimal, Octal, and BCD Numbers

=

Systems I: Computer Organization and Architecture

plc numbers Encoded values; BCD and ASCII Error detection; parity, gray code and checksums

Digital System Design Prof. D Roychoudhry Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur

To convert an arbitrary power of 2 into its English equivalent, remember the rules of exponential arithmetic:

2 Number Systems. Source: Foundations of Computer Science Cengage Learning. Objectives After studying this chapter, the student should be able to:

1. Give the 16 bit signed (twos complement) representation of the following decimal numbers, and convert to hexadecimal:

Chapter 1: Digital Systems and Binary Numbers

COMBINATIONAL CIRCUITS

Levent EREN A-306 Office Phone: INTRODUCTION TO DIGITAL LOGIC

THE BINARY NUMBER SYSTEM

Today s topics. Digital Computers. More on binary. Binary Digits (Bits)

2010/9/19. Binary number system. Binary numbers. Outline. Binary to decimal

Number Systems. Introduction / Number Systems

This 3-digit ASCII string could also be calculated as n = (Data[2]-0x30) +10*((Data[1]-0x30)+10*(Data[0]-0x30));

Digital codes. Resources and methods for learning about these subjects (list a few here, in preparation for your research):

Positional Numbering System

Data Storage 3.1. Foundations of Computer Science Cengage Learning

Binary Division. Decimal Division. Hardware for Binary Division. Simple 16-bit Divider Circuit

NUMBER SYSTEMS. William Stallings

Numbering Systems. InThisAppendix...

Chapter 7 Lab - Decimal, Binary, Octal, Hexadecimal Numbering Systems

Machine Architecture and Number Systems. Major Computer Components. Schematic Diagram of a Computer. The CPU. The Bus. Main Memory.

BINARY CODED DECIMAL: B.C.D.

Chapter Binary, Octal, Decimal, and Hexadecimal Calculations

NUMBER SYSTEMS APPENDIX D. You will learn about the following in this appendix:

Data Storage. Chapter 3. Objectives. 3-1 Data Types. Data Inside the Computer. After studying this chapter, students should be able to:

Numeral Systems. The number twenty-five can be represented in many ways: Decimal system (base 10): 25 Roman numerals:

Cyber Security Workshop Encryption Reference Manual

Lecture 8: Binary Multiplication & Division

Today. Binary addition Representing negative numbers. Andrew H. Fagg: Embedded Real- Time Systems: Binary Arithmetic

Decimal to Binary Conversion

The Answer to the 14 Most Frequently Asked Modbus Questions

COMPSCI 210. Binary Fractions. Agenda & Reading

PROGRAMMABLE LOGIC CONTROLLERS Unit code: A/601/1625 QCF level: 4 Credit value: 15 TUTORIAL OUTCOME 2 Part 1

Unsigned Conversions from Decimal or to Decimal and other Number Systems

Divide: Paper & Pencil. Computer Architecture ALU Design : Division and Floating Point. Divide algorithm. DIVIDE HARDWARE Version 1

Binary Adders: Half Adders and Full Adders

HOMEWORK # 2 SOLUTIO

Digital Logic Design. Introduction

Asynchronous counters, except for the first block, work independently from a system clock.

Number Systems and Radix Conversion

A single register, called the accumulator, stores the. operand before the operation, and stores the result. Add y # add y from memory to the acc

The programming language C. sws1 1

A Step towards an Easy Interconversion of Various Number Systems

Paramedic Program Pre-Admission Mathematics Test Study Guide

ASCII and BCD Arithmetic. Chapter 11 S. Dandamudi

COMP 250 Fall 2012 lecture 2 binary representations Sept. 11, 2012

Logic Reference Guide

CDA 3200 Digital Systems. Instructor: Dr. Janusz Zalewski Developed by: Dr. Dahai Guo Spring 2012

Memory is implemented as an array of electronic switches

Lecture 4: Binary. CS442: Great Insights in Computer Science Michael L. Littman, Spring I-Before-E, Continued

Classless Subnetting Explained

Decimal Number (base 10) Binary Number (base 2)

Modbus RTU Communications RX/WX and MRX/MWX

APPENDIX B. Routers route based on the network number. The router that delivers the data packet to the correct destination host uses the host ID.

Verilog - Representation of Number Literals

AN617. Fixed Point Routines FIXED POINT ARITHMETIC INTRODUCTION. Thi d t t d ith F M k Design Consultant

CS321. Introduction to Numerical Methods

Arithmetic in MIPS. Objectives. Instruction. Integer arithmetic. After completing this lab you will:

Comp 255Q - 1M: Computer Organization Lab #3 - Machine Language Programs for the PDP-8

Internet Addresses (You should read Chapter 4 in Forouzan)

Configuration Variables For Digital Command Control, All Scales

This Unit: Floating Point Arithmetic. CIS 371 Computer Organization and Design. Readings. Floating Point (FP) Numbers

Z80 Instruction Set. Z80 Assembly Language

Activity 1: Using base ten blocks to model operations on decimals

CSC4510 AUTOMATA 2.1 Finite Automata: Examples and D efinitions Definitions

2.3 IPv4 Address Subnetting Part 2

Pemrograman Dasar. Basic Elements Of Java

Karnaugh Maps & Combinational Logic Design. ECE 152A Winter 2012

Activity 6.7.4: IPv4 Address Subnetting Part 2

Transcription:

CDA 3200 Digital Systems Instructor: Dr. Janusz Zalewski Developed by: Dr. Dahai Guo Spring 2012

Outline Data Representation Binary Codes Why 6-3-1-1 and Excess-3?

Data Representation (1/2) Each numbering format, or system, has a base, or maximum number of symbols that can be assigned to a single digit.

Data Representation (2/2) Binary: 1 1 1 1 0 1 0 1 Octal: 365 Decimal: 245 Hexadecimal: F5

Binary Numbers (1/7) A computer stores instructions and data in memory as collections of electronic charges. 1 = on voltage at output of electronic device is high (saturated). 0 = off voltage at output of electronic device is zero.

Binary Numbers (2/7) Each digit (strictly, position of a digit) in a binary number is called a bit. In a binary number, bits are usually numbered starting at zero on the right side, and increasing toward the left. The bit on the left is called the most significant bit (MSB), and the bit on the right is the least significant bit (LSB).

Binary Numbers (3/7) 1 0 1 1 0 0 1 0 1 0 0 1 1 1 0 0 MSB LSB

Binary Numbers (4/7) Unsigned binary integers Can only be positive or zero Translating unsigned binary integers to decimal dec=(d n-1 *2 n-1 )+(D n-2 *2 n-2 )+..+(D 1 *2 1 )+(D 0 *2 0 ) 1 1 1 1 0 1 0 1 (n=8) D 7 =1, D 6 =1, D 5 =1, D 4 =1, D 3 =0, D 2 =1, D 1 =0, D 0 =1 dec=2 7 +2 6 +2 5 +2 4 +2 2 +2 0 =128+64+32+16+4+1=245

Binary Numbers (5/7) Translating unsigned decimal integers to binary Example: translating 37 to binary Division Quotient Remainder 37/2 18 1 18/2 9 0 9/2 4 1 4/2 2 0 2/2 1 0 1/2 0 1 The result is 100101.

Binary Numbers (6/7) Binary Addition Beginning with the lowest (rightmost) order pair of bits. Proceed bit by bit For each bit pair. 0+0=0 0+1=1 1+0=1 1+1=10

Binary Numbers (7/7) Binary addition (cont) Carry: 1 + 0 0 0 0 0 1 0 0 0 0 0 0 0 1 1 1 (4) (7) Bit position: 0 0 0 0 1 0 1 1 7 6 5 4 3 2 1 0 (11)

Value Range For an n-bit unsigned binary number, the range is 0~2 n -1: 2 n different values. 2 bits: 4 values (0 3) 3 bits: 8 values (0 7) 4 bits: 16 values (0 15)... 8 bits (a byte): 256 values (0 255) 10 bits: 1024 values (0 1023)

Hexadecimal Integers (1/6) hexadecimal numbers are often used to represent computer memory address and instructions. A hexadecimal digit ranges from 0 to 15 (total of sixteen). The letters of the alphabet are used to represent 10 through 15. where A=10, B=11, C=12, D=13, E=14, and F=15

Hexadecimal Integers (2/6) Decimal Hexadecimal Binary 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0 1 2 3 4 5 6 7 8 9 A B C D E F 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111 Each hexadecimal digit means a four binary bit string. Every four binary bit string can be mapped to a hexadecimal digit.

Hexadecimal Integers (3/6) If we can break up a byte (8 bits) into halves, the upper and lower halves, each half can be represented by a hexadecimal digit. A byte could then be represented by two hexadecimal digits, rather than 8 bits. In general, any binary number can be split into four-bit groups, starting from right. Each such a group can be translated into hexadecimal digit. The result hexadecimal is much shorter than the binary equivalent.

Hexadecimal Integers (4/6) 101101010011110010100 0001 0110 1010 0111 1001 0100 1 6 A 7 9 4 101101010011110010100 16A794 Note when you are finding four bit groups, begin from the right.

Hexadecimal Integers (5/6) Converting unsigned hexadecimal to decimal. dec=(d n-1 *16 n-1 )+(D n-2 *16 n-2 )+..+(D 1 *16 1 )+(D 0 *16 0 ) F5 245 D 1 =F, D 0 =5 dec=f*16 1 +5*16 0 =15*16+5*1 =240+5 =245

Hexadecimal Integers (6/6) Converting unsigned decimal to hexadecimal Division Quotient Remainder 422/16 26 6 26/16 1 A 1/16 0 1 The result is 1A6.

Signed Integers (1/9) Signed integers can negative, zero and positive. The most significant bit in binary numbers indicates the number s sign. 0 means positive or zero 1 means negative When you are using signed binary numbers, the number of bits must be specified.

Signed Integers (2/9) When a signed binary is positive, it can be used as if it was an unsigned binary. When it is negative, two s complement is used the most often. Two s complement (TC) notation works like the negating operation TC(TC(number)) = number, [ -(-number)=number] TC(number)+number=0, [-number+number=0]

Signed Integers (3/9) Given an eight-bit number 0000 0001, its two s complement is 1111 1111 Starting value 0000 0001 Step1: reverse the bits: 1111 1110 Step 2: add 1 1111 1111 The two s complement representation of -1.

Signed Integers (4/9) Two s complement of hexadecimal Reversing a hexadecimal digit is subtracting the digit from 15 6A3D 95C2+1 95C3 95C3 6A3C+1 6A3D

Signed Integers (5/9) For a signed hexadecimal number, it is negative if its most significant digit is greater than 7. Otherwise it is zero or positive.

Signed Integers (5/9) Converting signed binary to decimal MSB=1, this binary is in two s complement notation. Get its two s complement (positive equivalent). Convert to decimal. Make the decimal negative. MSB=0, this binary can be treated as an unsigned binary.

Signed Integers (6/9) Starting value: 1111 0000 Step1: reverse the bits: 0000 1111 Step2: add 1 0000 1111+1 Step3: its two s complement: 0001 0000 Step4: convert to decimal 16 Step5: make the decimal neg: -16

Signed Integers (8/9) How to Convert signed decimal to binary? Convert signed decimal to hexadecimal? Convert signed hexadecimal to decimal?

Signed Integers (9/9) Maximum and Minimum Values: For an n-bit signed binary number, the range is -2 n-1 2 n-1-1

Addition of Signed Binary Numbers 13-12 (use five bits) =13+(-12) =01101+TC(01100) =01101+(10011+1) =01101+10100 =1 00001 =00001 (1/3) The carry from the MSB is discarded. in signed binary number addition.

Addition of Signed Binary Numbers (2/3) 13+12 (We still use 5 bits) =01101+01100 =11001 The result is negative!! It is an overflow.

Addition of Signed Binary Numbers (3/3) -12-13 (Still 5 bits) =TC(12)+TC(13) =TC(01100)+TC(01101) =(10011+1)+(10010+1) =10100+10011 =1 00111 =00111 The carry from the MSB is discarded. The result is positive!! It is an overflow.

Binary Codes (1/2) Binary codes: how to represent decimal digits. Weighted codes BCD codes (8-4-2-1): each decimal digit is represented by its four-bit binary equivalent. 937: 1001 0011 0111 6-3-1-1 codes: weights are 6, 3, 1, 1 937: 1100 0100 1001

Binary Codes (2/2) Non-weighted codes Excess 3: obtained from the 8-4-2-1 code by adding 3 (0011) to each the codes. 937: 1100 0110 1010 2-out-of-5: exactly 2 out of 5 bits are 1, has error-checking properties. 937: 11000 01001 10010 Gray code: the codes for successive decimal digits differ in exactly one bit 456: 0110 1110 1010

Why Excess-3? Excess-3 codes 0 0011 1 0100 2 0101 3 0110 4 0111 5 1000 6 1001 7 1010 8 1011 9 1100 For a decimal digit D, complement its code results in the code of 9-D.

Why 6-3-1-1? (1/3) 8-4-2-1 codes 0 0000 1 0001 2 0010 3 0011 4 0100 5 0101 6 0110 7 0111 8 1000 9 1001 6-3-1-1 codes 0 0000 1 0001 2 0011 3 0100 4 0101 5 0111 6 1000 7 1001 8 1011 9 1100

Why 6-3-1-1? (2/3) Lets consider the situations of 1 bit corrupted. 0000 0001 0010 0100 1000 In 8-4-2-1 coding method, all 0001, 0010, 0100, and 1000 are valid codes. In 6-3-1-1 coding method, only 0001, 0100, and 1000 are valid codes.

Why 6-3-1-1? (3/3) Lets define the concept of error rate at 1 bit corrupted to be the number of possible valid codes after being corrupted divided by 4. For example, for 0000, the error rate at 1 bit corrupted is 100% when using 8-4-2-1 codes and 75% when using 6-3-1-1 codes.