0% found this document useful (0 votes)
57 views65 pages

DDMP Unit 1 Updated 2024

Uploaded by

subhilogix
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
57 views65 pages

DDMP Unit 1 Updated 2024

Uploaded by

subhilogix
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 65

CS1005: Digital Design & Microprocessors

Dr. Vegesna S M Srinivasavarma,


Assistant Professor,
Computer Science & Engineering,
Shiv Nadar University Chennai.
Overview
• Courses includes both theory and practice.
• Theory contains 5 Units. Each unit will be covered in 9 lecture hours
• 3 Lecture hours and 1 tutorial hour per week (Total: 4 Hrs/week)

Syllabus Overview:
Unit-1: INTRODUCTION TO DIGITAL DESIGN
Unit-2: BOOLEAN ALGEBRA AND MINIMIZATION TECHNIQUES
Unit-3: COMBINATIONAL CIRCUIT DESIGN
Unit-4: SEQUENTIAL CIRCUIT DESIGN
Unit-5: MICROPROCESSORS (Intel 8086)
Unit-1: INTRODUCTION TO DIGITAL
DESIGN

Topics: Number systems: Decimal, Binary, Octal and Hexadecimal - Conversion


from one system to another - Floating point representation of numbers - Arithmetic
operation:1's complement, 2's complement - Introduction to Digital Circuits -
Advantages and Disadvantages of Digital circuits over Analog circuits - Logic gates
-Truth tables
Digital Computer Systems
• Digital systems consider discrete amounts of data.
• Examples
• 26 letters in the alphabet
• 10 decimal digits
• Larger quantities can be built from discrete values:
• Words made of letters
• Numbers made of decimal digits (e.g. 239875.32)
• Computers operate on binary values (0 and 1)
• Easy to represent binary values electrically
• Voltages and currents.
• Can be implemented using circuits
• Create the building blocks of modern computers
Basic Organization of a Digital Computer
Types of Systems
• With no state present
– Combinational logic system
– Output = Function (Input)
• With state present
– State updated at discrete times
(e.g. once per clock tick)
Example : Digital Counter

UP 0 0 1 2 3 4 5
RESET

Inputs : Count Up, Reset


Outputs: Visual Display
State: “Value of stored digits
Is this system synchronous or asynchronous?
Understanding Decimal Numbers
• Decimal numbers are made of decimal digits:
(0,1,2,3,4,5,6,7,8,9)
• But how many items does a decimal number represent?
• 8653 = 8x103 + 6x102 + 5x101 + 3x100
• What about fractions?
• 97654.35 = 9x104 + 7x103 + 6x102 + 5x101 + 4x100 + 3x10-
1 + 5x10-2

• In formal notation -> (97654.35)10


Understanding Octal Numbers

• Octal numbers are made of octal digits: (0,1,2,3,4,5,6,7)


• How many items does an octal number represent?
• (4536)8 = 4x83 + 5x82 + 3x81 + 6x80 = (1362)10
• What about fractions?
• (465.27)8 = 4x82 + 6x81 + 5x80 + 2x8-1 + 7x8-2
• Octal numbers don’t use digits 8 or 9
• Who would use octal number, anyway?
Understanding Binary Numbers
• Binary numbers are made of binary digits (bits):
• 0 and 1
• How many items does an binary number represent?
• (1011)2 = 1x23 + 0x22 + 1x21 + 1x20 = (11)10
• What about fractions?
• (110.10)2 = 1x22 + 1x21 + 0x20 + 1x2-1 + 0x2-2
• Groups of eight bits are called a byte
• (11001001) 2
• Groups of four bits are called a nibble.
• (1101) 2
Why Use Binary Numbers?
• Easy to represent 0 and 1 using
electrical values.
• Possible to tolerate noise.
• Easy to transmit data
• Easy to build binary circuits.

AND Gate

1
0
0
Conversion Between Number Bases
Octal(base 8)

Decimal(base 10) Binary(base 2)

Hexadecimal
(base16)
• Learn to convert between bases.
• Already demonstrated how to convert
from binary to decimal.
Converting Binary to Decimal
• To Convert to decimal, use decimal arithmetic to sum the weighted
powers of two:
• Converting 110102 to N10:
N10 = 1 x 24 x 1x 23 + 0 x 22 + 21 + 0 + 20
= 26
Decimal, BCD, Xcess-3, Binary, Octal, Hexa-Decimal, and Gray Codes:
Decimal BCD Xcess-3 Binary Octal Hexa- Gray
Decimal

0 0000 0011 0000 00 0 0000


1 0001 0100 0001 01 1 0001
2 0010 0101 0010 02 2 0011
3 0011 0110 0011 03 3 0010
4 0100 0111 0100 04 4 0110
5 0101 1000 0101 05 5 0111
6 0110 1001 0110 06 6 0101
7 0111 1010 0111 07 7 0100
8 1000 1011 1000 10 8 1100
9 1001 1100 1001 11 9 1101
10 1010 12 A 1111
11 1011 13 B 1110
12 1100 14 C 1010
13 1101 15 D 1011
14 1110 16 E 1001
15 1111 17 F 1000
Binary to Gray Conversion:
1. The Most Significant Bit (MSB) of the gray code is always equal to the MSB of the given
binary code

2. Other bits of the output gray code can be obtained by XORing binary code bit at that
index and previous index

Example: 100110 (Binary) → 110101 (Gray)

Gray to Binary Conversion:


1. The Most Significant Bit (MSB) of the binary code is always equal to the MSB of the
given gray code.
2. Other bits of the output binary code can be obtained by checking the gray code bit at
that index. If the current gray code bit is 0, then copy the previous binary code bit, else
copy the invert of the previous binary code bit.

Example: 110101 (Gray) → 100110 (Binary)


Gray Codes:

A gray code is a list of ′2𝑛 ′ binary sequences of length ‘n’ such that consecutive sequences in
the list differ in exactly one position.

A gray code is called cyclic if the 1st and last sequence in the list also differ in exactly in one
position.

Primary Motivation for using the gray codes is the computers. Earlier computers were built
using Electro-mechanical switches where the transition from one sequence of 0s and 1s to
another sequence of 0s and 1s will happen in a sequential manner.

Ex: 1 and 2 in 3-bit binary are given as 001 and 010. If the transition has to happen 1-bit at a
time, 1. 001, 2. 011, and 3. 010.

A n-cube 𝑄𝑛 is the graph whose vertices are labelled by the binary sequences of length ‘n’
where two vertices are adjacent if and only if their sequences differ in exactly one bit
position.
Gray Codes:

1. These are not weighted.

2. Also known as reflected binary code.

3. In modern digital communications, Gray codes play an important role in error correction.

4. Binary Reflected Gray Code (BRGC). Ex: 000, 001, 011, 010, 110, 111, 101, 100.
BRGC codes are also a Gray code (Proof is part of Discrete Mathematics theory).
BRGC (Gray codes) finds their applications in range encoding, graph theory, and so
on.

5. K-Maps uses gray codes (will be elaborated in Unit-2)


Binary Arithmetic

• Single Bit Addition with Carry


• Multiple Bit Addition
• Single Bit Subtraction with Borrow
• Multiple Bit Subtraction
• Multiplication
• BCD Addition
Binary Addition

• Binary addition is very simple.


• This is best shown in an example of adding two binary
numbers…

1 1 1 1 1 1 carries
carries

1 1 1 1 0 1
+ 1 0 1 1 1
------------------
1 0 1 0 1 0 0
Binary Subtraction

• We can also perform subtraction (with borrows in place of carries).


• Let’s subtract (10111)2 from (1001101)2…

1 10
0 10 10 0 0 10 borrows

1 0
0 1 1 0 1
- 1 0 1 1 1
------------------------
1 1 0 1 1 0
Binary Multiplication

• Binary multiplication is much the same as decimal multiplication,


except that the multiplication operations are much simpler…

1
0 1 1 1
X 1 0 1 0
-----------------------
0 0 0 0 0
1 0 1 1 1
0 0 0 0 0
1 0 1 1 1
-----------------------
1 1 1 0 0 1 1 0
Code-Word: Information-bits + redundant bits
together is referred to as a code-
word.

The following information “1000001” has to be


transmitted from one place to another via a
transmission medium such as twisted-pair. Due
to some transmission parameters such as white-
noise or EMI interference, the data may get
corrupted. Data corruption mean one or more
bits in message transmitted by the sender may
arrive in a different manner/form at the receiver.
For eg., the receiver might have received
“1100001” instead of “1000001”. So
transmitting code-words instead of naïve
information is the solution.
Parity Codes
• Parity codes are formed by concatenating a parity bit, P to
each code word of C.
• In an odd-parity code, the parity bit is specified so that the
total number of ones is odd.
• In an even-parity code, the parity bit is specified so that the
total number of ones is even.

P Information Bits

11000011
01000011
 
1Added
1 0 0 0 even
0 1 1 parity bit 0 1 Added
0 0 0 0odd
1 1 parity bit
 
Added even parity bit Added odd parity bit
ASCII Code
• American Standard Code for Information Interchange
• ASCII is a 7-bit code, frequently used with an 8th bit for error detection.
• A – Z (26 codes), a – z (26 codes), 0-9 (10 codes), others (@#$%^&*….)

Character ASCII (bin) ASCII (hex) Decimal Octal


A 1000001 41 65 101
B 1000010 42 66 102
C 1000011 43 67 103

Z 1011010 5A 90 132
a 1100001 61 97 141

1 0110001 31 49 061
; 0111011 3B 59 073
Signed Numbers
• Plus and minus sign used for decimal numbers: 25 (or +25), -16, etc.
• For computers, desirable to represent everything as bits.
• Three types of signed binary number representations: signed magnitude,
1’s complement, 2’s complement.
• In each case: left-most bit indicates sign: positive (0) or negative (1).

000011002 = 1210 100011002 = -1210

Sign bit Magnitude Sign bit Magnitude

Signed Magnitude Representation


Signed Magnitude Representation
• MSB is used as sign bit. Remaining bits barring MSB will represent the
magnitude
• Range: −2𝑛−1 − 1 … . . 0 … … + 2𝑛−1 − 1 (n is the number of bits)
• Issue: +0 (0000) and -0 (1000) binary representations are different
• Number Representation for 4-bit system: 0 (0000), 1 (0001), 2 (0010), 3
(0011), 4 (0100), 5 (0101), 6 (0110), 7 (0111), -0 (1000), -1 (1001), -2
(1010), -3, -4, -5, -6, -7 (give the binary rep. for the leftover neg. no.)

000011002 = 1210 100011002 = -1210

Sign bit Magnitude Sign bit Magnitude

Signed Magnitude Representation


1’s Complement
• The one’s complement of a binary number involves inverting all bits (individually).
•1’s comp of 00110011 is 11001100
•1’s comp of 10101010 is 01010101
• For an n bit number ‘N’, the 1’s complement is (2n-1) – N.
• Called diminished radix complement since 1’s complement for base (radix 2).
• To find negative of a number, take the 1’s complement of that number (provided if
we are using 1’s complement number system).

000011002 = 1210 111100112 = -1210

Sign bit Magnitude Sign bit Magnitude


1’s Complement
• Range: −2𝑛−1 − 1 … … .0 … … + 2𝑛−1 − 1 (n is the number of bits)
• Issue: +0 (0000) and -0 (1000) binary representations are different
• Number Representation for 4-bit system: 0 (0000), 1 (0001), 2 (0010), 3
(0011), 4 (0100), 5 (0101), 6 (0110), 7 (0111), -0 (1111), -1 (1110), -2
(1101), -3, -4, -5, -6, -7 (give the binary rep. for the leftover neg. no.)
2’s Complement
• The two’s complement of a binary number involves inverting all bits and
adding 1 at the LSB position.
• 2’s comp of 00110011 is 11001101
• 2’s comp of 10101010 is 01010110
• For an n bit number N the 2’s complement is (2n-1) – N + 1.
• Called radix complement since 2’s complement for base (radix 2).
• To find negative of a number, take the 2’s complement (provided if we
are using 1’s complement number system)..
2’s Complement
• Range: −2𝑛−1 … … 0 … … + 2𝑛−1 − 1 (n is the number of bits)
• Adv: +0 (0000) and -0 (0000) has the same representation.
• Number Representation for 4-bit system: 0 (0000), 1 (0001), 2 (0010), 3
(0011), 4 (0100), 5 (0101), 6 (0110), 7 (0111), -0 (0000), -1 (1111), -2
(1110), -3, -4, -5, -6, -7, -8 (give the binary rep. for the leftover neg. no.)

000011002 = 1210 111101002 = -1210

Sign bit Magnitude Sign bit Magnitude


2’s Complement Shortcuts
• Algorithm 1 – Simply complement each bit and then add 1 to the result.
Finding the 2’s complement of (01100101)2 and of its 2’s complement…
N = 01100101 [N] = 10011011
10011010 01100100
+ 1 + 1
--------------- ---------------
10011011 01100101
• Algorithm 2 – Starting with the least significant bit, copy all of the bits
up to and including the first 1 bit and then complementing the remaining
bits.
N=01100101 N = 00110000
[N] = 1 0 0 1 1 0 1 1 N = 11010000
Signed, 1’s and 2’s Complement – 4-bit System

Number-Decimal Signed Magnitude 1’s Complement 2’s Complement


-8 1000
-7 1111 1000 1001
-6 1110 1001 1010
-5 1101 1010 1011
-4 1100 1011 1100
-3 1011 1100 1101
-2 1010 1101 1110
-1 1001 1110 1111
0 (-0) 00000 (1000) 0000 (1111) 0000
+1 0001 0001 0001
+2 0010 0010 0010
+3 0011 0011 0011
+4 0100 0100 0100
+5 0101 0101 0101
+6 0110 0110 0110
+7 0111 0111 0111
ARITHMETIC: 1’s Complement

Addition:
• Using 1’s complement numbers, adding numbers is easy.
• For example, suppose we wish to add +(1100)2 and +(0001)2.
• Let’s compute (12)10 + (1)10.
(12)10 = +(1100)2 = 011002 in 1’s comp.
(1)10 = +(0001)2 = 000012 in 1’s comp.
0 1 1 0 0
Step 1: Add binary numbers + 0 0 0 01
Step 2: Add carry to low-order bit --------------
0 0 1 1 0 1
Add carry 0
--------------
Final 0 1 1 0 1
Result
ARITHMETIC: 1’s Complement

Subtraction:
• Using 1’s complement numbers, subtracting numbers is also easy.
• For example, suppose we wish to subtract +(0001)2 from +(1100)2.
• Let’s compute (12)10 - (1)10.
• (12)10 = +(1100)2 = 011002 in 1’s comp.
0 1 1 0 0
• (-1)10 = -(0001)2 = 111102 in 1’s comp. - 0 0 0 0 1
--------------

Step 1: Take 1’s complement of 2nd operand 1’s comp


Add
Step 2: Add binary numbers 0 1 1 0 0
+ 1 1 1 1 0
Step 3: Add carry to low order bit --------------
Add carry
1 0 1 0 1 0
1
Final --------------
Result 0 1 0 1 1
ARITHMETIC: 2’s Complement

Addition:
• Using 2’s complement numbers, adding numbers is easy.
• For example, suppose we wish to add +(1100)2 and +(0001)2.
• Let’s compute (12)10 + (1)10.
• (12)10 = +(1100)2 = 011002 in 2’s comp.

• (1)10 = +(0001)2 = 000012 in 2’s comp.

0 1 1 0 0
Step 1: Add binary numbers
Add + 0 0 0 0 1
Step 2: Ignore carry bit
----------------
Final
Result 0 1 1 0 1

Ignore
ARITHMETIC: 2’s Complement
Subtraction:
• For example, suppose we wish to subtract +(0001)2 from +(1100)2.
• Let’s compute (12)10 - (1)10.
(12)10 = +(1100)2 = 011002 in 2’s comp.
(-1)10 = - (0001)2 = 111112 in 2’s comp.

Step 1: Take 2’s complement of 2nd operand 0 1 1 0 0


Step 2: Add binary numbers - 0 0 0 0 1
Step 3: Ignore carry bit -----------------------
2’s comp
Question-1: What difference did you observe 0 1 1 0 0
between 1’s comp. and 2’s comp. Add + 1 1 1 1 1
arithmetic.? -------------------------
Question-2: Which should/can be preferred.? Final 1 01011
Result

Ignore
ARITHMETIC: 2’s Complement
Subtraction:

Example-2:
• Let’s compute (13)10 – (5)10.
(13)10 = +(1101)2 = (01101)2
(-5)10 = -(0101)2 = (11011)2
• Adding these two 5-bit codes…
01101
carry + 11011
--------------
1 01000
• Discarding the carry bit, the sign bit is seen to be zero, indicating a correct
result. Indeed, (01000)2 = +(1000)2 = +(8)10.
ARITHMETIC: 2’s Complement
Subtraction:

Example-3:
• Let’s compute (5)10 – (12)10.
(-12)10 = -(1100)2 = (10100)2
(5)10 = +(0101)2 = (00101)2
• Adding these two 5-bit codes…
00101
+ 10100
--------------
11001
• Here, there is no carry bit and the sign bit is 1. This indicates a negative result,
which is what we expect. (11001)2 = -(7)10.
Digital Circuits
Digital Circuits
• Digital Circuits and Digital Systems operate on digital data.
• It is important to understand the difference between analog and digital
data (refer to the image below).
• Digital systems/circuits usually operate on digital data which is in the
binary form.
Digital Circuits
Why Binary System.?
• If we use decimal number system for building digital systems,
then we need to generate, manipulate, and store 10 different logic
levels. This will make the system design more complex.
• It is relatively easier to build circuits which can handle only 2
logic levels
• Therefore binary number systems are used in the designing of
digital systems
• It is good to recall your ASCII encoding once.
Digital Circuits
• The major components and the basic building block of any given digital circuit
are logic gates.
Ex: AND, OR, NOT, NAND, etc
• These circuits operate only on two states: 1. High (+5V) and 2. Low (0V).
They take inputs in these two states, and process them again in these two states
and finally provide the output in these two states alone.
• They consume less power compared to the analog circuits
• Digital circuits cannot interact with the real-world data directly.
• Real world data exists only in analog form
• Need to be converted into digital form before given as an input to the
digital system or circuit for processing.
• Note, analog circuits will work based on the analog inputs directly
• Examples of converters: ADC, DAC, etc.
Digital Circuits
• Digital circuits compared to their analog counterparts, less sensitive to the
changes in the input.
Ex: refer to the image below

• Digital circuits are also more immune to noise than their analog counterparts.
Digital Circuits
Accuracy: They are more accurate than analog circuits
Triggering: Digital circuits rely on clock signal for synchronization purposes
Applications:

Analog Circuits Digital Circuits


Data Communication, Radio Stations, Computers, Calculators, Microcontrollers
Power Transmission etc. etc.
Digital Circuits- Logic Gates
Name Symbol Function Truth Table
A B X
A X=A•B 0 0 0
AND X or 0 1 0
1 0 0
B X = AB 1 1 1
A B X
A 0 0 0
OR X X=A+B 0 1 1
1 0 1
B 1 1 1
A X
I 0 1
A X X = A’ 1 0
A X
0 0
Buffer A X X=A 1 1
A B X
A 0 0 1
NAND 0 1 1
X X = (AB)’ 1 0 1
B 1 1 0
A B X
A 0 0 1
NOR X X = (A + B)’ 0
1
1
0
0
0
B 1 1 0
A B X
A X=AB
XOR X or
0
0
0
1
0
1
Exclusive OR 1 0 1
B X = A’B + AB’
1 1 0
A B X
A X = (A  B)’
XNOR X or
0
0
0
1
1
0
Exclusive NOR
B X = A’B’+ AB 1 0 0
or Equivalence 1 1 1
Thank You

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy