You are on page 1of 63

# Digital Design

Digital system

Registers
Flip-flop
Counters
Microprocessors

## Advantage of Digital Systems

More accuracy
More versatility
Less distortion
Easy communicate
Possible storage of information
Number system:

## A value of each digit in a number can be determined using

The digit
The position of the digit in the number
The base of the number system

## (where base is defined as the total number of digits available in the

number system).
Decimal Number System
Base 10. Digits used: 0 to 9

## Binary Number System

Base 2. Digits used: 0, 1

## Octal Number System

Base 8. Digits used: 0 to 7

## Hexa Decimal Number System

Base 16. Digits used: 0 to 9, Letters used: A- F
Binary addition/Subtraction:
Binary Subtraction:
Binary codes for decimal digits:

## The digital data is represented, stored and transmitted as group of binary

bits. This group is also called as binary code.

## A binary code represents text or computer processor instructions using

the binary number system's two binary digits, 0 and 1

Advantages:

## Binary codes are suitable for the computer applications.

Binary codes are suitable for the digital communications.
Binary codes make the analysis and designing of digital circuits if
we use the binary codes.
Since only 0 & 1 are being used, implementation becomes easy
Binary codes examples

Weighted Codes
Non-Weighted Codes
Binary Coded Decimal Code
Weighted Codes

Weighted binary codes are those binary codes which obey the
positional weight principle

## In these codes each decimal digit is represented by a group of

four bits
Non-Weighted Codes:

## Excess-3 code Gray Code

As only one bit changes at a time, the gray code is called as a unit
distance code. The gray code is a cyclic code. Gray code cannot be
used for arithmetic operation
Binary to gray code conversion

## Gray code to binary conversion

Binary Coded Decimal (BCD) code
Each decimal digit is represented by a 4-bit binary number

## six code combinations i.e. 1010 to 1111 are invalid in BCD

Boolean Algebra Terminology:
Example equation: F(a,b,c) = abc + abc + ab + c
Variable
Represents a value (0 or 1)
Three variables: a, b, and c

Literal
Appearance of a variable, in true or complemented form
Nine literals: a, b, c, a, b, c, a, b, and c

Product term
Product of literals
Four product terms: abc, abc, ab, c

Sum-of-products
Equation written as OR of product terms only
Above equation is in sum-of-products form. F = (a+b)c + d is not
Boolean Algebra: Properties
Commutative Example uses of the properties
a+b=b+a
a*b=b*a Show abc + abc = ab.
Distributive Use first distributive property
a * (b + c) = a * b + a * c abc + abc = ab(c+c).
a + (b * c) = (a + b) * (a + c)
Complement property
(this one is tricky!)
Replace c+c by 1: ab(c+c) = ab(1).
Associative
Identity property
(a + b) + c = a + (b + c)
(a * b) * c = a * (b * c) ab(1) = ab*1 = ab.

Identity
0+a=a+0=a
1*a=a*1=a

Complement
a + a = 1
a * a = 0

## To prove, just evaluate all possibilities

Boolean Algebra: Additional Properties
Null elements
a+1=1 Circuit
a
a*0=0
S
b
Idempotent Law c
a+a=a
a*a=a

a S
(a) = a b
c

DeMorgans Law
(a + b) = ab
(ab) = a + b
Very useful!

## To prove, just evaluate all possibilities

Truth Table Representation of Boolean Functions
Define value of F for each possible
a b F a b c F a b c d F
0 0 0 0 0 0 0 0 0
combination of input values 0 1 0 0 1 0 0 0 1
1 0 0 1 0 0 0 1 0
2-input function: 4 rows 1 1 0 1 1 0 0 1 1
(a) 1 0 0 0 1 0 0
3-input function: 8 rows 1 0 1 0 1 0 1
1 1 0 0 1 1 0
4-input function: 16 rows 1 1 1 0 1 1 1
(b) 1 0 0 0
1 0 0 1
Q: Use truth table to define function 1 0 1 0
F(a,b,c) that is 1 when abc is 5 or a b c F
1
1
0
1
1
0
1
0
greater in binary 0
0
0
0
0
1
0
0
1 1 0 1
1 1 1 0
0 1 0 0
1 1 1 1
0 1 1 0
1 0 0 (c)
0
1 0 1 1
1 1 0 1
1 1 1 1
Standard Representation: Truth Table
How can we determine if two functions are the
same?
Used algebraic methods
Q: Determine if F=ab+a is same
But if we failed, does that prove not equal? No. function as F=ab+ab+ab, by converting
each to truth table first
Solution: Convert to truth tables
Only ONE truth table representation of a given F = ab + 'a F = ab +
ab + ab
function a b F a b F
Standard representation -- for given function, only 0 0 1 0 0 1
one version in standard form exists 0 1 1 0 1 1
1 0 0 1 0 0
1 1 1 1 1 1
Digital Design
Combinational Logic Circuits
Outputs are only determined by the logical function of their
current input state, logic 0 or logic 1, at any given instant in time.

## Sequential Logic Circuits

Outputs are dependant on both their present inputs and their
previous output state giving them some form of Memory
Logic Gates
Logic Gates
Logic Gates
Logic Gates
Logic Gates
C0MBINATIONAL CIRCUITS
Multiplexer
4:1 Multiplexer using 2:1

a b Y
0 0 D0
0 1 D1
1 0 D2
1 1 D3
De Multiplexer
Logic Gates implementation using muxes
Draw AND gate using 2:1 MUX ?

## Design NOT gate from NAND using 2:1 MUX?

Draw AND gate using 2:1 MUX ?
Draw OR gate using 2:1 MUX ?
Draw NAND gate using 2:1 MUX ?
Draw NOR gate using 2:1 MUX ?
Draw XOR gate using 2:1 MUX ?
Draw XNOR gate using 2:1 MUX ?
Arithmetic Circuits

Half adder:
Arithmetic Circuits

Full adder:
Arithmetic Circuits

Half subtractor:
Arithmetic Circuits

Full subtractor:
Arithmetic Circuits
Let the 4-bit words to be added be represented by A = 1011 and B = 0011

## Parallel Binary Adder

Decoder
3:8 decoder
3x8 decoder
General encoder
4:2 Binary encoder
Priority Encoder
A priority encoder is an encoder that includes the
priority function
If two or more inputs are equal to 1 at the same
time, the input having the highest priority will take
precedence.

## Truth Table of a 4-input Priority Encoder:

Inputs Outputs
D0 D1 D2 D3 x y V
0 0 0 0 X X 0
1 0 0 0 0 0 1
X 1 0 0 0 1 1
X X 1 0 1 0 1
X X X 1 1 1 1
Implementation of a full adder
with a decoder
Full adder with decoder
S(x, y, z) = (1, 2, 4, 7)
C(x, y, z) = (3, 5, 6, 7)
Full adder with decoder
S(x, y, z) = (1, 2, 4, 7)
C(x, y, z) = (3, 5, 6, 7)
Sequential Circuits
Asynchronous

Inputs Outputs
Combinational
Circuit
Memory
Elements

Synchronous

Inputs Outputs
Combinational
Circuit
Flip-flops
Clock
Flip Flop

## A basic sequential circuit is a flip-flop

Flip-flop has two stable states of complementary output values
SR Flip Flop

## SR (set-reset) flip-flop based on two nor gates

Clocked SR Flip Flop Circuit with Reset

## Some flip-flops have asynchronous

preset Pr and clear Cl signals.
Output changes once these signals change, however
the input signals must wait for a change in clock
to change the output
Clocked JK Flip Flop

## Then the JK flip-flop is basically an SR flip flop with feedback which

enables only one of its two input terminals, either SET or RESET to be
active at any one time thereby eliminating the invalid condition seen
previously in the SR flip flop circuit.
Other Flip Flop

T J D J
Q Q
f f f f
Q Q
K K

T Q D Q

f Q f Q

State Machines

Mealy Machine

Moore Machine
Mealy Machine:

## A Mealy Machine is an FSM whose output depends on the present

state as well as the present input.

Moore Machine:

## Moore machine is an FSM whose outputs depend on only the

present state.
Mealy Machine Moore Machine
Output depends both upon Output depends only upon
present state and present the present state.
input.
Generally, it has fewer Generally, it has more states
states than Moore Machine. than Mealy Machine.
Output changes at the Input change can cause
clock edges. change in output change
as soon as logic is done.
Mealy machines react In Moore machines, more
faster to inputs. logic is needed to decode
the outputs since it has
more circuit delays.
Melay sequence detector