Right now, I am taking a course on Verilog HDL, however, our instructor gave us a machine problem wherein we are required to implement a program using verilog while having C# as our main gui. The machine problem given to us is a type of game, called "Beatmania" (like the actual game beatmania from japan). Its gameplay consist of notes falling down from top of the screen, and as it reaches the bar from below the screen, the player must press the corresponding button to "hit" it and a score will be recorded for each hit.
Here is a sample screenshot:
But, in our machine problem, the number of buttons is decreased to only 4.
Here are our thoughts so far:
- Two primary modules will be used, one called ShiftReg and another HitMiss.
- We will use 4 Shift Registers (one per column) to replicate the gameplay's falling down of notes. ShiftReg module will have this.
- The pattern will probably be stored in a memory declaration, about 120 bits wide. This is also contained in ShiftReg module.
- A 1 will represent a bar and a 0 blank.
- A square waveform or clock will be used to control the speed of the game.
- As a note reaches the bottom, an AND gate will be used, one input from the serial output of the shift register and another input for the switch. This creates the "hit" of the gameplay. This will be included in the HitMiss module.
We thought of using a text file to interface between Verilog and C#. For interfacing the process in verilog to C#'s gui, ShiftReg module will create a textfile like this:
Each line will represent a column in C#, then every time a shifting occurs, the textfile is updated in verilog, and is reflected to the GUI in C#. Thus, causing rapid opening and closing of text files in both Verilog and C#.
The ShiftReg module also outputs the shift register's serial output to be input in the HitMiss module.
- As the HitMiss module accepts the output from the ShiftReg module, the comparison will occur (by use of AND gates as stated above).
- The HitMiss Module will also contain the calculations for the scoring, such as number of hits, and final grade. Again this will be placed in a text file, to be reflected in C#.
- Therefore, as of now, for the two modules, the ShiftReg module will have four output ports(serial output of the shift registers), and the HitMiss module will have 8 input ports(to accept inputs from buttons(4), and inputs from ShiftReg module(4)). Start buttons and reset buttons will also be included and text files will be used to bridge Verilog and C#.
Now, here are my questions:
- How do I run both programs simultaneously (Verilog and C#), if the game is in real time such as using the clock signal, or interactive button presses? I only know that Verilog is usually simulated through test benches, with a set of user-defined stimulus.
- Regards to the design, how am I going to reflect a Hit or a Miss in C#? Any ideas? Also, ideas on how to reflect the buttons from C# to the buttons/input (probably in HitMiss module) in Verilog?
- About the storage of pattern, how do I access each bit consecutively for the shift registers to use? Do I use looping?
By the way, I am using Xilinx ISE Project Navigator.