I will write a counter code in verilog that counts like this (with D Flip Flop and some logic gates) 0000 -> 0 0010 -> 2 0100 -> 4 0110 -> 6 1000 -> 8 1010 -> 10 1100 -> 12 1001 -> 9 0110 -> 6 0011 -> 3 0000 -> 0 Can someone help me how I can write it ? :) thanks
Cemal Unal wrote: > Can someone help me how I can write it ? :) What comes after the ending '0'? If the counter loops again from the beginning, then implement a counter that counts in cycles from 0 to 9 and decode each counter step to your desired output value afterwards:
1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 | |
9 | |
10 | |
11 | |
12 | |
13 | |
14 | |
15 | |
16 | |
17 | |
18 | |
19 | |
20 | |
And so you don't have to dig around with D-FFs and logic gates. The synthesizer/compiler has to deal with it...
Guest
#3944504
Lothar wrote a behavioral description of what you wanted... but you could write it using primitives (d-flipflops and gates) to achieve the same result... as you wanted... You may wan to draw the circuit on a piece of paper, or you could use the schematic editor that some fpga packages provide
Lothar and Ale thanks a lot for your answers..
Reply
Please log in before posting.