Digital Logic and Design (EEE-241) Lecture 2

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

Chapter 1: Digital Systems and Binary Numbers

CPEN Digital Logic Design Binary Systems

COMBINATIONAL CIRCUITS

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

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

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

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

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

Binary Adders: Half Adders and Full Adders

Number and codes in digital systems

Binary Numbers. Binary Octal Hexadecimal

BINARY CODED DECIMAL: B.C.D.

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

Chapter 4 Register Transfer and Microoperations. Section 4.1 Register Transfer Language

Systems I: Computer Organization and Architecture

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

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

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

Let s put together a Manual Processor

Upon completion of unit 1.1, students will be able to

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

Lecture 2. Binary and Hexadecimal Numbers

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

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

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

Useful Number Systems

CSI 333 Lecture 1 Number Systems

Binary Representation

Design Example: Counters. Design Example: Counters. 3-Bit Binary Counter. 3-Bit Binary Counter. Other useful counters:

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

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

MEP Y9 Practice Book A

Microprocessor & Assembly Language

Chapter 2. Binary Values and Number Systems

Digital Electronics Detailed Outline

Experiment # 9. Clock generator circuits & Counters. Eng. Waleed Y. Mousa

(Refer Slide Time: 00:01:16 min)

NUMBER SYSTEMS. 1.1 Introduction

Chapter 4: Computer Codes

Counters and Decoders

MATH-0910 Review Concepts (Haugen)

Lecture N -1- PHYS Microcontrollers

Computers. Hardware. The Central Processing Unit (CPU) CMPT 125: Lecture 1: Understanding the Computer

CS101 Lecture 26: Low Level Programming. John Magee 30 July 2013 Some material copyright Jones and Bartlett. Overview/Questions

Z80 Instruction Set. Z80 Assembly Language

Section 1.4 Place Value Systems of Numeration in Other Bases

Numbering Systems. InThisAppendix...

Digital Versus Analog Lesson 2 of 2

Logic Reference Guide

Data Storage 3.1. Foundations of Computer Science Cengage Learning

Computer Science 281 Binary and Hexadecimal Review

DEPARTMENT OF INFORMATION TECHNLOGY

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

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

Sistemas Digitais I LESI - 2º ano

5.4 Solving Percent Problems Using the Percent Equation

Chapter 01: Introduction. Lesson 02 Evolution of Computers Part 2 First generation Computers

CHAPTER IX REGISTER BLOCKS COUNTERS, SHIFT, AND ROTATE REGISTERS

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

INTRODUCTION TO DIGITAL SYSTEMS. IMPLEMENTATION: MODULES (ICs) AND NETWORKS IMPLEMENTATION OF ALGORITHMS IN HARDWARE

Math Review. Numbers. Place Value. Rounding Whole Numbers. Place value thousands hundreds tens ones

Chapter Binary, Octal, Decimal, and Hexadecimal Calculations

Systems I: Computer Organization and Architecture

MICROPROCESSOR AND MICROCOMPUTER BASICS

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

Chapter 2 Logic Gates and Introduction to Computer Architecture

Basic Use of the TI-84 Plus

Number Systems and Radix Conversion

Latches, the D Flip-Flop & Counter Design. ECE 152A Winter 2012

SIM-PL: Software for teaching computer hardware at secondary schools in the Netherlands

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

Chapter 2 Basic Structure of Computers. Jin-Fu Li Department of Electrical Engineering National Central University Jungli, Taiwan

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

MICROPROCESSOR. Exclusive for IACE Students iacehyd.blogspot.in Ph: /422 Page 1

1. Convert the following base 10 numbers into 8-bit 2 s complement notation 0, -1, -12

Two's Complement Adder/Subtractor Lab L03

Memory Systems. Static Random Access Memory (SRAM) Cell

Solution for Homework 2

Technical Support Bulletin Nr.18 Modbus Tips

Lecture 11: Number Systems

Digital Electronics Part I Combinational and Sequential Logic. Dr. I. J. Wassell

Systems I: Computer Organization and Architecture

First Bytes Programming Lab 2

Multiple Choice Questions(Computer)

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

The Hexadecimal Number System and Memory Addressing

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

Digital Systems Based on Principles and Applications of Electrical Engineering/Rizzoni (McGraw Hill

Digital Logic Design. Introduction

IP Subnetting and Related Topics A Tutorial by Chris Uriarte <chrisjur@cju.com> Updated April 2001

LEVERAGING FPGA AND CPLD DIGITAL LOGIC TO IMPLEMENT ANALOG TO DIGITAL CONVERTERS

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

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

Design and Development of Virtual Instrument (VI) Modules for an Introductory Digital Logic Course

Base Conversion written by Cathy Saxton

A Step towards an Easy Interconversion of Various Number Systems

=

Positional Numbering System

Transcription:

Digital Logic and Design (EEE-241) Lecture 2 Dr. M. G. Abbas Malik abbas.malik@ciitlahore.edu.pk Picture Source: http://www.vanoast.com/old-portfolio/digital-design-logo-one%5ba%5d.jpg

Previous lecture Digital Vs. Analog Digital System example digital computer Discrete values and binary values Number system (positional and non-positional) Binary number system Conversion, addition, subtraction, multiplication, division. i i Octal number system (conversion) Hexadecimal number system (conversion) 2

Complements Complements are used to simplify the subtraction operation and for logical manipulation Consider r is the base of a number system, then there exist two types of complement 1. r s complement 2. (r-1) 1) s complement Example For binary number system, there are two complements 2 s (r) complement and 1 s (r-1) complement For decimal number system, these are 10 s and 9 s complements. 3

Complements 4 r s rscomplements r is the base of our number system. X is a number in base r that t has n digits it in its integral part. The r s complement of X is defined d as r n X for X 0 and 0 for X=0. Example 1: Decimal numbers 1234.765 Decimal Number: Integral Fractional 10 s (r s) complement = 10 4-1234.765 Part Part = 8765.235

Complements r s rscomplements Example 1: Decimal numbers (cont ) The 10 s complement of (0.3456) 10 is 10 0 0.3456 = 1 0.3456 = 0.6544 10 s complement can formed by leaving all least significant ZEROS unchanged, subtracting ti the first non-zero least significant ifi digit from 10, and then subtracting all other higher h significant ifi digits it from 9. 5

Complements r s rscomplements Example 2: Binary numbers The 2 s 2s (r s) (rs) complement of (101100) 2 is (2 6 ) 10 (101100) 2 = (1000000-101100) 2 = (010100) 2 The 2 s complement of (0.0110) 2 is (2 0 ) 10 (0.0110) 0110) 2 =(1 0.0110) 0110) 2 = 0.1010 The 2 s complement can be computed by leaving all least significant ZEROS and first non-zero digit unchanged, and then replacing 1 s by 0 s and 0 s by 1 s in all other higher significant digits. 6

Complements 7 (r-1) s complements r is the base of our number system. X is a number in base r that t has n digits it in its integral part and a fractional part with m digits. The (r-1) s complement of X is defined d as r n r -m X Example 1: Decimal numbers 1234.765 Decimal Number: 9 s (r-1 s) complement = 10 4 10-3 - 1234.765 Fractional = 10000 0.001 1234.765 = 8765 234 Integral Part Part = 8765.234

Complements (r-1) s complements Example 1: Decimal numbers (cont ) The 9 s complement of (0.3456) 10 is 10 0 10-4 0.3456 = 1 0.0001-0.3456 = 0.6543 9 s complement of a decimal number is formed by subtracting every digit by 9. 8

Complements (r-1) s complements Example 2: Binary numbers The 1 s 1s complement of (101100) 2 is (2 6 2 0 ) 10 (101100) 2 = (1000000 1 101100) 2 = (111111 101100) 2 = (010011) 2 The 1 s complement of (0.0110) 2 is (2 0 2-4 ) 10 (0.0110) 0110) 2 =(1 0.00010001 0.0110) 0110) 2 = (0.1111 0.0110) 2 = (0.1001) 2 The 1 s 1s complement is formed by replacing 1 s 1s by 0 s and 0 s by 1 s. 9

Complements Conversions r s complement to (r-1) s complement r s complement r -m (r-1) s complement to r s complement (r-1) s complement + r -m 10

Subtraction ti General Subtraction 246 Minuend 138 Subtrahend ----- 108 In general, when the minuend digit is smaller than the corresponding subtrahend digit, we borrow 1 from the higher significant position. This is easier when people p perform subtraction with paper and pencil. This method is less efficient in digital systems. 11

Subtraction ti with Complements With r s Complement Suppose we have two positive number X and Y, both of base r. Subtraction X Y may be done as follows: 1. Add the minuend X to the r s compliment of the subtrahend Y. 2. Inspect the result obtained in step 1 for an end carry a) If an end carry occurs, discard the end carry. b) If an end carry does not occur, take the r s complement of the number obtained in step 1 and place a negative sign in front. 12

Subtraction ti with Complements With r s Complement Example 1 Decimal numbers X = 72532 72532 Y = 3250 10 complement of 03250 = + 96750 End carry 1 69282 Answer of X Y = 69282 13

Subtraction ti with Complements With r s Complement Example 1 Decimal numbers X = 3250 03250 Y = 72532 10 complement of 72532 = + 27468 No end carry 30718 Answer of X Y = 10 s complement of 30718 = 69282 14

Subtraction ti with Complements Number of digits in X and Y must be same. Before taking the r s complement of fs Subtrahend (Y), if Y has less number of digits, then we add ZEROS to the left of the number and take r s complement considering newly added ZEROS as part of the number. 15

Subtraction ti with Complements With r s Complement Example 2 Binary numbers X = 1010100 1010100 Y = 100100 2 s complement of 0100100 = + 1011100 End carry 1 0110000 Answer of X Y = 110000 16

Subtraction ti with Complements With r s Complement Example 2 Binary numbers X = 100100 0100100 Y = 1010100 2 s complement of 1010100 = + 0101100 No end carry 1010000 Answer = 2 s complement of 1010000 = 110000 17

Subtraction ti with Complements With (r-1) s complement Suppose we have two positive number X and Y, both of base r. Subtraction X Y may be done as follows: 1. Add the minuend X to the (r-1) s compliment of the subtrahend Y. 2. Inspect the result obtained in step 1 for an end carry a) If an end carry occurs, add 1 to the least significant digit (end around carry). b) If an end carry does not occur, take the (r-1) s complement of the number obtained in step 1 and place a negative sign in front. 18

Subtraction ti with Complements With (r-1) s Complement Example 1 Decimal numbers X = 72532 72532 Y = 3250 9 s complement of 03250 = + 96749 End carry 1 69281 + Answer of X Y = 69282 19

Subtraction ti with Complements With (r-1) s Complement Example 1 Decimal numbers X = 3250 03250 Y = 72532 9 s complement of 72532 = + 27467 No end carry 30717 Answer of X Y = 9 s complement of 30718 = 69282 20

Subtraction ti with Complements Number of digits in X and Y must be same. Before taking the r s complement of fs Subtrahend (Y), if Y has less number of digits, then we add ZEROS to the left of the number and take r s complement considering newly added ZEROS as part of the number. 21

Subtraction ti with Complements With (r-1) s Complement Example 2 Binary numbers X = 1010100 1010100 Y = 100100 1 complement of 0100100 = + 1011011 End carry 1 0101111 + Answer of X Y = 110000 22

Subtraction ti with Complements With (r-1) s Complement Example 2 Binary numbers X = 100100 0100100 Y = 1010100 1 complement of 1010100 = + 0101011 No end carry 1001111 Answer = 1 s complement of 1010000 = 110000 23

Complements in Digital it Systems 2 s complement 1 s complement 1. Harder to implement 1. Easier to implement 2. Subtraction take only 2. Subtraction takes two one arithmetic arithmetic additions addition 3. Possesses two arithmetic zeros: one 3. Possesses only one with all 0s and one arithmetic 0 with all 1s 4. Used only in 4. Useful in logical conjunction with manipulation: change arithmetic applications of 1 s to 0 s - inversion 24

Binary Codes Electronic digital systems use signals that have two distinct values and Circuit elements that have two stable states. A binary number of n-digits may be represented by n binary circuit elements, each having an output signal equivalent to 1 or 0. Digital system not only manipulate binary numbers, but also many other discrete elements of information. i o Colors o Decimal digits o Alphabets (English, French, Urdu, Hindi, Punjabi, etc.) 25

Binary Codes A bit is a binary digit. To represent a group of 2 n distinct discrete elements in a binary code requires a minimum of n bits. Example 1: Color Codes Consider we have four colors: RED, GREEN, BLACK and BLUE We want to assign a binary code to each color, so that we can represent these information in our digital system 26

Binary Codes Example 1: Color Codes (cont ) We have total 4 = 2 2 distinct discrete elements. It means we need minimum i 2 bits to represent these four colors. Color Binary Code Black 00 Blue 01 Green 10 Red 11 27

Binary Codes Example 2: Binary Coded Decimal (BCD) Binary code for decimal digits require a minimum 4bitsas2 4 =16>10>8=2 10 > = 3 Bit required Number of Discrete Elements 1 2 0 discrete elements 2 1 2 2 1 discrete elements 2 2 3 2 2 discrete elements 2 3 4 2 3 discrete elements 2 4 5 2 4 discrete elements 2 5 8 2 7 discrete elements 256=2 8 28

Binary Codes 29 Example 2: Binary Coded Decimal (BCD) Binary code for decimal digits require a minimum 4bitsas2 4 =16>10>8=2 10 > = 3 Decimal Digit BCD Decimal Digit BCD 0 0000 5 0101 1 0001 6 0110 2 0010 7 0111 3 0011 8 1000 4 0100 9 1001 Home Work: Read & Understand the other decimal codes given in table 1-2 and binary codes: Error-Detection, ti Reflected &Al Alphanumeric Codes (Section1-6) 1

Binary Codes Difference between Binary Codes and Binary Conversion When we convert a decimal number in binary, it is a sequence of 1 s 1s and 0 s 0s similar to binary codes, but they are different. Binary Conversion Binary Codes Conversion of decimal number 24 in binary is Binary code of decimal number 24 in BCS is (11000) 2 (0010 0100) 2 30

Binary Storage and Registers Binary Cell is a device that possesses two stable states and is capable of storing one bit of information. o In Electronics, it is a flip-flop circuit, ferrite core use in memory o In a Punch-Card, positions punched with a hole or not punched. Binary cells are used to store the digital (binary) information Register is a group of binary cells 31

Binary Storage and Registers 1bit= 1 binary cell 1 byte = 8 bits Register size depends on the computer system architecture. 1. 8 bits architecture register size is 8 bits 2. 16 bits architecture register size is 16 bits 3. 32 bits architecture register size is 32 bits 4. 64 bits architecture (latest) register size is 64 bits A digital computer is characterized by its registers. Assignment # 2 (available on course website) 32

Registers A register with n binary cells can stores any discrete quantity of information that contains n bits. This is a 16-cells register 1 0 0 0 0 0 1 1 0 1 1 0 1 0 0 1 8 3 6 9 If contains the BCD information then it represent the decimal number 8369 33

Register Memory (RAM) is merely a collection of thousands of registers. The processor unit composed of various registers that stores operands on which operations are performed. o For example for the addition of two numbers, first number (operand) is stored in the register A and the second number (operand) is stored in the register B and their sum after calculations is stored in the register C The control unit uses registers to keep track of various computer sequences Every input and output device must have at least one register to store the information transferred to or from the device 34

Register Transfer 35

Register Transfer 36

Logic NOT AND OR 37

Logic Gates 38 Image Source: http://images.wikia.com/bmet/images/a/ab/logic_gate.gif