VHDL - 00 - Basics of Digital Design
VHDL - 00 - Basics of Digital Design
Basics of Digital Design (Combinational Elements) AND, OR NOT BOOLEAN algebra (Synchronous Elements) Latches Examples of how timing works Clocks Synchronous Latch Design (Flip-Flop) Positive, Edge, and Level Triggers (schematic representation) Timing Diagrams for Flip-Flops Introduction to Setup/Hold Concepts Discrete & TTL Components AND, OR, NOT, and Flop
True has the value of 1 or +5 Volts False has the value of 0 or +0 Volts Using transistors we can create a component that performs the AND operation using voltage to represent the logical values. An AND gate is represented in schematic form as seen below:
A B
Transistor Analogy
+5V
C = A & B
AND Logical Operator/Gate
A T T F F (1) (1) (0) (0) B T F T F (1) (0) (1) (0) C T F F F = A & B (1) (0) (0) (0)
+
Switch Analogy
0 1 0 1 Lamp (out)
10K A
10K B out
On = 1 Off = 0 10K
True has the value of 1 or +5 Volts False has the value of 0 or +0 Volts Using transistors we can create a component that performs the OR operation using voltage to represent the logical values. An OR gate is represented in schematic form as seen below: Transistor Analogy A + B
A B
C
10K
+5V
OR Logical Operator/Gate
A T (1) T (1) F (0) F (0) B T (1) F (0) T (1) F (0) C = A + B T (1) T (1) T (1) F (0)
+
Switch Analogy
0 0 1 1 Lamp (out)
On = 1 Off = 0
3
Analogies taken from P. Scherz
+5V
X T (1) F (0)
Y = X F (0) T (1)
10K out
Note: All digital computers are built using ONLY these three gate types: AND, OR, and Inverter. We will show some examples of how more complex gates can be constructed 4 using only these three gates.
C = A & B
C = A + B
C = A & B
C = A & B F (0) T (1) T (1) T (1)
C = A + B
C = A + B F (0) F (0) F (0) T (1)
5
XOR Gate = AB + AB
A
Y = A + B = AB + AB
T T F F
a a b a b
ab a b
ab
a+b
7
NOT
AND
OR
S F F T T
R F T F T
S F F T T
R F T F T
10
X 1
Q
0 0
Write (Store 1)
11
Time
Clock Period
Clocks electrical signals that follow a high/low pattern at some fixed period or frequency. Some examples of electronic components that can generate clocks are crystal oscillators and phase locked loops. Clocks are used to make a design synchronous. In digital design we primarily deal with Synchronous Latches as inputs and outputs to 12 combinational logic (more on this later).
To make the latch work synchronously (SET or RESET is only evaluated during the rising edge of the clock), we add NAND gates to the inputs S and R.
Q
Synchronous RS Latch`
13
D CLK D Q
S CLK R
Synchronous RS Latch`
14
There are three variations of flip-flop latch timing available: Level Triggered: Flip can only change state when the clock input is at a specific logic level. Positive-Edge Triggered: Flip flop changes state on the rising (leading) edge of the clock. Negative-Edge Triggered: Flip flop changes state on the falling (trailing) edge of the clock.
CLK
CLK
CLK
Level Triggered
Positive Edge-Triggered
Negative Edge-Triggered
15
Note: For the majority of this course (and in most digital designs in the real world) we will be using Positive-Edge Triggered DFFs.
Synchronous RS Latch`
Synchronous RS Latch`
Synchronous RS Latch`
TH
TSU Setup Time This is the period of time BEFORE the clock
transition that the input signal must remain stable at in order to be flopped correctly. TH Hold Time This is the period of time AFTER the clock transition that the input signal must remain stable at in order to be flopped correctly.
Setup Period
CLK D TSU
Hold Period
TH
19
Clk
T 20
INPUT S
OUTPU TS
DFF
CLK Q
DFF
CLK Q
21
Quad 2-input OR
GND
GND
GND
wire C0, C1, C2, C3; assign assign assign assign C0 C1 C2 C3 = = = = (A0 (A1 (A2 (A3 & & & & B0); B1); B2); B3);
HEX Inverter
VCC
GND
endmodule // SN74LS00
22
entity edge_detect is port( CLK : RESET_B : IN LONG_SIG : IN SHORT_SIG : OUT end entity edge_detect;