Skip to content

Instantly share code, notes, and snippets.

@gojimmypi
Last active March 24, 2019 22:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gojimmypi/7b65583f32434186dd002f35e26c1644 to your computer and use it in GitHub Desktop.
Save gojimmypi/7b65583f32434186dd002f35e26c1644 to your computer and use it in GitHub Desktop.
Makefile gtkwave sim and xserver recipes for WSL FPGA programming
PROJ = ulx3s_adda
sim:
rm -f $(PROJ).vcd
iverilog -o $(PROJ).vvp $(PROJ).v $(PROJ)_tb.v
vvp $(PROJ).vvp
export DISPLAY=:0
## if we are running in WSL, we need a bit of help for GUI XWindows
## and sometimes the WSL username is not the same as the Windows username & we need the *windows* user path.
## this is the Windows %USER% environment variable when called from makefile: $(shell cmd.exe /c "echo $$USER")
@if [ "$(shell grep Microsoft /proc/version)" != "" ]; then \
cp /mnt/c/cygwin64/home/$(shell cmd.exe /c "echo $$USER")/.Xauthority ~/.Xauthority; \
fi
(gtkwave $(PROJ).vcd $(PROJ)_savefile.gtkw)&
xserver:
## launch the Windows cygwin64 startxwin when WSL is detected
@if [ "$(shell grep Microsoft /proc/version)" != "" ]; then \
echo "Launching Windows XServer from WSL..."; \
(/mnt/c/cygwin64/bin/run.exe --quote /usr/bin/bash.exe -l -c " exec /usr/bin/startxwin -- -listen tcp -nowgl")& \
else \
echo "Not launching WSL XServer!" ; \
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment