Академический Документы
Профессиональный Документы
Культура Документы
D Q D Q Positive
Positive D Q D Q
Latch Register
Clk Clk
Latches are used to build Registers (using the Master-Slave Configuration), but
are almost NEVER used by itself in a standard digital design flow.
Quite often, latches are inserted in the design by mistake (e.g., an error in your
Verilog code). Make sure you understand the difference between the two.
Several types of memory elements (SR, JK, T, D). We will most commonly use
the D-Register, though you should understand how the different types are built
and their functionality.
In
D Q
Combinational D Q
Logic
Clk Clk
CLK
Th Th
IN
Tsu Tsu
Tcq Tcq
FF1
Tlogic
Tcq,cd Tcq,cd
CLout
Tl,cd Tsu
a 1 a 1
out D Q out
b 0 b 0
tc-q
Clear on Clock Edge
DFF with Asynchronous Clear
Flip-Flop Based q1 q2
in D Q D Q D Q out
Digital Delay
Line
clk
“At each rising clock edge, q1, q2, and out “At each rising clock edge, q1 = in.
simultaneously receive the old values of in, After that, q2 = q1 = in.
q1, and q2.” After that, out = q2 = q1 = in.
Therefore out = in.”
q1 q2 q1 q2
in D Q D Q D Q out in D Q out
clk clk
Non-blocking Simulation
Blocking Simulation
Count [3]
Count [2]
Count [1]
Count [0]
Clock
endmodule
C3 C2 C1 N3 N2 N1 C3 C3
0 0 0 0 0 1 N1 1 1 1 1 N2 0 1 1 0
0 0 1 0 1 0
C1 0 0 0 0
C1 1 0 0 1
0 1 0 0 1 1
0 1 1 1 0 0 C2 C2
C3
1 0 0 1 0 1 N3 0 0 1 1
1 0 1 1 1 0
1 1 0 1 1 1 C1 0 1 0 1
1 1 1 0 0 0 C2
C1 C2 C3
N1 := C1 D Q D Q D Q
N2 := C1 C2 + C1 C2 CLK
:= C1 xor C2
N3 := C1 C2 C3 + C1 C3 + C2 C3
:= C1 C2 C3 + (C1 + C2 ) C3
:= (C1 C2) xor C3
From [Katz93], See Chapter 7 for different counters
L5: 6.111 Spring 2004 Introductory Digital Systems Laboratory 15
The 74163 Catalog Counter
74163 Synchronous
4-Bit Upcounter
Synchronous CLR and LOAD
If CLRb = 0 then Q <= 0
Else if LOADb=0 then Q <= D
Else if P * T = 1 then Q <= Q + 1
Else Q <= Q
0 0
0 1
0 0
0 1
0 DA DA
0 DB DB
0 DC DC
0 DD
DD
0
1 1
0 0
1 1 1
1
0 0
0 QA NA
0 0
QB NB
0
0 0
QC NC
0
0 0
QD ND
0 1
assign count = Q;
RCO gated
assign RCO = Q[3] & Q[2] & Q[1] & Q[0] & T;
by T input
endmodule
Any time multiple bits change, the counter output needs time to
settle.
Even though all flip-flops share the same clock, individual bits
will change at different times.
Clock skew, propagation time variations
Can cause glitches in combinational logic driven by the counter
The RCO can also have a glitch.
T QA QB QC QD T QA QB QC QD T QA QB QC QD
VDD
CLK
VDD
CLK
Problem at 8’b11110000: one of the RCOs is now stuck high for 16 cycles!
VDD 0 0 0 0
0 0 0 0 1 1 1 1
T QA QB QC QD T QA QB QC QD T QA QB QC QD
1
0
P ‘163 RCO P ‘163 RCO P ‘163 RCO
CL LD DA DB DC DD CL LD DA DB DC DD CL LD DA DB DC DD
VDD
CLK
Master enable
P QA QB QC QD P QA QB QC QD
T RCO T RCO
CL LD DA DB DC DD CL LD DA DB DC DD
assign RCO = Q[3] & Q[2] & Q[1] & Q[0] & T;