Binary Arithmetic, ASCII, & Boolean Algebra

Slides:



Advertisements
Similar presentations
Chapter 2 Logic Circuits.
Advertisements

Number Bases Informatics INFO I101 February 9, 2004 John C. Paolillo, Instructor.
Company LOGO Edit your slogan here DKT 122/3 DIGITAL SYSTEM 1 WEEK #3 NUMBER SYSTEMS, OPERATION & CODES (PART 2)
A digital system is a system that manipulates discrete elements of information represented internally in binary form. Digital computers –general purposes.
ECE C03 Lecture 21 Lecture 2 Two Level Minimization Hai Zhou ECE 303 Advanced Digital Design Spring 2002.
Text Representation within Computers CS208. The Binary Digit (Bit) One bit can encode a value set that contains two elements e.g. {black, white}, {up,
1 COMP541 Combinational Logic Montek Singh Jan 16, 2007.
Design of Arithmetic Circuits – Adders, Subtractors, BCD adders
Contemporary Logic Design Two-Level Logic © R.H. Katz Transparency No. 3-1 Chapter #2: Two-Level Combinational Logic Section 2.1, Logic Functions.
Canonical Forms and Logic Miniminization
1 CSE-221 Digital Logic Design (DLD) Lecture-1: Digital Systems & Number Systems.
S. Barua – CPSC 240 CHAPTER 2 BITS, DATA TYPES, & OPERATIONS Topics to be covered are Number systems.
Data Representation 3 This week – Recap on Floating point number – ASCII – unicode.
Introduction to Computer Engineering ECE/CS 252, Fall 2010 Prof. Mikko Lipasti Department of Electrical and Computer Engineering University of Wisconsin.
Part 2: DESIGN CIRCUIT. LOGIC CIRCUIT DESIGN x y z F F = x + y’z x y z F Truth Table Boolean Function.
Mantıksal Tasarım – BBM231 M. Önder Efe
Chapter 2 Bits, Data Types, and Operations. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 2-2 How do we.
Chapter 2: Boolean Algebra and Logic Functions
ACOE1611 Data Representation and Numbering Systems Dr. Costas Kyriacou and Dr. Konstantinos Tatas.
Numbers and Number Systems
Logic and data representation Revision. AND gate A B A B All inputs have to be true ( i.e 1) for the output of the gate to be high, in all other cases.
Binary Numbers.
©zaher elsir Sudan Academy for Banking & Financial Sciences Decimal Number System Base (Radix)10 Digits0, 1, 2, 3, 4, 5, 6, 7, 8, 9 e.g The magnitude.
Logic and Digital System Design - CS 303
BOOLEAN ALGEBRA Saras M. Srivastava PGT (Computer Science)
EE2174: Digital Logic and Lab Professor Shiyan Hu Department of Electrical and Computer Engineering Michigan Technological University CHAPTER 2 Number.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Idea 1: Bits Two states in a digital machine: 1.presence of.
ICT Foundation 1 Copyright © 2010, IT Gatekeeper Project – Ohiwa Lab. All rights reserved. Character representation.
Bits, Data Types, and Operations. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 2-2 How do we represent.
NUMBER SYSTEM AND COMPUTER CODES Chapter 2. Prelude Fingers, sticks, and other things for counting were not enough! Counting large numbers Count in groups.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Logic Circuits I.
Logic Design Dr. Yosry A. Azzam. Binary systems Chapter 1.
PART 2 Data Types 1. Integers 2. 2’s Complement 3. Conversion
Chapter 2 Bits, Data Types, and Operations. 2-2 Hexadecimal Notation It is often convenient to write binary (base-2) numbers as hexadecimal (base-16)
Bits, Data Types, and Operations Slides based on set prepared by Gregory T. Byrd, North Carolina State University.
Combinational Logic 1.
1 Boolean Logic & Number Systems Today: Some Announcements First Hour: Introduction to Logic –Section 1.2, 1.3 of Katz’s Textbook –In-class Activity #1.
Chapter 2 Bits, Data Types, and Operations. 2-2 How do we represent data in a computer? At the lowest level, a computer is an electronic machine. works.
Chapter 2 Two- Level Combinational Logic. Chapter Overview Logic Functions and Switches Not, AND, OR, NAND, NOR, XOR, XNOR Gate Logic Laws and Theorems.
Number Systems and Digital Codes
AEEE2031 Data Representation and Numbering Systems.
1 Lect # 2 Boolean Algebra and Logic Gates Boolean algebra defines rules for manipulating symbolic binary logic expressions. –a symbolic binary logic expression.
1 COMP541 Combinational Logic - II Montek Singh Jan 18, 2012.
Logic Design EE-2121 Manesh T. Digital Systems  Introduction  Binary Quantities and Variables  Logic Gates  Boolean Algebra  Combinational Logic.
ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN Lecture 4 Dr. Shi Dept. of Electrical and Computer Engineering.
CPS120: Introduction to Computer Science Computer Math: Addition and Subtraction.
ECE DIGITAL LOGIC LECTURE 15: COMBINATIONAL CIRCUITS Assistant Prof. Fareena Saqib Florida Institute of Technology Fall 2015, 10/20/2015.
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)
CSE 461. Binary Logic Binary logic consists of binary variables and logical operations. Variables are designated by letters such as A, B, C, x, y, z etc.
COMPUTER ORGANIZATION 4 TH LECTURE. ASCII Code  ASCII ( American Standard Code for Information Interchange).  Input and output devices that communicate.
Computer Code.
Chapter 2: Boolean Algebra and Logic Functions
Digital Systems and Number Systems
CS 105 Digital Logic Design
CHAPTER 2 Boolean Algebra
Princess Sumaya University
IT 0213: INTRODUCTION TO COMPUTER ARCHITECTURE
University of Gujrat Department of Computer Science
CSE 311 Foundations of Computing I
Digital Electronics & Logic Design
CSE 370 – Winter Combinational Logic - 1
Boolean Algebra.
January 19 W’05 Yutao He 4532B Boelter Hall CSM51A/EEM16-Sec.1 W’05
February 7, 2002 John Wawrzynek
BOOLEAN ALGEBRA AND LOGIC SIMPLIFICATION Part (a)
COMS 361 Computer Organization
Logic Circuits I Lecture 3.
Design of Digital Circuits Lab 1 Supplement: Drawing Basic Circuits
Boolean Algebra By: Asst Lec. Besma Nazar Nadhem
CSE 370 – Winter Number syst.; Logic functions- 1
Presentation transcript:

Binary Arithmetic, ASCII, & Boolean Algebra Today: First Hour: Computer Arithmetic, Representation of Symbols Representing Symbols – the ASCII code Appendix A.2 & A.3 of Katz’s Textbook In-class Activity #1 Second Hour: Boolean Algebra Section 2.1 of Katz’s Textbook In-class Activity #2

Recap X Y OR 1 OR X Y Z Z = X + Y Decimal Binary Hex Octal

Binary Arithmetic You already know the rules for decimal addition and subtraction (how to handle sums, carries, differences, and borrows). Analogously, we develop the rules for binary addition and subtraction. Taken from Appendix A.3

Decimal Addition 9510 9 x 101 + 5 x 100 + 1610 + 1 x 101 + 6 x 100  Refresher 9510 9 x 101 + 5 x 100 + 1610 + 1 x 101 + 6 x 100 10 x 101 + 11 x 100 11110  = 1 x 102 + (0+1) x 101 + 1 x 100 Summary 11  Column carries 9510 + 1610 11110

Binary Addition This table calculates the sum for pairs of binary numbers 0 + 0 = 0 0 + 1 = 1 1 + 0 = 1 1 + 1 = 0 with a carry of 1 Also known as the Half Adder Table

Binary Addition with Carry This table shows all the possible sums for binary numbers with carries carry addend augend sum 0 + 0 + 0 = 0 0 + 0 + 1 = 1 0 + 1 + 0 = 1 0 + 1 + 1 = 0 with a carry of 1 1 + 0 + 0 = 1 1 + 0 + 1 = 0 with a carry of 1 1 + 1 + 0 = 0 with a carry of 1 1 + 1 + 1 = 1 with a carry of 1 Also known as the Full Adder Table

Similar to the decimal case Example: Add 5 and 3 in binary Binary Addition Similar to the decimal case Example: Add 5 and 3 in binary (carries) 1 0 12 = 510 + 1 12 = 310 = 810 1 1 10 1 10 1 102

Decimal Subtraction Refresher 9 1510 95 = 9x101 + 5x100 = 9x101 + 15x100 - 1 610 -16 = -1x101 + -6x100 = -1x101 + -6x100 - 1 7 910 7x101 + 9x100 borrow = -1x101 Note: borrows are shown as explicit subtractions.

Binary Subtraction 0 - 0 = 0 0 - 1 = 1 with a borrow of 1 1 - 0 = 1 This table calculates the difference for pairs of binary numbers 0 - 0 = 0 0 - 1 = 1 with a borrow of 1 1 - 0 = 1 1 - 1 = 0 Also known as the Half Subtractor Table

Binary Subtraction with Borrow This shows all the possibile differences for binary numbers with borrows minuend subtrahend borrow difference 0 - 0 - 0 = 0 0 - 0 - 1 = 1 with a borrow of 1 0 - 1 - 0 = 1 with a borrow of 1 0 - 1 - 1 = 0 with a borrow of 1 1 - 0 - 0 = 1 1 - 0 - 1 = 0 1 - 1 - 0 = 0 1 - 1 - 1 = 1 with a borrow of 1 Also known as the Full Subtractor Table

Similar to the decimal case Example: Subtract 3 from 5 in binary Binary Subtraction Similar to the decimal case Example: Subtract 3 from 5 in binary 1 0 12 = 510 - 1 12 = 310 1 02 = 210 - 1 (borrows) 10

American Standard Code for Information Interchange Representing Symbols American Standard Code for Information Interchange 7-bits per symbol 27 = 128 different symbols 26 uppercase letters (A-Z) 26 lowercase letters (a-z) 10 digits (0-9) 1 blank space (SP) 32 special-character symbols 32 non-printing control characters 1 delete character (DEL)

The 7-bit ASCII Code Leftmost 3 bits Rightmost 4 bits 1 2 3 4 5 6 7 1 2 3 4 5 6 7 NUL DLE SP @ P ` p SOH DC1 ! A Q a q STX DC2 " B R b r ETX DC3 # C S c s EOT DC4 $ D T d t ENQ NAK % E U e u ACK SYN & F V f v BEL ETB ' G W g w 8 BS CAN ( H X h x 9 HT EM ) I Y i y LF SUB * : J Z j z VT ESC + ; K [ k { FF FS , < L \ l | CR GS - = M ] m } SO RS . > N ^ n ~ SI US / ? O _ o DEL Rightmost 4 bits

Example string: "I am here @ RPI\r\n" ASCII Example Example string: "I am here @ RPI\r\n" I SP a m h e r @ R P CR LF NUL 49 20 61 6D 68 65 72 40 52 50 0D 0A 00 (hexadecimal notation)

Control codes are non-printing How do you type them on a conventional keyboard? For example, how do you get the ESC control if your keyboard doesn’t have such a key? The Ctrl key forces the 2 most significant bits to 00 Hold the Control key, Ctrl, and type [ to get Ctrl-[ [ = 5B16 = 101 1011  001 1011 = 1B16 = ESC Similarly, Ctrl-c changes 110 0011 to 000 0011 (ETX)

Do Activity #1 Now Leftmost 3 bits Rightmost 4 bits Learn to add and subtract binary numbers Get to know the ASCII code 1 2 3 4 5 6 7 NUL DLE SP @ P ` p SOH DC1 ! A Q a q STX DC2 " B R b r ETX DC3 # C S c s EOT DC4 $ D T d t ENQ NAK % E U e u ACK SYN & F V f v BEL ETB ' G W g w 8 BS CAN ( H X h x 9 HT EM ) I Y i y LF SUB * : J Z j z VT ESC + ; K [ k { FF FS , < L \ l | CR GS - = M ] m } SO RS . > N ^ n ~ SI US / ? O _ o DEL Rightmost 4 bits

Boolean Algebra A set of theorems for manipulating Boolean variables. They are useful because they help simplify circuits to reduce cost help debug circuits help us with “reverse engineering” help us with “re-engineering” Most of them are similar to ordinary algebra, but a few are very different.

Theorems – Set #1 Operations with 0 and 1 1. X + 0 = X 1D. X • 1 = X Idempotent Law 3. X + X = X 3D. X • X = X Involution Law 4. Laws of Complements 5. 5D. Commutative Law 6. X + Y = Y + X 6D. X • Y = Y • X Associative Law: 7. (X + Y) + Z = X + (Y + Z) 7D. (X • Y) • Z = X • (Y • Z) = X + Y + Z = X • Y • Z

Duality A Boolean equation says that two expressions are always equal. E.g.: X + Y = Y + X The dual of a Boolean equation is derived by replacing AND operations by ORs, OR operations by ANDs, constant 0s by 1s, and 1s by 0s (literals like X and X are left unchanged). For any equation that is true, its dual is also true! Example: X + 0 = X Dual equation: X • 1 = X Use duality to derive laws 1D – 7D from 1 – 7 !

Theorems – Set #2 Freaky!! Distributive Law 8. X • (Y+ Z) = (X • Y) + (X •Z) 8D. X + (Y• Z) = (X + Y) • (X + Z) Simplification Theorems 9. 9D. 10. X + (X • Y) = X 10D. X • (X + Y) = X 11. 11D.

 Theorems – Set #3 De Morgan's Laws “NOR” “NAND” In general… 12. (X + Y + Z + ...) = X • Y • Z • ... 12D. (X • Y • Z • ...) = X + Y + Z + ... 13. F(X1,X2,...,Xn, 0, 1, +, •) = F(X1, X2, ...,Xn, 1, 0, •, +)

DeMorgan's with Bubbles Two bubbles cancel each other out “All NAND” circuit has the same topology as the AND-OR

Use to convert AND/OR expressions to OR/AND expressions DeMorgan's Law Use to convert AND/OR expressions to OR/AND expressions Examples:

Theorems - Set 4 Qn: How do we know if these theorems work? Duality 14. (X + Y + Z + ...)D = X • Y • Z • ... 14D. (X • Y • Z • ...)D = X + Y + Z + ... 15. {F(X1,X2,...,Xn,0, 1, +, •)}D = {F(X1,X2,...,Xn, 1, 0, •, +)} Multiplying and Factoring Theorems 16. 16D. Consensus Theorem 17. 17D. Watch out! Cancellation does not work in Boolean algebra! Qn: How do we know if these theorems work?

Proving Theorems Boolean Algebra: E.g., prove the theorem: X • Y + X • Y = X X • Y + X •Y = X • (Y + Y) X • (Y + Y) = X • (1) X • (1) = X distributive law (8) Law of complements (5) identity (1D) E.g., prove the theorem: X + X • Y = X X + X • Y = X • 1 + X • Y X • 1 + X • Y = X • (1 + Y) X • (1 + Y) = X • (1) X • (1) = X identity (1D) distributive law (8) identity (2) identity (1)

Other Useful Functions There are 16 possible unique functions of 2 variables X 1 Y 1 F0 F1 1 F2 1 F3 1 F4 1 F5 1 F6 1 F7 1 F8 1 F9 1 F10 1 F1 1 F12 1 F13 1 F14 1 F15 1 1 X • Y X Y X + Y Y X NAND XOR XNOR NOR XOR X Y = X Y + X Y X Y Z X Y Z XNOR X  Y = X Y + X Y New and useful gates

Do Activity #2 Now For Next Class: Due: End of Class Today RETAIN THE LAST PAGE (#3)!! For Next Class: Bring Randy Katz Textbook Electronic copy on website will disappear Friday. Required Reading: Sec 2.2 & 2.3 of Katz This reading is necessary for getting points in the Studio Activity!