Simulate bladeRF-wiphy in Modelsim
Fetch sources
Follow the first two steps (Compile libbladeRF
, and Synthesize bladeRF-wiphy
) on https://www.nuand.com/bladeRF-wiphy-instructions , however running ./build_bladerf.sh
is optional.
Launch Modelsim
To simulate the IEEE 802.11 modem, open up the ModelSim that came with Quartus. Change the current working directory to ~/wiphy-build/bladeRF/hdl/fpga/platforms/bladerf-micro/modelsim
.
If running this on Linux, ensure vsim
can be run, otherwise try to add it by first calling ~/intelFPGA_lite/19.1/nios2eds/nios2_command_shell.sh
.
Launch the Modelsim vsim
simulator by calling vsim
from the command line.
Once vsim has launched compile the sources:
set wlan_path ../../../../../../bladeRF-wiphy/fpga/modelsim
do compile.do
do $wlan_path/wlan.do
do wlan_fx3_gpif_tb.do
If the previous steps completed successfully, the sources should be compiled and simulation can begin.
GPIF to bladeRF-wiphy, and back simulation
wlan_fx3_gpif_tb
is a testbench for simulating the bladeRF-wiphy and the bladeRF GPIF module. The inputs and outputs in wlan_fx3_model essentially correspond to variable length packets transmitted between the FX3 and the FPGA.
To test the receive side of bladeRF-wiphy, place a CSV file containing IQ samples into:
~/wiphy-build/bladeRF/hdl/fpga/platforms/bladerf-micro/modelsim
and name the file, rx-0.csv
. A reference gzipped CSV file can be downloaded from https://nuand.com/downloads/rx-0.csv.gz . The rx-0.csv.gz file is gzipped, so it should be gunzip’d by running gzip -d rx-0.csv.gz
after being downloaded. The reference wave.do
can be downloaded from https://nuand.com/downloads/wave.do , it should be placed in the same directory (bladerf-micro/modelsim/
) as rx-0.csv
. To put it all together, the commands are:
cd ~/wiphy-build/bladeRF/hdl/fpga/platforms/bladerf-micro/modelsim wget https://nuand.com/downloads/rx-0.csv.gz gzip -d rx-0.csv.gz wget https://nuand.com/downloads/wave.do
To run the wlan_fx3_gpif_tb
testbench, run the following commands in Modelsim:
wlan_sim_entity nuand.wlan_fx3_gpif_tb do wave.do restart -f; run 1ms
Once the simulation finishes, the transmission of 4 frames, and the reception of 1 frame should be seen. The simulation should have a set of groups for signals including “BEGIN RX SUMMARY”, “BEGIN TX SUMMARY”, and “VERBOSE”.
Here are some example screenshots of the simulation:
The top of RX summary (1 frame):

The end of RX summary showing the successful decoding of a frame:

The top of TX summary (modulation 4 frames):

Near the top of the “VERBOSE” section:
