Why counters are required in designs? Practical applications for each type of counter
Ring counter: counting transaction and pkts
Gray counter: Asynchronous FIFO
Module-n counter: Timer with specific timeout value
Each counter must be parameterizable for counter bit width. All results in below questions must be verified from Waveform. All submissions should have waveform put in word document with questions title.
DFF implementation
Implement DFF using behavioural and gate level.
Ports: clk, rst, d, q
Synchronous reset DFF
Asynchronous reset DFF
DFF Gate level implementation
Develop testbench.
Learn how to generate clock and reset
Clock generation:
Clk = 0
Forever #5 clk = ~clk;
Reset generation
Rst=1;
@(posedge clk);
Rst=0;
Up Counter
Ports
Input: clk, rst
Output : count
Behavioral code
Implemented using behavioural logic
Gate level implementation
Write logic truth table
Implement Current value using 3 bit register(since 3 bit counter)
Implement next value using 3 bit register (next_count[2:0])
Use Karnaugh map for each bit of next_count[2:0]
Ex:
Write logic for Next_count[1], Next_count[0]
Now come up with logic for next_count[2,1,0] using count