Beruflich Dokumente
Kultur Dokumente
Kyle.Gilsdorf@asu.edu
Verilog Design
Lets assume that: 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
C = A & B
AND 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) F (0) F (0) F (0)
+
+5V
Switch Analogy
0 1
10K A
0
1
Lamp (out)
B On = 1 Off = 0
10K out
10K
Kyle.Gilsdorf@asu.edu
Verilog Design
Lets assume that: 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:
A
B
A + B C
Transistor Analogy
+5V
10K
OR Logical Operator/Gate
A T (1) B T (1) C = A + B T (1)
+
Switch Analogy
0 0 1
Lamp (out)
1
On = 1 Off = 0
T (1)
F (0) F (0)
Kyle.Gilsdorf@asu.edu
F (0)
T (1) F (0)
T (1)
T (1) F (0)
Verilog Design
X T (1) F (0)
Y = X F (0) T (1)
0
-
in
On = 1 Off = 0 in
Note: All digital computers are built using ONLY these three gate types: AND, OR, and NOT. We will show some examples of how more complex gates can be constructed using only these three gates.
Kyle.Gilsdorf@asu.edu 4
Verilog Design
A & B
C = A & B
C = A + B
A B
A T (1) T (1) F (0) B T (1) F (0) T (1)
C = A & B
C = A & B F (0) T (1) T (1)
C = A + B
C = A + B F (0) F (0) F (0) T (1)
5
F (0)
F (0)
T (1)
Kyle.Gilsdorf@asu.edu
Verilog Design
XOR Gate = AB + AB
A
Y = A B = AB + AB
+
B
T F T F (1) (0) (1) (0)
+ B C = A +
T T F F
F T T F
Kyle.Gilsdorf@asu.edu
Verilog Design
a
b
ab
a
b a
a+b
a a b
ab
ab
a
b
a
b
a+b
Verilog Design
NOT
AND
OR
Kyle.Gilsdorf@asu.edu
Verilog Design
A) Problem description
y is 1 if a is to 1, or b and c are 1. z is 1 if b or c is to 1, but not both, or if all are 1.
01 0 1
11 1 1
10 0 1
00 0 0 1 0
bc
01 1 1
11 0 1
10 1 1
B) Truth Table
a 0 0 0 0 1 1 1 1 Inputs b c 0 0 0 1 1 0 1 1 0 0 0 1 1 0 1 1 Outputs y z 0 0 0 1 0 1 1 0 1 0 1 1 1 1 1 1
y = a + bc
z = ab + bc + bc
E) Logic Gates
a b c y
C) Output equations
y = a'bc + ab'c' + ab'c + abc' + abc
Verilog Design
10
Verilog Design
Q
1
Write (Store 1)
Kyle.Gilsdorf@asu.edu
11
Verilog Design
Q
1
Write (Store 1)
Kyle.Gilsdorf@asu.edu
12
Verilog Design
R
0
X 1
Q
0
Write (Store 1)
Kyle.Gilsdorf@asu.edu
13
Verilog Design
R
0
X 1
X 1 1
Q
0 0
Write (Store 1)
Kyle.Gilsdorf@asu.edu
14
Verilog Design
Hi
Low
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 combinational logic (more on this later).
Kyle.Gilsdorf@asu.edu 15
Verilog Design
Synchronous RS Latch`
CLK
Q R
CLK S Q
Kyle.Gilsdorf@asu.edu
CLK
R Q
16
Verilog Design
D
CLK
D Q
S
CLK R
Synchronous RS Latch`
Kyle.Gilsdorf@asu.edu
17 17
Verilog Design
CLK
CLK
Level Triggered
Kyle.Gilsdorf@asu.edu
Negative Edge-Triggered
18
Verilog Design
D
QLEVEL
Q+EDGE
Q-EDGE
Note: For the majority of this course (and in most digital designs in the real world) we will be using Positive-Edge Triggered DFFs.
Kyle.Gilsdorf@asu.edu 19
Verilog Design
D CLK
D CLK
D CLK
Synchronous RS Latch`
Synchronous RS Latch`
Synchronous RS Latch`
Q Level Triggered
Q Positive Edge-Triggered
Q Negative Edge-Triggered
Kyle.Gilsdorf@asu.edu
20
Verilog Design
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.
Kyle.Gilsdorf@asu.edu 21
Verilog Design
Setup Period
Hold Period
CLK
D
Kyle.Gilsdorf@asu.edu
TSU
TH
22
Verilog Design
Clk
su
Kyle.Gilsdorf@asu.edu
23
Verilog Design
INPUTS
Logic Cloud
OUTPUTS
DFF
CLK
Kyle.Gilsdorf@asu.edu
DFF
Q CLK Q
24
Verilog Design
C0 C1 C2 C0
= = = =
endmodule
Verilog Design
14
SN74AC74
assign Q1_B <= ~Q1; assign Q2_B <= ~Q2; always@(posedge CLK1, if (~CLR1_B) else if (~PRE1_B) else always@(posedge CLK2, if (~CLR2_B) else if (~PRE2_B) else negedge CLR1_B) Q1 <= 1'b0; Q1 <= 1'b1; Q1 <= D1; negedge CLR2_B) Q2 <= 1'b0; Q2 <= 1'b1; Q2 <= D2;
Kyle.Gilsdorf@asu.edu
endmodule
26
Verilog Design
A0 B0 C0 A1 B1 C1 GND
SW1
SW2
SW3
SW4
Kyle.Gilsdorf@asu.edu
7 8
&
& &
LS7408N
&
14
14
VCC A2 B2 C2 A3 B3 C3
LED1
LED2
LED3
27
Verilog Design
module edge_detect (input wire CLK, input wire RESET_B, input wire LONG_SIG, output wire SHORT_SIG); ... ... endmodule
SW1 LED1
SW1
SW2
SW3
SW4
LED1
LED2
LED3
Kyle.Gilsdorf@asu.edu
28
Verilog Design
A0 B0 C0 A1 B1 C1 GND
7 8
&
& &
14
LS7408N
&
14 8
VCC A2 B2 C2 A3 B3 C3
Kyle.Gilsdorf@asu.edu
endmodule
29
Verilog Design
BACKUP
Kyle.Gilsdorf@asu.edu
30