-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update examples build system #186
Open
playduck
wants to merge
3
commits into
ghdl:master
Choose a base branch
from
playduck:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# Common makefile for GHDL synthesis | ||
|
||
PLUGIN_LIB = ../../library | ||
|
||
ifneq ($(VERILOG_FILES),) | ||
MAYBE_READ_VERILOG = read_verilog $(VERILOG_FILES); | ||
endif | ||
|
||
# agnostic synthesis | ||
%.json: $(VHDL_SYN_FILES) | ||
$(YOSYS) -m $(GHDLSYNTH) -p \ | ||
"ghdl $(GHDL_FLAGS) $(GHDL_GENERICS) $^ -e $(TOPLEVEL); \ | ||
$(MAYBE_READ_VERILOG) \ | ||
synth_$(PLATFORM) \ | ||
-top $(TOPLEVEL)$(TOPLEVEL_PARAMETER) -json $@" 2>&1 | ||
|
||
# ECP pouting | ||
%.config: %.json | ||
$(NEXTPNR) --json $< --lpf $(LPF_DEF) \ | ||
--textcfg $@ $(NEXTPNR_FLAGS) --package $(PACKAGE) | ||
|
||
# ECP packing | ||
%.svf: %.config | ||
$(ECPPACK) --svf $*.svf $< $@ | ||
|
||
# ICE routing | ||
%.asc: %.json | ||
$(NEXTPNR) --$(DEVICE) --json $< \ | ||
--package $(PACKAGE) --pcf $(PCF_DEF) \ | ||
--asc $@ $(NEXTPNR_FLAGS) | ||
|
||
# ICE packing | ||
%.bin: %.asc | ||
$(ICEPACK) $< $@ | ||
|
||
ifeq ($(PLATFORM), ecp5) | ||
|
||
# ECP5 bitstream target | ||
bitstream: $(PROJ).svf | ||
|
||
# ECP programming | ||
prog: $(PROJ).svf | ||
$(OPENOCD) -f $(OPENOCD_JTAG_CONFIG) -f $(OPENOCD_DEVICE_CONFIG) \ | ||
-c "transport select jtag; init; svf $<; exit" | ||
|
||
else ifeq ($(PLATFORM), ice40) | ||
|
||
# ICE bitstream target | ||
bitstream: report $(PROJ).bin | ||
|
||
# ICE programming | ||
prog: $(PROJ).bin | ||
$(ICEPROG) $< | ||
|
||
# ICE timing report | ||
report: $(PROJ).asc | ||
$(ICETIME) -d $(DEVICE) -mtr [email protected] $< | ||
endif | ||
|
||
clean: | ||
rm -rf ./*.json ./*.asc ./*.bin ./report.txt ./*.work-obj93.cf \ | ||
./*.work-obj08.cf ./*.config ./*.svf $(LOCAL_LIB) | ||
|
||
all: bitstream | ||
|
||
.PRECIOUS: %.json %.config | ||
.PHONY: bitstream report clean all | ||
.DEFAULT: all |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,44 @@ | ||
LIB = ../../library | ||
|
||
GHDL ?= ghdl | ||
USE_DOCKER?= | ||
|
||
GHDL_FLAGS = -Plib | ||
PROJ ?= versa_ecp5_top | ||
TOPLEVEL ?= versa_ecp5_top | ||
|
||
CLK_FREQ = 25000000 | ||
VHDL_SYN_FILES = versa_ecp5_top.vhdl pll_mac.vhd | ||
VHDL_SYN_FILES += soc_iomap_pkg.vhdl | ||
VHDL_SYN_FILES += uart.vhdl uart_tx.vhdl uart_rx.vhdl fifobuf.vhdl | ||
|
||
GHDL_GENERICS=-gCLK_FREQUENCY=$(CLK_FREQ) | ||
LPF = versa_ecp5.lpf | ||
LPF_DEF = versa_ecp5.lpf | ||
PACKAGE = CABGA381 | ||
|
||
NEXTPNR_FLAGS = --um5g-45k --freq 100 | ||
NEXTPNR_FLAGS += --lpf-allow-unconstrained | ||
|
||
OPENOCD_JTAG_CONFIG = ../../openocd/ecp5-versa.cfg | ||
OPENOCD_DEVICE_CONFIG = ../../openocd/LFE5UM5G-45F.cfg | ||
|
||
WORKDIR = work | ||
# Files to synthesize: | ||
VHDL_SYN_FILES = versa_ecp5_top.vhdl pll_mac.vhd | ||
VHDL_SYN_FILES += soc_iomap_pkg.vhdl | ||
VHDL_SYN_FILES += uart.vhdl uart_tx.vhdl uart_rx.vhdl fifobuf.vhdl | ||
VERILOG_FILES = $(PLUGIN_LIB)/wrapper/primitives.v | ||
VERILOG_FILES += $(PLUGIN_LIB)/wrapper/bram.v | ||
|
||
TOPLEVEL = versa_ecp5_top | ||
TOPLEVEL_PARAMETER = | ||
GHDL_FLAGS = -Plib | ||
PLATFORM = ecp5 | ||
|
||
VERILOG_FILES = $(LIB)/wrapper/primitives.v | ||
VERILOG_FILES += $(LIB)/wrapper/bram.v | ||
LOCAL_LIB=./lib | ||
|
||
SVFFILE = versa_ecp5_top.svf | ||
DEPENDENCIES = lib/ecp5um-std93.cf | ||
include ../tools.mk | ||
include ../common.mk | ||
|
||
all: $(SVFFILE) | ||
# this project requires verilog wrappers to enable vendor black-box components | ||
# these are defined in project-root/library | ||
# the following targets compile these wrappers into a project specific directory | ||
|
||
include ../docker.mk | ||
include ../ghdlsynth.mk | ||
# NOTE: if you're using VHDL-2008 you MUST rename the file suffix to "-std08.cf" | ||
|
||
lib: | ||
mkdir $@ | ||
|
||
lib/ecp5um-std93.cf: $(LIB)/ecp5u/components.vhdl | lib | ||
$(LOCAL_LIB)/ecp5um-std93.cf: $(PLUGIN_LIB)/ecp5u/components.vhdl | lib | ||
$(GHDL) -i --workdir=$(dir $@) --work=ecp5um $< | ||
|
||
DEPENDENCIES = $(LOCAL_LIB)/ecp5um-std93.cf | ||
pll_mac.vhd: $(DEPENDENCIES) | ||
|
||
prog: $(SVFFILE) | ||
$(OPENOCD) -f $(OPENOCD_JTAG_CONFIG) -f $(OPENOCD_DEVICE_CONFIG) \ | ||
-c "transport select jtag; init; svf $<; exit" | ||
|
||
clean: | ||
rm -fr lib work *.json *.svf *.config *-report.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
|
||
USE_DOCKER?= | ||
|
||
PROJ ?= leds | ||
TOPLEVEL ?= leds | ||
|
||
VHDL_SYN_FILES = leds.vhdl | ||
|
||
# choose one implementation | ||
VHDL_SYN_FILES += spin1.vhdl | ||
# VHDL_SYN_FILES += spin2.vhdl | ||
|
||
PCF_DEF = pinmap.pcf | ||
PACKAGE = ct256 | ||
|
||
PLATFORM = ice40 | ||
DEVICE = hx8k | ||
|
||
include ../tools.mk | ||
include ../common.mk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
|
||
USE_DOCKER?= | ||
|
||
PROJ ?= uart | ||
TOPLEVEL ?= uart_top | ||
|
||
VHDL_SYN_FILES = ./hdl/*.vhd | ||
|
||
PCF_DEF = ./syn/constraints/uart.pcf | ||
PACKAGE = tq144 | ||
|
||
PLATFORM = ice40 | ||
DEVICE = hx1k | ||
|
||
NEXTPNR_FLAGS=--pcf-allow-unconstrained | ||
|
||
include ../../tools.mk | ||
include ../../common.mk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,16 @@ | ||
PROJ ?= blink | ||
PIN_DEF = icezum.pcf | ||
DEVICE = hx1k | ||
|
||
all: report bin | ||
|
||
json: $(PROJ).vhdl | ||
yosys -m ghdl -p 'ghdl $(PROJ).vhdl -e $(PROJ); synth_ice40 -json $@' | ||
USE_DOCKER?= | ||
|
||
asc: $(PIN_DEF) json | ||
nextpnr-ice40 --$(DEVICE) --json json --pcf $(PIN_DEF) --asc $@ | ||
PROJ ?= blink | ||
TOPLEVEL ?= blink | ||
|
||
bin: asc | ||
icepack $< $@ | ||
VHDL_SYN_FILES = ./*.vhdl | ||
|
||
report: asc | ||
icetime -d $(DEVICE) -mtr $@ $< | ||
PCF_DEF = icezum.pcf | ||
PACKAGE = tq144 | ||
|
||
clean: | ||
rm -f json asc bin report work-obj93.cf | ||
PLATFORM = ice40 | ||
DEVICE = hx1k | ||
|
||
.SECONDARY: | ||
.PHONY: all prog clean | ||
include ../tools.mk | ||
include ../common.mk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
|
||
ifneq ($(USE_DOCKER),) | ||
# Use Docker tools | ||
|
||
DOCKER=docker | ||
#DOCKER=podman | ||
|
||
PWD = $(shell pwd) | ||
DOCKERARGS = run --rm -v $(PWD)/../..:/src \ | ||
-w /src/examples/$(notdir $(PWD)) | ||
|
||
GHDL = $(DOCKER) $(DOCKERARGS) ghdl/synth:beta ghdl | ||
GHDLSYNTH = ghdl | ||
YOSYS = $(DOCKER) $(DOCKERARGS) ghdl/synth:beta yosys | ||
NEXTPNR = $(DOCKER) $(DOCKERARGS) ghdl/synth:nextpnr-$(PLATFORM) nextpnr-$(PLATFORM) | ||
ECPPACK = $(DOCKER) $(DOCKERARGS) ghdl/synth:trellis ecppack | ||
ICEPACK = $(DOCKER) $(DOCKERARGS) ghdl/synth:trellis icepack | ||
OPENOCD = $(DOCKER) $(DOCKERARGS) --device /dev/bus/usb ghdl/synth:prog openocd | ||
|
||
ICEPORG = # ? | ||
ICETIME = # ? | ||
|
||
else | ||
# Use local tools | ||
|
||
GHDL = ghdl | ||
GHDLSYNTH = ghdl | ||
YOSYS = yosys | ||
NEXTPNR = nextpnr-$(PLATFORM) | ||
ECPPACK = ecppack | ||
ICEPACK = icepack | ||
OPENOCD = openocd | ||
ICEPROG = iceprog | ||
ICETIME = icetime | ||
|
||
endif |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before merging, could someone check if
iceprog
andicetime
exist in the docker image?And if they do, how would they be included and would they need any flags like
openocd
does?