Binary Numbers.

Slides:



Advertisements
Similar presentations
Assembly Language for Intel-Based Computers, 4 th Edition Chapter 1: Basic Concepts (c) Pearson Education, All rights reserved. You may modify and.
Advertisements

Number Bases Informatics INFO I101 February 9, 2004 John C. Paolillo, Instructor.
ICS312 Set 2 Representation of Numbers and Characters.
Number Systems and Codes In PLC
(2.1) Fundamentals  Terms for magnitudes – logarithms and logarithmic graphs  Digital representations – Binary numbers – Text – Analog information 
CS231 Fundamentals1 Fundamentals What kind of data do computers work with? – Deep down inside, it’s all 1s and 0s What can you do with 1s and 0s? – Boolean.
CSIT 301 (Blum)1 Recap so far (Not gotten to last time) So there were issues about the number of operands. –Recall that we have a fetch-execute cycle –
Binary Numbers. Why Binary? Maximal distinction among values  minimal corruption from noise Imagine taking the same physical attribute of a circuit,
Computers Organization & Assembly Language
Binary Codes Computers and other digital systems "work" with binary numbers. I/P & O/P is usually done using decimal numbers, alphabetics, special symbols.
CSU0014 Assembly Languages Homepage: Textbook: Kip R. Irvine, Assembly Language for Intel-Based Computers,
Binary Numbers.
Summer 2014 Chapter 1: Basic Concepts. Irvine, Kip R. Assembly Language for Intel-Based Computers 6/e, Chapter Overview Welcome to Assembly Language.
Click to edit Master title style Click to edit Master text styles –Second level Third level –Fourth level »Fifth level 1 Today’s Topics How information.
Logic and Digital System Design - CS 303
Fundamentals of IT UNIT-I OnlyforIPMCA. DIGITAL SIGNALS & LOGIC GATES Signals and data are classified as analog or digital. Analog refers to something.
PHY 201 (Blum) 1 Resistors Ohm’s Law and Combinations of Resistors See Chapters 1 & 2 in Electronics: The Easy Way (Miller & Miller)
EE2174: Digital Logic and Lab Professor Shiyan Hu Department of Electrical and Computer Engineering Michigan Technological University CHAPTER 2 Number.
ECEN2102 Digital Logic Design Lecture 1 Numbers Systems Abdullah Said Alkalbani University of Buraimi.
ICS312 Set 1 Representation of Numbers and Characters.
PHY 201 (Blum)1 Binary Numbers. PHY 201 (Blum)2 Why Binary? Maximal distinction among values  minimal corruption from noise Imagine taking the same physical.
Binary Numbers. Why Binary? Maximal distinction among values  minimal corruption from noise Imagine taking the same physical attribute of a circuit,
Number systems, Operations, and Codes
Chapter 19 Number Systems. Irvine, Kip R. Assembly Language for Intel-Based Computers, Translating Languages English: Display the sum of A times.
Data Representation, Number Systems and Base Conversions
CSC 370 (Blum)1 Binary Numbers Material on Data Representation can be found in Chapter 2 of Computer Architecture (Nicholas Carter)
June 10, 2002© Howard Huang1 Number systems To get started, we’ll discuss one of the fundamental concepts underlying digital computer design:
CSC 3210 Computer Organization and Programming
BINARY SYSTEMS ENGR. KASHIF SHAHZAD 1. BINARY NUMBERS 1/2 Internally, information in digital systems is of binary form groups of bits (i.e. binary numbers)
COMPUTER ARCHITECTURE & OPERATIONS I Instructor: Yaohang Li.
1 Binary Signals Logic gate circuits are designed to input and output only two types of signals: “high” (1) and “low” (0), as represented by a variable.
CHAPTER 3 BINARY NUMBER SYSTEM. Computers are electronic machines which operate using binary logic. These devices use two different values to represent.
Some basic concepts underlying computer archi­tecture
Chapter 1 Digital Systems and Binary Numbers
Data Representation COE 308 Computer Architecture
Binary Representation in Text
Binary Representation in Text
DAT10403 CHAPTER 4 COMPUTER ARITHMETIC By Noordiana Kassim
3 – Boolean Logic and Logic Gates 4 – Binary Numbers
Boolean Algebra & Logic Gates
Chapter 3 - Binary Numbering System
Data Representation ICS 233
Lec 3: Data Representation
Data Representation.
3.1 Denary, Binary and Hexadecimal Number Systems
Data Representation Binary Numbers Binary Addition
Data Representation in Computer Systems
Chapter 3 Data Representation
Fundamentals & Ethics of Information Systems IS 201
University of Gujrat Department of Computer Science
2 Number Systems and Codes Edited by Jerry Bernardini.
Invitation to Computer Science, Java Version, Third Edition
Binary Numbers Material on Data Representation can be found in Chapter 2 of Computer Architecture (Nicholas Carter) CSC 370 (Blum)
Chapter 2 Bits, Data Types & Operations Integer Representation
Number Systems and Codes
Some basic electronics and truth tables
Binary Numbers Material on Data Representation can be found in Chapter 2 of Computer Architecture (Nicholas Carter) CSIT 301 (Blum)
Digital Electronics & Logic Design
CISC101 Reminders Your group name in onQ is your grader’s name.
ELL100: INTRODUCTION TO ELECTRICAL ENGG.
For OCR GCSE Computing Unit 1 - Theory
Data Representation – Chapter 3
13 Digital Logic Circuits.
Storing Negative Integers
Binary Numbers Material on Data Representation can be found in Chapter 2 of Computer Architecture (Nicholas Carter) CSIT 301 (Blum)
UNIT – 3 & 4. Data Representation and Internal
CSE 370 – Winter Number syst.; Logic functions- 1
Chapter 3 - Binary Numbering System
ENEL 111 Digital Electronics
Data Representation COE 308 Computer Architecture
Presentation transcript:

Binary Numbers

Why Binary? Maximal distinction among values  minimal corruption from noise Imagine taking the same physical attribute of a circuit, e.g. a voltage lying between 0 and 5 volts, to represent a number The overall range can be divided into any number of regions

Don’t sweat the small stuff For decimal numbers, fluctuations must be less than 0.25 volts For binary numbers, fluctuations must be less than 1.25 volts 5 volts 0 volts Binary Decimal

It doesn’t matter …. Recall the power supply voltage measurements from lab 1 Ideally they should be 5.00 volts and 12.00 volts Typically they were 5.14 volts or 12.22 volts So what, who cares

How to represent big integers Use positional weighting, same as with decimal numbers 205 = 2102 + 0101 + 5100 11001101 = 127 + 126 + 025 + 024 + 123 + 122 + 021 + 120 = 128 + 64 + 8 + 4 + 1 = 205

Converting 205 to Binary 205/2 = 102 with a remainder of 1, place the 1 in the least significant digit position Repeat 102/2 = 51, remainder 0 1 1

Iterate 51/2 = 25, remainder 1 25/2 = 12, remainder 1 1 1

Iterate 6/2 = 3, remainder 0 3/2 = 1, remainder 1 1/2 = 0, remainder 1 1 1 1

Recap 127 + 126 + 025 + 024 + 123 + 122 + 021 + 120 205 1

Adding Binary Numbers Same as decimal; if sum of digits in a given position exceeds the base (10 for decimal, 2 for binary) then there is a carry into the next higher position 1 3 9 + 5 7 4

Adding Binary Numbers 1 +

Uh oh, overflow What if you use a byte (8 bits) to represent an integer A byte may not be enough to represent the sum of two such numbers 1

Bigger Numbers You can represent larger numbers by using more words You just have to keep track of the overflows to know how the lower numbers (less significant words) are affecting the larger numbers (more significant words)

Negative numbers Negative x is that number when added to x gives zero Ignoring overflow the two eight-bit numbers above sum to zero 1

Two’s Complement Step 1: exchange 1’s and 0’s Step 2: add 1 1 1 1

Riddle Is it 214? Or is it – 42? Or is it …? It’s a matter of interpretation How was it declared? 1

Hexadecimal Numbers Even moderately sized decimal numbers end up as long strings in binary Hexadecimal numbers (base 16) are often used because the strings are shorter and the conversion to binary is easier There are 16 digits: 0-9 and A-F

Decimal  Binary  Hex 0  0000  0 1  0001  1 2  0010  2 3  0011  3 4  0100  4 5  0101  5 6  0110  6 7  0111  7 8  1000  8 9  1001  9 10  1010  A 11  1011  B 12  1100  C 13  1101  D 14  1110  E 15  1111  F

Binary to Hex Break a binary string into groups of four bits (nibbles) Convert each nibble separately 1 E C 9

Addresses With user friendly computers, one rarely encounters binary, but we sometimes see hex, especially with addresses To enable the computer to distinguish various parts, each is assigned an address, a number Distinguish among computers on a network Distinguish keyboard and mouse Distinguish among files Distinguish among statements in a program Distinguish among characters in a string

How many? One bit can have two states and thus distinguish between two things Two bits can be in four states and … Three bits can be in eight states, … N bits can be in 2N states 1 1

IP Addresses An IP address is used to identify a network and a host on the Internet It is 32 bits long How many distinct IP addresses are there?

Characters We need to represent characters using numbers ASCII (American Standard Code for Information Interchange) is a common way A string of eight bits (a byte) is used to correspond to a character Thus 28=256 possible characters can be represented Actually ASCII only uses 7 bits, which is 128 characters; the other 128 characters are not “standard”

Unicode Unicode uses 16 bits, how many characters can be represented? Enough for English, Chinese, Arabic and then some.

ASCII 0  00110000 1  00110001 … A  01000001 B  01000010 a  01100001 b  01100010

Booleans A Boolean variable is something that is true or false Booleans have two states and could be represented by a single bit (1 for true and 0 for false) Booleans appearing in a program will take up a whole word in memory

Boolean Operators Aka logical operators Have Boolean input and Boolean output Standard: AND OR NOT XOR (either or but not both) NOR = NOT(OR) NAND = NOT(AND)

Venn Diagrams If inside circle A means A is true, and similarly for circle B, then (A AND B) is the intersection B A

Truth Tables AND INPUT OUTPUT A B A AND B 1

Truth Tables (Cont.) OR INPUT OUTPUT A B A OR B 1

Truth Tables (Cont.) XOR (Excluded OR) INPUT OUTPUT A B A XOR B 1

So I lied We said computing was all about numbers, but it’s really all about logic The adding operation is just a particular combination of logic operations Possibilities for adding two bits 0+0=0 (with no carry) 0+1=1 (with no carry) 1+0=1 (with no carry) 1+1=0 (with no carry)

Addition Truth Table INPUT OUTPUT A B Sum A XOR B Carry A AND B 1

All is NAND Actually you can use one logic gate and a few tricks (like De Morgan’s theorem) to build all of the “combinatorial” circuitry (the circuitry that doesn’t involve memory) NORs work too But we tend to think in ANDs, ORs and NOTs

Bit manipulation You can use an AND to select out part of a word (where s is a 1 or 0, etc) s t u v w x y z AND 1 gives s t u v

IP Addresses Revisted LaSalle’s IP address is what’s called a Class B IP address Of the 32 bits the first two are 10 (this identifies us as Class B) The remaining 14 bits of the first two bytes identify us as LaSalle The remaining 2 bytes are for our internals use (to assign computers within LaSalle)

In or Out To see if an address is local to LaSalle, you would restrict your attention to the first two bytes. HOW? AND it with FFFF0000