⚠️ This section is a work in progress.
GHDL and GTKWave is required to use the simulator.
In order to help with finding errors and not always have to program the FPGA, you can simulate your program. You can set the inputs of Main or a Component to trigger an operation and after running the simulation, you can see how the values of all signals change while running the code. This way, you have a lot of information to compare at a glance, which helps to find the error or check if your code works as expected.
Here is an example on how to use the simulation:
How to Simulate Your Code
Install the required programs
- Click on Extras/Package Manager
- Install GTKWave and GHDL
Create the simulation file
- Open the file to simulate
- Click on the button with the pulse symbol or click on Tools/Simulation
- Make sure the correct file is selected
- Set the time to simulate (don't set the time too high, or the simulation will take a long time to finish)
- Set "CLK Frequency" to the frequency of the clock that is connected with the CLK input
- Select the inputs of the simulated component. You can then emulate the input like when the inputs are used in the final FPGA
- Click on Save
Emulate the inputs
- Select the input to emulate
- Set the time for that the input should have a value
When the data is '1' or '0':
- Click on the rising or falling edge button
When you have an individual value:
- Set the value the input should have
- Click on the plus symbol
When you want to repeat the value sequence (e.g. for a clock signal)
- Set the data to repeat (e.g. 1ms '1', 1ms '0')
- Click on the repeat button
With the code you can emulate the inputs.
.ghdp file is like with
.vhdp, but with some changes.
wait for ...;adds a delay between the operations before and after
wait until ...;waits until condition is true
There are much more tools that you can use for the simulation, but the best way is to just search for "VHDL Simulation". The same operations for VHDL work with GHDP as well.
Start the simulation
- Click on the run symbol in the simulation bar
- Check for errors in the output window
- After GTK Wave is open, click on the component of which you want to see the signal
- Double click the signal to display in the wave window
- You can zoom out and see the simulated behavior
Simulation with VHDL
- Write your VHDL simulation code
- Right click on the VHDL file
- Select "Simulate with GHDL"