Notes on Wren6991’s Hazard3 Soft RISC-V with JTAG

See the YosysHQ OSS CAD Suite Installation

Be sure to use the -L with curl. See Dealing with HTTP 301 redirected file.

# set your preferred location for the download & extracted binary:
export MYOSSCADSUITE=/mnt/c/download/yosyshq

mkdir -p $MYOSSCADSUITE
cd $MYOSSCADSUITE

# See https://github.com/YosysHQ/oss-cad-suite-build/releases, this version is the Sept 4, 2022 build:
curl -L "https://github.com/YosysHQ/oss-cad-suite-build/releases/download/2022-09-04/oss-cad-suite-linux-x64-20220904.tgz"
tar -zxvf oss-cad-suite-linux-x64-20220904.tgz
source $MYOSSCADSUITE/oss-cad-suite/environment
git clone --recursive https://github.com/Wren6991/Hazard3.git hazard3
cd hazard3
# Set up some paths, add RISC-V toolchain to PATH
. sourceme

cd test/sim/tb_cxxrtl
make

X-Windows Server for WSL

This section won’t apply to native Linux.

Launch the Windows X-Server from the Microsoft Store. Just click the Open button. There’s no obvious UI, and nothing appears to happen.

I also have a gist for doing this with the CygwinX in a makefile, basically just need to:

export DISPLAY=:0
/mnt/c/cygwin64/bin/run.exe --quote /usr/bin/bash.exe -l -c " exec /usr/bin/startxwin -- -listen tcp -nowgl"

May need to do this once:

cp /mnt/c/cygwin64/home/$(shell cmd.exe /c "echo $$USER")/.Xauthority   ~/.Xauthority

Here’s the entire makefile section:

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

I ended up running into an error I could not resolve. Update coming hopefully soon here.