DE2-114 board simulator using SDL for the UI and Icarus Verilog through VPI as the simulation backend.
Written in haste, caveat emptor.
You need SDL2, SDL2_image, and icarus verilog.
To install those on OS X with MacPorts:
$ sudo port install iverilog libsdl2 libsdl2_image
$ make
iverilog-vpi --name=DE2 -Wall -I/opt/local/include -L/opt/local/lib -lSDL2 -lSDL2_image boardsim.c
Compiling boardsim.c...
Making DE2.vpi from boardsim.o...
A simple module that sets LEDs as a function of button & switch states:
$ cat io_test.v
module io_test(clk, leds, switches, buttons);
input clk;
output reg [17:0] leds;
input [17:0] switches;
input [3:0] buttons;
always @(posedge clk) begin
leds = switches & ~{buttons[1:0], buttons, buttons, buttons, buttons};
end
endmodule
Start the simulator (from the top repo dir... becuase TODOs): ./board.sh top_module_name '.nets(passed), ...' ~/some/path/file1.v /tmp/whatever.v ...
$ ./board.sh io_test '.clk(clk), .leds(leds), .switches(switches), .buttons(buttons)' io_test.v
Click the switches to change them, and press Q, W, E, & R on the keyboard to control the buttons.
- IEEE 1364-2005 (the Verilog standard) — sections 26 & 27 define VPI, Annex G is the normative vpi_user.h
- Verilator's vpi_user.h
- Icarus' vpi_user.h
- The Verilog PLI Handbook (book)
- Principles of Verilog PLI (book)