Professional Documents
Culture Documents
To Verilog - II: Digital Design
To Verilog - II: Digital Design
to
Verilog - II
Digital Design
Example
// Assume a = 5 and b = 3 before the clock
always@(posedge clk)
begin
a = b;
b = a;
end
Example
// Assume a = 5 and b = 3 before the clock
always@(posedge clk)
begin
a <= b;
b <= a;
end
Flip Flops
D Flip Flop
JK Flip Flop
T Flip Flop
Counters
Binary Counter (4 bit)
Ring Counter (4 bit)
Moore
State Machine
Mealy
State Machine
Inputs
Next State
Logic
State Register
Output
Logic
Outputs
Inputs
Next State
Logic
Output
Logic
State Register
Outputs
FSM Example
Consider the case of a circuit to detect a pair of 1's or 0's
in the single bit input.
That is, input will be a series of one's and zero's.
If two one's or two zero's comes one after another, output
should go high. Otherwise output should be low.
Overlapping pair is not considered
S0/0
1
1
S1/0
S2/0
S3/1
1
Reset
00/0
01/0
10/0
11/1
S0
1/0
0/0
S1
0/0
1/0
0/1
S2
1/1
00
1/0
0/0
01
0/0
1/0
0/1
10