Вы находитесь на странице: 1из 19

UNIT IV:

Modeling of Sequential
Circuits

CpE 425 Digital Systems Design 1


Unit Outline
● Commonly used sequential circuit constructs
● Sequential circuits in Verilog
● Comparison between combinational and sequential circuit
descriptions

CpE 425 Digital Systems Design 2


Latches, Flip-flops and Registers
● Use of same behavioral construct, but change in sensitivity
list.
● All sequential circuits must have clock signal.
● Latches and flip-flops differ in the clock sensitivity.
– Latches are level-sensitive (positive or negative level)
– Flip-flops are edge-sensitive (positive/rising or negative/falling
edge)
● If D and Q are more than 1 bit wide, they are usually called
registers and are edge-sensitive

CpE 425 Digital Systems Design 3


Positive-level D Latch

CpE 425 Digital Systems Design 4


Testbench for D Latch

CpE 425 Digital Systems Design 5


Results

CpE 425 Digital Systems Design 6


Positive-edged D Flip-flop
See the difference in the sensitivity
list

If negative-edged
triggered:

always @ (negedge Clk)

CpE 425 Digital Systems Design 7


Compare Waveforms
Positive-level triggered D Latch

Positive-edged triggered D Flip-flop

CpE 425 Digital Systems Design 8


Exercise
● Create the following flip-flop types:
– JK Flip-flop (use case statements)
– T Flip-flop (use if statements)

CpE 425 Digital Systems Design 9


Reset
● It is common practice to have a reset signal for easy
initialization.

● Reset signal is usually low-asserted (active-low) by


convention.

● Synthesis tools usually have strict format flip-flops.

● Two types: synchronous and asynchronous resets

CpE 425 Digital Systems Design 10


Synchronous vs. Asynchronous

See the difference in the sensitivity list

CpE 425 Digital Systems Design 11


Compare Waveforms
Synchronous (Active Low) Reset

Asynchronous (Active Low) Reset

CpE 425 Digital Systems Design 12


Enable
● Many circuits require a
flip-flop/register to hold a
value for more than a clock
cycle, controlled by an
enable signal.

● In Verilog,
incompletely-specified if-else
and case statements produce
a latch.

CpE 425 Digital Systems Design 13


Incorporating Logic

A 0
D Q Q
B 1 nReset

Sel

nReset Clk

CpE 425 Digital Systems Design 14


Blocking vs. Non-blocking
c D Q y
a x

Clk

c
D Q y
a
D Q
b x

Clk

CpE 425 Digital Systems Design 15


Combinational vs. Sequential
● Clearly identify which parts of your circuit are
combinational and which parts are sequential.

● For combinational circuits, always completely specify


conditional statements (to avoid inferring a latch).

CpE 425 Digital Systems Design 16


Combinational vs. Sequential

c
a y

b x

c D Q y
a x

Clk

CpE 425 Digital Systems Design 17


Exercise
1.) Write a description for an 2.) Write a description of a 4-bit
8-bit shift register that has a up counter named counter4.
serial input Sin and output Sout. The counter increments on a
It also has 8 parallel inputs, Din positive clock edge only if its
(7 downto 0). It is active low enable (nE) is
synchronously loaded from these asserted. If its cntby2 input is
inputs when its Load input is asserted (active high), the
asserted (active high). It also has counter increments by 2;
a synchronous active low reset otherwise, it increments by 1. If
input nReset. When its ShiftR the counter overflows, it
input is asserted (active high), it continues to count starting from
shifts its contents one position to 0000. The counter has an
the right at the next positive active-low asynchronous reset
edge at its Clk input. (nReset).

CpE 425 Digital Systems Design 18


References
● Introduction to HDL, USC-PIIC Workshop Manual
● M. Morris Mano and Michael D. Ciletti, “Digital Design with
an Introduction to the Verilog HDL”, 5th edition
● www.asic-world.com

CpE 425 Digital Systems Design 19

Вам также может понравиться