Using a Nandland GoBoard with GHDL and Yosys-ghdl-plugin opensource fpga toolchain for lattice ice40 fpgas, to work through the Nandland Getting Started with FPGAs book
Work through the book, doing all the exercices
Do some projects: - UART - VGA - ADC/DAC? - Audio Something? - Basc Processor (e.g. for running forth)?
Read Free Range VHDL
Followed tutorials for using GHDL
see my repository
Using containers provided here
Adapted Makefile from this project for building and programming
Added featuers for multifile projects, simulators. check full_adder.
TOP ?= top
WORKDIR ?= build
PCF ?= goboard.pcf
UID = $(shell id -u)
GID = $(shell id -g)
DOCKER = docker run -it --rm -u $(UID):$(GID) -v $(PWD):/src -w /src
DOCKER-BUILD = $(DOCKER) hdlc/impl:icestorm
DOCKER-PROG = $(DOCKER) hdlc/prog
GHDL = $(DOCKER-BUILD) ghdl
YOSYS = $(DOCKER-BUILD) yosys
NEXTPNR = $(DOCKER-BUILD) nextpnr-ice40
ICEPACK = $(DOCKER-BUILD) icepack
# Don't use docker for programming, device pass through doesn't work
ICEPROG = iceprog
VHDL_SOURCES = $(shell find . -name "*.vhdl")
# Nandland Go Board Settings
GHDL_GENERICS = #-gCLK_FREQUENCY=25000000
PACKAGE = vq100
DEVICE = -hx1k
FREQ = --freq 25
.PHONY: all build synth pnr sim prog clean
all: $(WORKDIR)/$(TOP).bin
build: $(WORKDIR)/$(TOP).bin
synth: $(WORKDIR)/$(TOP).json
pnr: $(WORKDIR)/$(TOP).asc
sim: $(VHDL_SOURCES)
mkdir -p $(WORKDIR)
$(GHDL) -i -v --workdir=$(WORKDIR) $(VHDL_SOURCES)
$(GHDL) -m -v --workdir=$(WORKDIR) $(TOP)
$(GHDL) -r -v --workdir=$(WORKDIR) $(TOP)
prog: $(WORKDIR)/$(TOP).bin
$(ICEPROG) $<
clean:
rm -rf $(WORKDIR)
$(WORKDIR)/$(TOP).bin: $(WORKDIR)/$(TOP).asc
$(ICEPACK) $< $@
$(WORKDIR)/$(TOP).asc: $(WORKDIR)/$(TOP).json
$(NEXTPNR) --hx1k --json $< $(FREQ) --pcf $(PCF) --pcf-allow-unconstrained --package $(PACKAGE) --asc $@
$(WORKDIR)/$(TOP).json: $(VHDL_SOURCES)
mkdir -p $(WORKDIR)
$(GHDL) -i -v --workdir=$(WORKDIR) $(VHDL_SOURCES)
$(GHDL) -m -v --workdir=$(WORKDIR) $(TOP)
$(YOSYS) -m ghdl -p "ghdl --workdir=$(WORKDIR) $(TOP); synth_ice40 -json $@"
iceprog is for programming, must be natively installed (not in a container).
There are scripts located here to install https://github.com/ddm/icetools/tree/master
I built from source:
git clone https://github.com/YosysHQ/icestorm.git ~/opt/icestorm
cd ~/opt/icestorm
make
sudo make install