jpouellet / boardsim

Simulates a subset of the DE2-115 FPGA dev board's peripherals in an SDL-based UI.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DE2-114 board simulator using SDL for the UI and Icarus Verilog through VPI as the simulation backend.

Written in haste, caveat emptor.

Installation

Dependencies

You need SDL2, SDL2_image, and icarus verilog.

To install those on OS X with MacPorts:

$ sudo port install iverilog libsdl2 libsdl2_image

Building

$ 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...

Usage

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.

io_test simulation gif

Resources

VPI

Introductory

Reference

SDL

Introductory

Reference

About

Simulates a subset of the DE2-115 FPGA dev board's peripherals in an SDL-based UI.


Languages

Language:C 86.9%Language:Verilog 9.2%Language:Shell 2.0%Language:Makefile 1.9%