Beginning FPGA Programming - Partie53
Beginning FPGA Programming - Partie53
Now you have all of the files in the project and you can start simulating the design one block at a
time. You need to make sure the project is compiled and the Project Navigator shows the Hierarchy as in
Figure 12-38 before you move to the simulation section.
Let me show you a trick to generate a TCL script in ModelSim.
We need to open the ModelSim (click Tools ➤ Run Simulation Tools ➤ RTL Simulation) and start the
simulation using the following script in the Transcript window or right-click the light_sensor_counter_led
and click Simulate (Figure 12-39).
vsim work.light_sensor_counter_led
256
Chapter 12 ■ Light Sensors: Turning a Laser Pointer into a Hi-Tech Tripwire
After you run the script or click the simulate selection, the light_sensor_counter_led simulation is
started. You can add all of the design signals to the wave window by right-clicking the target instance in the
sim window and selecting Add Wave (Figure 12-40).
Figure 12-40. How to add wave from the ModelSim GUI interface
257
Chapter 12 ■ Light Sensors: Turning a Laser Pointer into a Hi-Tech Tripwire
The second tip is how to generate a script to force a signal or generate a clock. Right-click the target
signal and select Clock… or Force… A small window will pop up a for defining a clock or forcing a signal.
After you click OK (Figure 12-41), the script will be generated in the transcript window (Figure 12-42) and
you only need to copy it and use it later.
Figure 12-42. Transcript window generates the script for create a clock signal
Step 1: Open the Quartus Prime programmer window from the Tools menu (Figure 12-43) or click
from the toolbar. If the BeMicro Max10 board is connected and the USB-Blaster II device driver has been
installed successfully on your computer (Figure 12-44), you can go to step 2. If your programmer is shown as
in Figure 45, you need to plug in your BeMicro Max10 FPGA board. Before you can go to step 2, you need to
follow the steps in Figure 12-45.
258
Chapter 12 ■ Light Sensors: Turning a Laser Pointer into a Hi-Tech Tripwire
259
Chapter 12 ■ Light Sensors: Turning a Laser Pointer into a Hi-Tech Tripwire
Step 2: You can point to the newly created configuration file by clicking the Add File button and
selecting the light_sensor.sof file under the output_files directory (Figure 12-46).
Step 3: Make sure the Program/Configure check box is ticked and click the Start button (Figure 12-47).
The Progress bar will go to 100% and turn green. This means the programming process has finished. Now
you should try to use the laser pointer to point to the photo resistor and then put something in between to
check out the design.
260