Cadd Unit1
Cadd Unit1
1
COMPUTER AIDED DIGITAL DESIGN
Course Flow
2
COMPUTER AIDED DIGITAL DESIGN
Course - Text Book
“Digital Design and Computer Architecture”, David Money Harris and Sarah L
Harris, Elsevier, 2nd Edition, 2019.
3
COMPUTER AIDED DIGITAL DESIGN
EDA Tools that can be used for the Course
Xilinx Tool
FPGA Boards
Software
Hardware
Basys 3 FPGA Board
Arty 35T FPGA Board
Arty 100T FPGA Board
4
Computer Aided Digital Design
Unit 1 : Number System
Vinay Reddy
Department of Electronics & Communication Engineering
5
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Number System
The next level of abstraction is analog circuits, in which devices are assembled to
create components such as amplifiers. Analog circuits input and output a
continuous range of voltages.
Digital circuits such as logic gates restrict the voltages to discrete ranges, which
we will use to indicate 0 and 1.
6
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Number System
Finally, the application software uses these facilities provided by the operating system
to solve a problem for the user.
7
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Number System
Topic 2 : Number System
Decimal Numbers
Decimal digits : 0, 1, 2, …, 9.
8
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Number System
Topic 2 : Number System
Binary Numbers
Bits represent one of two values, 0 or 1, and are joined together to form binary numbers.
9
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Number System
Topic 2 : Number System
10
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Number System
Topic 2 : Number System
11
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Number System
Topic 2 : Number System
12
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Number System
Topic 2 : Number System
84 ÷ 2 = 42 with 0 remainder
42 ÷ 2 = 21 with 0 remainder
21 ÷ 2 = 10 with 1 remainder
10 ÷ 2 = 5 with 0 remainder
5 ÷ 2 = 2 with 1 remainder
2 ÷ 2 = 1 with 0 remainder
1 ÷ 2 = 0 with 1 remainder
Then, when we put the remainders together in reverse order, we get the answer. The decimal number 84 converted to
binary is therefore:
1010100 13
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Number System
Topic 2 : Number System
14
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Number System & Logic Gates
Topic 2 : Number System
Hexadecimal Numbers
Hexadecimal numbers use the digits 0 to 9 along
with the letters A to F
15
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Number System
Topic 2 : Number System
Hexadecimal Numbers
HEXADECIMAL TO BINARY AND DECIMAL CONVERSION
Conversion between hexadecimal and binary is easy because each hexadecimal digit directly corresponds to four binary digits.
16
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Number System
Topic 2 : Number System
Hexadecimal Numbers
17
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Number System
Topic 2 : Number System
Hexadecimal Numbers
Using the above steps, here is the work involved in the solution for converting 333 to hexadecimal
number:
333 / 16 = 20 with remainder 13 (D)
20 / 16 = 1 with remainder 4
1 / 16 = 0 with remainder 1
Then just write down the remainders in the reverse order to get the answer, The decimal number
333 converted to hexadecimal is therefore equal to :
14D
18
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Number System
Topic 2 : Number System
19
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Number System
Topic 2 : Number System
Bytes, Nibbles
A group of eight bits is called a byte.
Within a group of bits, the bit in the 1’s column is called the least significant bit (lsb), and the bit at the other end is called
the most significant bit (msb).
20
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Number System
Topic 2 : Number System
1024 bytes is called a kilobyte (KB). 1024 bits is called a kilobit (Kb or Kbit).
Similarly, MB, Mb, GB, and Gb are used for millions and billions of bytes and bits.
21
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Number System
Topic 2 : Number System
Binary Addition
0+0=0
1+0=1
0+1=1
1 + 1 = 10 (0 with a carry 1)
22
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Number System
Topic 2 : Number System
23
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Number System
Topic 2 : Number System
An N-bit sign/magnitude number uses the most significant bit as the sign and the remaining N−1 bits as the
magnitude (absolute value).
Unfortunately, ordinary binary addition does not work for sign/ magnitude numbers
24
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Number System
Topic 2 : Number System
Two’s complement numbers are identical to unsigned binary numbers except that the most significant bit position
has a weight of −2^(N-1) instead of 2^(N−1) -1.
The process consists of inverting all of the bits in the number, then adding 1 to the least
significant bit position.
25
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Number System
Topic 2 : Number System
26
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Number System
Topic 2 : Number System
27
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Number System
Topic 2 : Number System
28
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Number System
Topic 2 : Number System
29
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Number System
Topic 2 : Number System
30
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Number System
Topic 2 : Number System
sign extension
When a two’s complement number is extended to more bits, the sign bit must be copied into the most
significant bit positions.
This process is called sign extension. For example, the numbers 3 and −3 are written as 4-bit two’s
complement numbers 0011 and 1101, respectively.
They are sign-extended to seven bits by copying the sign bit into the three new upper bits to form
0000011 and 1111101, respectively.
31
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Number System
Topic 2 : Number System
32
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Number System
Topic 2 : Number System
33
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Number System
Topic 2 : Number System
34
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Number System & Logic Gates
Topic 2 : Number System
35
Computer Aided Digital Design
Unit 1 : Combinational Logic Design
Vinay Reddy
Department of Electronics & Communication Engineering
1
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 1 : Introduction
Peering inside the black box, circuits are composed of nodes and elements
Digital circuits
4
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 1 : Introduction
CL – Combinational Logic
Combinational logic circuit
Two OR implementations
▶ The symbol CL inside the box indicates that it is implemented using only
combinational logic.
▶ In this example, the function F is specified to be OR: Y = F(A, B) = A + B.
▶ In words, we say the output Y is a function of the two inputs, A and B,
namely Y = A OR B.
5
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 1 : Introduction
Combinational Composition
7
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 1 : Introduction
Which of the circuits in Figure are combinational circuits according to the rules of
combinational composition?
8
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 1 : Introduction
Which of the circuits in Figure are combinational circuits according to the rules of
combinational composition?
Multilevel combinational circuits may use less hardware than their two-level counterparts.
Three-input XOR: (a) functional specification and (b) two-level logic implementation
10
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 2 : Multilevel Combinational Logic
Similarly, an eight-input XOR would require 128 eight-input AND gates and one 128-input
OR gate for a two-level sum-of-products implementation.
Bubble pushing is a helpful way to redraw these circuits so that the bubbles
cancel out and the function can be more easily determined.
▶ Begin at the output of the circuit and work toward the inputs.
▶ Push any bubbles on the final output back toward the inputs so that you can read an
equation in terms of the output (for example, Y) instead of the complement of the output (~Y).
▶ Working backward, draw each gate in a form so that bubbles cancel. If the current gate has
an input bubble, draw the preceding gate with an output bubble. If the current gate does not
have an input bubble, draw the preceding gate without an output bubble. 13
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 2 : Multilevel Combinational Logic Bubble Pushing
▶ Push any bubbles on the final output back toward the inputs.
13
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 2 : Multilevel Combinational Logic Bubble Pushing
14
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 2 : Multilevel Combinational Logic Bubble Pushing
BUBBLE PUSHING FOR CMOS LOGIC
Boolean algebra is limited to 0’s and 1’s. However, real circuits can also have illegal and floating values,
represented symbolically by X and Z.
▶ This commonly happens if it is being driven to both 0 and 1 at the same time.
Illegal Value: X
▶ Digital designers also use the symbol X to indicate “don’t care” values in truth
18
tables.
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 3 : X’S AND Z’S
▶ When X appears in a truth table, it indicates that the value of the variable in
the truth table is unimportant (can be either 0 or 1).
▶ When X appears in a circuit, it means that the circuit node has an unknown
or illegal value.
18
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 3 : X’S AND Z’S
Floating Value: Z
▶ The symbol Z indicates that a node is being driven neither HIGH nor LOW.
▶ A floating node does not always mean there is an error in the circuit, so long as some other
circuit element does drive the node to a valid logic level when the value of the node is
19
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 3 : X’S AND Z’S
Floating Value: Z
▶ The tristate buffer, has three possible output states: HIGH (1),
LOW (0), and floating (Z).
20
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 3 : X’S AND Z’S
Floating Value: Z Tristate buffer with active low enable
21
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 3 : X’S AND Z’S
Floating Value: Z Tristate bus connecting multiple chips
▶ Tristate buffers are commonly used on busses that connect multiple chips.
For example, a microprocessor, a video controller, and an Ethernet controller might all
need to communicate with the memory system in a personal computer.
▶ Each chip can connect to a shared memory bus using tristate buffers.
▶ Only one chip at a time is allowed to assert its enable signal to drive a value onto
the bus.
▶ The other chips must produce floating outputs so that they do not cause
contention with the chip talking to the memory.
▶ Any chip can read the information from the shared bus at any time.
22
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 4 : KARNAUGH MAPS
Karnaugh maps (K-maps) are a graphical method for simplifying Boolean equations.
They were invented in 1953 by Maurice Karnaugh, a telecommunications engineer at Bell Labs.
23
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 4 : KARNAUGH MAPS
The top row of the K-map gives the four possible values for the A
and B inputs.
The left column gives the two possible values for the C input.
For example, the top left square corresponds to the first row in the
truth table and indicates that the output value Y = 1 when ABC =
000.
24
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 4 : KARNAUGH MAPS
You may have noticed that the A and B The top row of the K-map gives the four possible values for the A
combinations in the top row are in a peculiar
and B inputs.
order: 00, 01, 11, 10. This order is called a Gray
code.
The left column gives the two possible values for the C input.
For example, the top left square corresponds to the first row in the
truth table and indicates that the output value Y = 1 when ABC =
000.
25
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 4 : KARNAUGH MAPS
The top row of the K-map gives the four possible values for the A
and B inputs.
The left column gives the two possible values for the C input.
For example, the top left square corresponds to the first row in the
truth table and indicates that the output value Y = 1 when ABC =
000.
26
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 4 : KARNAUGH MAPS
The top row of the K-map gives the four possible values for the A
and B inputs.
The left column gives the two possible values for the C input.
For example, the top left square corresponds to the first row in the
truth table and indicates that the output value Y = 1 when ABC =
000.
27
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 4 : KARNAUGH MAPS
28
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 4 : KARNAUGH MAPS
▶ K-maps help us do this simplification graphically by circling 1’s in
K-map minimization adjacent squares.
▶ Variables whose true and complementary forms are both in the circle
are excluded from the implicant.
▶ In this case, the variable C has both its true form (1) and its
complementary form (0) in the circle, so we do not include it in the
implicant.
30
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 4 : KARNAUGH MAPS
Y
AB
C 00 01 11 10
Y
AB
C 00 01 11 10
A B C D Y Y
0 0 0 0 1 AB
0 0 0 1 0 CD 00 01 11 10
0 0 1 0 1
0 0 1 1 1 00
0 1 0 0 0
0 1 0 1 1
0 1 1 0 1 01
0 1 1 1 1
1 0 0 0 1
1 0 0 1 1 11
1 0 1 0 1
1 0 1 1 0
1 1 0 0 0 10
1 1 0 1 0
1 1 1 0 0
1 1 1 1 0
33
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 4 : KARNAUGH MAPS
A B C D Y Y
0 0 0 0 1 AB
0 0 0 1 0 CD 00 01 11 10
0 0 1 0 1
0 0 1 1 1 00 1 0 0 1
0 1 0 0 0
0 1 0 1 1
0 1 1 0 1 01 0 1 0 1
0 1 1 1 1
1 0 0 0 1
1 0 0 1 1 11 1 1 0 0
1 0 1 0 1
1 0 1 1 0
1 1 0 0 0 10 1 1 0 1
1 1 0 1 0
1 1 1 0 0
1 1 1 1 0
34
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 4 : KARNAUGH MAPS
A B C D Y Y
0 0 0 0 1 AB
0 0 0 1 0 CD 00 01 11 10
0 0 1 0 1
0 0 1 1 1 00 1 0 0 1
0 1 0 0 0
0 1 0 1 1
0 1 1 0 1 01 0 1 0 1
0 1 1 1 1
1 0 0 0 1
1 0 0 1 1 11 1 1 0 0
1 0 1 0 1
1 0 1 1 0
1 1 0 0 0 10 1 1 0 1
1 1 0 1 0
1 1 1 0 0
1 1 1 1 0 Y = AC + ABD + ABC + BD
35
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 4 : KARNAUGH MAPS
K-Maps with don’t cares
A B C D Y Y
0 0 0 0 1 AB
0 0 0 1 0 CD 00 01 11 10
0 0 1 0 1
0 0 1 1 1 00
0 1 0 0 0
0 1 0 1 X
0 1 1 0 1 01
0 1 1 1 1
1 0 0 0 1
1 0 0 1 1 11
1 0 1 0 X
1 0 1 1 X
1 1 0 0 X 10
1 1 0 1 X
1 1 1 0 X
1 1 1 1 X
36
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 4 : KARNAUGH MAPS
A B C D Y Y
0 0 0 0 1 AB
0 0 0 1 0 CD 00 01 11 10
0 0 1 0 1
0 0 1 1 1 00 1 0 X 1
0 1 0 0 0
0 1 0 1 X
0 1 1 0 1 01 0 X X 1
0 1 1 1 1
1 0 0 0 1
1 0 0 1 1 11 1 1 X X
1 0 1 0 X
1 0 1 1 X
1 1 0 0 X 10 1 1 X X
1 1 0 1 X
1 1 1 0 X
1 1 1 1 X
37
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 4 : KARNAUGH MAPS
A B C D Y Y
0 0 0 0 1 AB
0 0 0 1 0 CD 00 01 11 10
0 0 1 0 1
0 0 1 1 1 00 1 0 X 1
0 1 0 0 0
0 1 0 1 X
0 1 1 0 1 01 0 X X 1
0 1 1 1 1
1 0 0 0 1
1 0 0 1 1 11 1 1 X X
1 0 1 0 X
1 0 1 1 X
1 1 0 0 X 10 1 1 X X
1 1 0 1 X
1 1 1 0 X
1 1 1 1 X Y = A + BD + C
38
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 4 : KARNAUGH MAPS
39
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 4 : KARNAUGH MAPS
40
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 4 : KARNAUGH MAPS
41
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 4 : KARNAUGH MAPS
42
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 4 : KARNAUGH MAPS
43
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 4 : KARNAUGH MAPS
44
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 4 : KARNAUGH MAPS
45
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 4 : KARNAUGH MAPS SEVEN-SEGMENT DISPLAY DECODER
46
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 4 : KARNAUGH MAPS
47
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 4 : KARNAUGH MAPS
A prime implicant is a product term obtained by combining the maximum possible
number of adjacent squares in the map.
48
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 4 : KARNAUGH MAPS
49
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 5 : Combinational Building Blocks
Multiplexers
Multiplexers are among the most commonly used combinational circuits.
They choose an output from among several possible inputs based on the value of a select signal.
50
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 5 : Combinational Building Blocks
Multiplexers
2:1 Multiplexer
51
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 5 : Combinational Building Blocks
52
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 5 : Combinational Building Blocks 4:1 multiplexer implementations: (a) two-level logic,
(b) tristates, (c) hierarchical
4:1 multiplexer
53
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 5 : Combinational Building Blocks Multiplexer Logic
54
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 5 : Combinational Building Blocks
Multiplexer logic using variable inputs
55
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 5 : Combinational Building Blocks
56
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 5 : Combinational Building Blocks
57
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 5 : Combinational Building Blocks
58
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 5 : Combinational Building Blocks
59
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 5 : Combinational Building Blocks
60
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 5 : Combinational Building Blocks
61
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 5 : Combinational Building Blocks DECODER IMPLEMENTATION
A decoder has N inputs and 2^(N) outputs. It asserts exactly one of its outputs depending
on the input combination.
2:4 decoder
62
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 5 : Combinational Building Blocks
2:4 decoder implementation
63
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 5 : Combinational Building Blocks
64
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 5 : Combinational Building Blocks
65
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 5 : Combinational Building Blocks
An Encoder is a combinational circuit that performs the reverse operation of Decoder. It has maximum of
2n input lines and ‘n’ output lines. It will produce a binary code equivalent to the input, which is active
High. Therefore, the encoder encodes 2n input lines with ‘n’ bits.
66
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 5 : Combinational Building Blocks
Priority Encoder
•If at least one input of the encoder is ‘1’, then the code
available at outputs is a valid one. In this case, the output, V
will be equal to 1.
•If all the inputs of encoder are ‘0’, then the code available at
outputs is not a valid one. In this case, the output, V will be
equal to 0.
67
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 5 : Combinational Building Blocks
Priority Encoder
68
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 6 : TIMING
69
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 6 : Timing
Y=1
The propagation delay tpd is the maximum time from when an input
changes until the output or outputs reach their final value.
70
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 6 : Timing
Y=1
The contamination delay tcd is the minimum time from when an input
changes until any output starts to change its value.
71
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 6 : Timing
The time required to charge the capacitance in a circuit and the speed of light.
▶ multiple inputs and outputs, some of which are faster than others
72
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 6 : Timing
Short path and critical path
Along with the factors already listed, propagation and contamination delays are also determined by the path a signal takes from
input to output.
The critical path, shown in blue, is the path from input A or B to output Y. It is the
longest, and therefore the slowest.
This path is critical because it limits the speed at which the circuit operates.
The short path through the circuit, shown in gray, is from input D to output Y. This is
the shortest, and therefore the fastest, path through the circuit.
73
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 6 : Timing
Critical and short path waveforms
74
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 6 : Timing
The contamination delay is the sum of the contamination delays through each
element on the short path .
75
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 6 : Timing
76
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 6 : Timing
78
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 6 : Timing
79
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 6 : Timing
These circuits are control critical, because the critical path is from the
control signals to the output.
Any additional delay in the control signals will add directly to the worst-
case delay.
80
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 6 : Timing
These circuits are control critical, because the critical path is from the
control signals to the output.
Any additional delay in the control signals will add directly to the worst-
case delay.
81
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 6 : Timing
This circuit is data critical, because the critical path is from the data
input to the output: tpd = tpd_dy.
If data inputs arrive well before the control inputs, we would prefer the
design with the shortest control-to-output delay
Similarly, if the control inputs arrive well before the data inputs, we
would prefer the design with the shortest data-to-output delay (the
Hierarchical Design tristate design).
82
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 6 : Timing
Glitches
So far we have discussed the case where a single input transition causes a single output transition.
However, it is possible that a single input transition can cause multiple output transitions. These are called
glitches or hazards.
Case Study
83
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Combinational Logic Design
Topic 6 : Timing As long as we wait for the propagation delay to elapse before we depend on the output, glitches are
not a problem, because the output eventually settles to the right answer.
Glitches
Scenario The Boolean equation is correctly minimized, but let’s look at what happens when A = 0, C = 1,
and B transitions from 1 to 0.
If we choose to, we can avoid this glitch by adding another gate to the implementation.
Glitch-proof circuit
85
Computer Aided Digital Design
Unit 1 : Combinational Logic Design - HDL
Vinay Reddy
Department of Electronics & Communication Engineering
1
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Hardware Description Language
In the 1990s, designers discovered that they were far more productive if they worked at a higher
level of abstraction, specifying just the logical function and allowing a computer-aided
2
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Hardware Description Language
Topic 1 : HDL Introduction
Modules
▶ An AND gate, a multiplexer, and a priority circuit are all examples of hardware modules.
▶ The two general styles for describing module functionality are behavioral and structural.
▶ Structural models describe how a module is built from simpler pieces; it is an application of hierarchy.
3
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Hardware Description Language
Topic 1 : HDL Introduction
Language Origin
▶ Verilog was developed by Gateway Design Automation as a proprietary language for logic simulation in 1984.
▶ Gateway was acquired by Cadence in 1989 and Verilog was made an open standard in 1990 under the control of
Open Verilog International.
▶ These extensions have been merged into a single language standard, which is now called SystemVerilog (IEEE
STD 1800-2009).
▶ SystemVerilog file names normally end in .sv.
4
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Hardware Description Language
Topic 1 : HDL Introduction
▶ The two major purposes of HDLs are logic simulation and synthesis.
▶ During simulation, inputs are applied to a module, and the outputs are checked to verify
that the module operates correctly.
▶ During synthesis, the textual description of a module is transformed into logic gates.
5
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Hardware Description Language
Topic 1 : HDL Introduction
module sillyfunction (a, b, c, y);
Example 1 input logic a, b, c;
output logic y ;
module sillyfunction (input logic a, b, c, output logic y);
assign y = ~a & ~b & ~c | a & ~b & ~c | a & ~b & c;
assign y = ~a & ~b & ~c | a & ~b & ~c | a & ~b & c;
endmodule
endmodule
▶ A SystemVerilog module begins with the module name and a listing of the inputs
and outputs.
▶ The assign statement describes combinational logic. ~ indicates NOT, & indicates
AND, and | indicates OR.
▶ logic signals such as the inputs and outputs are Boolean variables (0 or 1).They
may also have floating and undefined values 92
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Hardware Description Language
Topic 1 : HDL Introduction
module sillyfunction (a, b, c, y);
Example 1 input logic a, b, c;
assign y = ~a & ~b & ~c | a & ~b & ~c | a & ~b & c; assign y = ~a & ~b & ~c | a & ~b & ~c | a & ~b & c;
endmodule endmodule
bc bc + ab
ab
Synthesized circuit
7
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Hardware Description Language
Topic 1 : HDL Introduction
module sillyfunction (a, b, c, y);
Example 1 input logic a, b, c;
assign y = ~a & ~b & ~c | a & ~b & ~c | a & ~b & c; assign y = ~a & ~b & ~c | a & ~b & ~c | a & ~b & c;
endmodule endmodule
bc bc + ab
ab
Synthesized circuit
8
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Hardware Description Language
Topic 1 : HDL Introduction
module sillyfunction (a, b, c, y);
Example 1 input logic a, b, c;
output logic y ;
module sillyfunction (input logic a, b, c, output logic y);
assign y = ~a & ~b & ~c | a & ~b & ~c | a & ~b & c;
assign y = ~a & ~b & ~c | a & ~b & ~c | a & ~b & c;
endmodule
endmodule
bc bc + ab
▶ The logic synthesizer might perform optimizations to reduce
the amount of hardware required.
10
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Hardware Description Language
Topic 1 : HDL Introduction
Simulation and Synthesis on Quartus
assign b = a;
initial
begin
b = 0;
$display ("the Value of b = %0d",b);
end
endmodule 97
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Hardware Description Language
Topic 1 : HDL Introduction
Simulation and Synthesis on Quartus
▶ Our primary interest is to build hardware, we will emphasize a synthesizable subset of the
languages.
▶ Specifically, we will divide HDL code into synthesizable modules and a testbench.
▶ The testbench contains code to apply inputs to a module, check whether the output
results are correct, and print discrepancies between expected and actual outputs.
module HA (a,b,sum,cout);
assign sum = a ^ b;
assign cout = a & b;
endmodule
13
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Hardware Description Language
Topic 2 : COMBINATIONAL LOGIC
Bitwise Operator
Bitwise operators act on single-bit signals or on multi-bit busses.
endmodule
a = 1101, y = 0010
14
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Hardware Description Language
Topic 2 : COMBINATIONAL LOGIC
Bitwise Operator
module gates(input logic [3:0] a, b, output logic [3:0] y1, y2, y3, y4, y5); /* five different two-input logic gates acting on 4-bit busses */
assign y1 = a & b; // AND
assign y2 = a | b; // OR
assign y3 = a ^ b; // XOR
assign y4 = ~(a & b); // NAND
assign y5 = ~(a | b); // NOR
endmodule
15
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Hardware Description Language
Topic 2 : COMBINATIONAL LOGIC
Reduction Operators
16
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Hardware Description Language
Topic 2 : COMBINATIONAL LOGIC
module mux2(input logic [3:0] d0, d1, input logic s, output logic [3:0] y);
assign y = s ? d1 : d0;
endmodule
17
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Hardware Description Language
Topic 2 : COMBINATIONAL LOGIC
module mux4 (input logic [3:0] d0, d1, d2, d3, input logic [1:0]
endmodule
18
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Hardware Description Language
Topic 2 : COMBINATIONAL LOGIC
Internal Variables
Often it is convenient to break a complex function into intermediate steps.
assign s = p ^ cin;
assign cout = g | (p & cin);
endmodule
19
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Hardware Description Language
Topic 2 : COMBINATIONAL LOGIC Precedence
Cout = G + (P · Cin)
Cout = (G + P) · Cin
20
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Hardware Description Language
Topic 2 : COMBINATIONAL LOGIC Numbers
Numbers can be specified in binary, octal, decimal, or hexadecimal (bases 2, 8, 10, and 16, respectively).
21
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Hardware Description Language
Topic 2 : COMBINATIONAL LOGIC Z’s and X’s
▶ HDLs use z to indicate a floating value, z is particularly useful for describing a tristate
buffer, whose output floats when the enable is 0.
▶ Similarly, HDLs use x to indicate an invalid logic level. If a bus is simultaneously driven to 0 and 1
by two enabled tristate buffers (or other gates), the result is x, indicating contention.
▶ At the start of simulation, state nodes such as flip-flop outputs are initialized to an unknown state.
22
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Hardware Description Language
Topic 2 : COMBINATIONAL LOGIC Z’s and X’s
module tristate(input logic [3:0] a, input logic en, output tri [3:0] y);
assign y = en ? a : 4’bz;
endmodule
23
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Hardware Description Language
Topic 2 : COMBINATIONAL LOGIC Z’s and X’s
If a gate receives a floating input, it may produce an x output when it can’t determine the correct
output value.
24
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Hardware Description Language
Topic 2 : COMBINATIONAL LOGIC Bit Swizzling
25
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Hardware Description Language
Topic 2 : COMBINATIONAL LOGIC Delays
▶ They are helpful during simulation to predict how fast a circuit will work (if you specify
meaningful delays) and also for debugging purposes to understand cause and effect (deducing the
source of a bad output is tricky if all signals change simultaneously in the simulation results).
▶ These delays are ignored during synthesis; the delay of a gate produced by the synthesizer
depends on its tpd and tcd specifications, not on numbers in HDL code.
26
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Hardware Description Language
Topic 2 : COMBINATIONAL LOGIC Delays
It assumes that inverters have a delay of 1 ns, three-input AND gates have a delay of 2
ns, and three-input OR gates have a delay of 4 ns.
‘timescale 1ns/1ps ▶ SystemVerilog files can include a timescale directive that
indicates the value of each time unit.
module example(input logic a, b, c, output logic y);
logic ab, bb, cb, n1, n2, n3; ▶ The statement is of the form 'timescale unit/precision.
assign #1 {ab, bb, cb} = ~{a, b, c};
assign #2 n1 = ab & bb & cb; ▶ In this file, each unit is 1 ns, and the simulation has 1 ps
assign #2 n2 = a & bb & cb; precision.
assign #2 n3 = a & bb & c;
assign #4 y = n1 | n2 | n3; ▶ If no timescale directive is given in the file, a default unit and
endmodule precision (usually 1 ns for both) are used. 113
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Hardware Description Language
Topic 2 : COMBINATIONAL LOGIC Delays
28
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Hardware Description Language
Topic 2 : COMBINATIONAL LOGIC STRUCTURAL MODELING
4 bit Ripple
Carry Adder
HA HA HA HA HA HA HA
HA
29
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Hardware Description Language
Topic 2 : COMBINATIONAL LOGIC STRUCTURAL MODELING – 4: 1 Mux
module mux4 (input logic [3:0] d0, d1, d2, d3, input logic [1:0] s, output logic [3:0] y);
logic [3:0] low, high;
mux2 lowmux (d0, d1, s[0], low);
mux2 highmux (d2, d3, s[0], high);
mux2 finalmux (low, high, s[1], y);
endmodule
module mux2 (input logic [3:0] d0, d1, input logic s, output tri [3:0] y);
tristate t0(d0, ~s, y);
tristate t1(d1, s, y);
endmodule
31
COMPUTER AIDED DIGITAL DESIGN
Unit 1: Hardware Description Language
Topic 2 : COMBINATIONAL LOGIC (a) UNSIGNED MULTIPLIER (b) SIGNED MULTIPLIER
32
COMPUTER AIDED DIGITAL DESIGN
Unit 1 : Hardware Description Language
Topic 2 : COMBINATIONAL LOGIC Data Types
33
THANK YOU
Vinay Reddy
Department of Electronics & Communication Engineering
[email protected]
+91 9945730244
34