Following the diagram we have a Hsync and a Vsync variable that are run by counters that reset at 525 and 800, these values act as the location and coordinate system inside the frame. There is an active region which will be a simple logic variable that is true when Hsync and Vsync are between 0 and 480, and 0 to 640. Outisde the region is when RGB outputs should be set to 0. Testing the code would show subtle gray tint throughout the screen on the monitor. There is a frame counter that is set up from the Vsync value when it resets.
The skier is a 16 by 16 green square with it's top left corner placed at the coordinates 312, 24. A VGA green signal is defined to color and the skier falls at a set speed of 1 pixel every 8 frames. The VGA blue signal is used as a 8 pixel thick border which surrond the screen. At any time the skier hits the border it automatically switches the skier's direction. The VGA red signal represents the red gates that will be randomized and come up with gaps. The details on the randomizer will be detailed in the state machines section
The game is handled with two distinct state machines. The first one is only used once in the game which is the StateMachine.v. This state machine handles the states of the game, when the skier starts skiing and when to award points or finish games is all done through StateMachine.v. The other state machine is called GateMachine.v and we call it 8 times as they all ask their own gate with their own starting position. This state machine handles the reloading of the gate when it reaches the top and randomizes the gap and sets it back to the bottom. All the gates also move up at the same rate of 1 pixel every 12 frames.
The gates are fed with randomized intervals of gaps from left to right and each choice must not be too far away from the gap position ahead of the gate. To do this a mux is needed to select the intervals of 1 to 2 intervals to the left or 1 to 2 to the right or lastly no interval. The mux is driven by a randomizer module called LFSR.v and the random bit string is taken at the exact time the gate reloads. From the mux it has 8 options at random so it is filled with the 5 choices of intervals with a repeats to fill the 8 options.