Gray counter

Task:  Design a 3-bit Gray counter.







Fig. 1.  Photograph of the Digilent Spartan 3 board.


The clock is generated by pressing the BTN0 button and therefore the contact bouncing may occur, that is, the generation of more than one clock slope after a single press of a button.


Perform a functional simulation and verify the circuit practically by programming the prototype board.

UCF file for the exercise, Digilent Spartan-3 board, Spartan-3 3S200 FT256-4:

# Push-buttons:
NET "rst_i" LOC = "L14" ; # pressed high BTN3
NET "clk_i" LOC = "M13" ; # pressed high BTN0
# LEDs:
NET "led_o<0>" LOC = "K12" ; # high on
NET "led_o<1>" LOC = "P14" ; # high on
NET "led_o<2>" LOC = "L12" ; # high on