Initial commit

This commit is contained in:
Nikolay Puzanov
2021-02-28 18:59:56 +03:00
parent ff795d2b6e
commit 2fbacc0544
61 changed files with 6063 additions and 0 deletions

56
Makefile Normal file
View File

@@ -0,0 +1,56 @@
SOURCES = $(wildcard source/*.sv)
TOP = sugar_lissajous
PCF = icesugar.pcf
FAMILY = up5k
PACKAGE = sg48
FREQ = 30
#DOSVG = --placed-svg place.svg --routed-svg route.svg
# nextpnr --randomize-seed write_verilog $(TOP).v
BUILD_DIR ?= build
TOP_BIN = $(BUILD_DIR)/$(TOP).bin
TOP_ASC = $(BUILD_DIR)/$(TOP).asc
TOP_JSON = $(BUILD_DIR)/$(TOP).json
all: $(TOP_BIN)
# Make bitstream
$(TOP_BIN): $(TOP_ASC)
icepack $(TOP_ASC) $(TOP_BIN)
# Place and rouite
$(TOP_ASC): $(TOP_JSON) $(PCF)
nextpnr-ice40 -q -l $(BUILD_DIR)/nextpnr.log --$(FAMILY) --package $(PACKAGE) \
--freq $(FREQ) --top $(TOP) --pcf $(PCF) --asc $(TOP_ASC) --json $(TOP_JSON) \
$(DOSVG)
# Synthesys
$(TOP_JSON): $(SOURCES)
mkdir -p $(BUILD_DIR)
yosys -q -l $(BUILD_DIR)/yosys.log -p \
"proc; alumacc; share -fast; opt -full; synth_ice40 -top $(TOP) -json $(TOP_JSON) -abc2" \
$(SOURCES)
# Timing analysis
timing: $(TOP_ASC)
icetime -d $(FAMILY) -t -c $(FREQ) -r $(BUILD_DIR)/timing.log $(TOP_ASC)
# Program
prog: $(TOP_BIN)
icesprog -w $(TOP_BIN)
# Clean
clean:
rm -rf $(BUILD_DIR)
# Convert SVG to PNG
png: route.png place.png
route.png: route.svg
inkscape --export-type=png -o route.png -D -d 100 route.svg
place.png: place.svg
inkscape --export-type=png -o place.png -D -d 150 place.svg