Switch To Led Demo

Author: Paul Maddox

This is a simple test app, that reads data from 8 of the 9 switches (4 around the encoder and the 4 on the right of the board) and turns on/off one of the corresponding 8 LEDs.
It's not meant to be clever or interesting, it's more to help people look at some verilog and understand it. I've commented the code quite heavily, but I'll raise some key points here..

When using registers or groups of pins togeter (for example in a data bus) you must be sure to declare/use the bits backwards... What I mean is, you'd normally think like this -

data[0:7] 

ie, a thing (register, port, etc) called data, that has 8 bits, numbered 0 to 7.
ISE will trhough up an error if you do this, so you should use the following form -

data[7:0]

The other interesting thing to note is the <= which is signal assignment operator, this means that the signal on the right is assigned to the thing on the left, normally an IO pin.

one final note, I think I found a bug in ISE! if you use single quotes, ie ' , in a comment line ISE starts complaining about things not being assigned, interestingly, adding a second comment line underneath, without a single quote removes the problem. I'd suggest avoid the use of sinle quotes in comments completely, just to be on the safe side.

a zip of the ISE project is available here - sw2led.zip