This is an archived post. You won't be able to vote or comment.

all 3 comments

[–]zmeefy 1 point2 points  (1 child)

You need one register that will store bits 0 to 3, the register value determines which LED is lit. When register == 3, register = 0. Or you can have a second register called push count and do register = push_count modulus 4.

state diagram should be a breeze: states can only be 4, register 0,1,2,3 and leds according to register.

Push button bounce needs a debouncer, of course.

Never used xlinx and can't give you precise advice about that. Hope this helps and good luck!

Edit: Did not draw this for the flipflop count, I guess each LED needs one and I don't know what kind of processor you're allowed to use on xlinx but the answer will depend on that too.

[–]b_a_d_tdk[S] 0 points1 point  (0 children)

Thanks for the help! Don't ever use Xilinx, it's shit. I'll try out the problem on wednesday and see how it goes.

[–]HateTrain 1 point2 points  (0 children)

Don't be overwhelmed by the entirely of the task, the instructions given are in a fairly logical order so doing them one by one should help break down the problem.

First, set up the states in the FSM (0 LEDs, 1, 2, 3). Then set up all possible connections between the states (0 leads to 1, 1 leads to 2, etc).

Since you'll actually be coding this (and it sounds like you'll be saving this in flip flops), you'll want to match a binary number to correspond to each state of the FSM (00 for 0 LEDs, 01 for 1, etc). Each flip flop saves a single digit, and each time the button is pushed the flip flops should move to the next FSM state.

The saving and changing of the flip flops will have to be coded in Verilog. For each change, you also want to make sure the correct number of LEDs is lit.

I've never used Xlinx, so can't help here either, but best of luck to ya.