Verilog for verilogTown

The goal of verilogTown is to get the cars safely through the streets to their desired destination.  To achieve this, you need to design the Verilog that controls each of the traffic lights.  In, "how to play" you learned about opening an editor to modify the Verilog that controls a particular light.  Here, we will describe the two Verilog templates that come with the game, and if you've never used Verilog before you should read through those pages as best you can (help understanding Combinational and Sequential Verilog below in the templates).

Verilog HDL is a language that can be used to create synthesizable logic designs.  We say synthesizable when we mean digital circuits that can be implemented on a digital technology such as FPGAs.  This is important to understand since Verilog can be used for much more than just synthesizable circuits.  However,  verilogTown is only dealing with what is called synthesiable Verilog.  There is lots of Verilog examples found on the web that is used for testing circuits and has a very different structure.

Combinational versus Sequential

Verilog is a language to describe logic circuits.  We need to understand what is combinational logic circuit and what is sequential logic circuit in terms of behaviour.  This is a deeper question than what we will go into here, but we will distinguish the two by sequential logic is controlled by a clock (the clock is like the heartbeat of a circuit), and combinational logic is always processed.  One analogy might be to think of sequential logic as water flowing that is stopped by a dam that is released every time a second ticks (this is a 1Hz clock freqeuncy).  Combinational logic is a waterway where the water is never stopped and always flows from start to end.

Note you can mix combinational and sequential logic together in a sequential circuit, and this is normal.  The reality is any sequential logic circuit will have combinational elements.  However, a purely combinational circuit has no sequential logic.

The first template in verilogTown

The first Verilog template is a combinational template that in the game checks traffic signal and turns one direction to Go if there is no car in the intersection and there is a car waiting.  Look here (Combinational Template) to learn about the details of the Verilog.

The second template in verilogTown

The second Verilog template is a sequential template that changes the lights every 3 seconds in a counter-clockwise pattern.  Look here (Sequential Template) to learn about the details of the Verilog.