Simulate bladeRF-wiphy in Modelsim

Fetch sources

Follow the first two steps (Compile libbladeRF, and Synthesize bladeRF-wiphy) on , however running ./ 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/ .

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 $wlan_path/

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:


and name the file, rx-0.csv . A reference gzipped CSV file can be downloaded from . 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 can be downloaded from , 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
gzip -d rx-0.csv.gz

To run the wlan_fx3_gpif_tb testbench, run the following commands in Modelsim:

wlan_sim_entity nuand.wlan_fx3_gpif_tb
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: