Example6.1: DFF With Asynchronous Reset #1
Example6.1: DFF With Asynchronous Reset #1
DFF
clk
rst
A DFF as shown above is the most basic building block in sequential ckts. In it
the output must copy the input either at the positive edge or at the negative edge
of the clock pulse.
In the code presented below we make use of the if statement to design a DFF
with asynchronous reset. If rst = ’1’,then the output must be q = ‘0’, regardless of
the status of the clk. Otherwise the output must copy the input that is q = d at the
positive edge of the clk. The EVENT attribute is used to detect a clock transition.
The process is run every time any of the signals that appear in the sensitivity list
(clk, rst) changes.
COUNTER q
clk
The code below implements a progressive 1-digit decimal counter (0-9-0). A top
level diagram of the circuit is shown in fig. Above. It contains a single-bit
input(clk) and a 4-bit output (digit).The IF statement is used in this example. A
variable, temp was employed to create the four flip-flops necessary to store the
4-bit output signal.
clk
rst
Above fig shows 4-bit shift register. The output bit (q) must be four positive clock
edges behind the input bit (d). It also contains an asynchronous reset, which
must force all the FF to output to ‘0’ when asserted. In this example, the IF
statement is again employed.
clk
COUNTER DIGIT2
DIGIT1