Skip to content

Commit a87e804

Browse files
authored
Merge pull request #99 from umarcor/osflow-rework
osflow rework
2 parents 87ef9ef + 4e371c6 commit a87e804

24 files changed

+184
-206
lines changed

.github/workflows/Windows.yml

+10-13
Original file line numberDiff line numberDiff line change
@@ -29,27 +29,24 @@ jobs:
2929
strategy:
3030
fail-fast: false
3131
matrix:
32-
platform: [
33-
{icon: '⬛', installs: 'MINGW32', arch: i686, pkg: 'mcode' },
34-
{icon: '🟦', installs: 'MINGW64', arch: x86_64, pkg: 'llvm' },
35-
]
36-
example: ${{ fromJson(needs.Matrix.outputs.matrix) }}
37-
name: '${{ matrix.platform.icon }} ${{ matrix.platform.installs }} | ${{ matrix.example.board }} · ${{ matrix.example.design }}'
32+
include: ${{ fromJson(needs.Matrix.outputs.matrix) }}
33+
name: '🟦 MINGW64 | ${{ matrix.board }} · ${{ matrix.design }}'
3834
defaults:
3935
run:
4036
shell: msys2 {0}
4137
steps:
4238

43-
- name: '${{ matrix.platform.icon }} Setup MSYS2'
39+
- name: '🟦 Setup MSYS2'
4440
uses: msys2/setup-msys2@v2
4541
with:
46-
msystem: ${{ matrix.platform.installs }}
42+
msystem: MINGW64
4743
update: true
4844
install: >
4945
make
50-
mingw-w64-${{ matrix.platform.arch }}-yosys
51-
mingw-w64-${{ matrix.platform.arch }}-nextpnr
52-
mingw-w64-${{ matrix.platform.arch }}-icestorm
46+
mingw-w64-x86_64-yosys
47+
mingw-w64-x86_64-nextpnr
48+
mingw-w64-x86_64-icestorm
49+
mingw-w64-x86_64-prjtrellis
5350
5451
- name: '⚙️ git config'
5552
run: git config --global core.autocrlf input
@@ -61,8 +58,8 @@ jobs:
6158
# The command 'git describe' (used for version) needs the history.
6259
fetch-depth: 0
6360

64-
- name: '🚧 Generate ${{ matrix.example.board }} ${{ matrix.example.design }} bitstream'
65-
run: make -C setups/examples BOARD=${{ matrix.example.board }} ${{ matrix.example.design }}
61+
- name: '🚧 Generate ${{ matrix.board }} ${{ matrix.design }} bitstream'
62+
run: make -C setups/examples BOARD=${{ matrix.board }} ${{ matrix.design }}
6663

6764

6865
Processor:

setups/examples/Makefile

+13-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
OSFLOW := ../osflow
2-
EXAMPLES := ../../examples
3-
TEMPLATES := ../../../rtl/templates
2+
EXAMPLES := ../examples
3+
TEMPLATES := ../../rtl/templates
44
MV := mv
55

66
TASK := clean $(BITSTREAM)
@@ -13,22 +13,24 @@ endif
1313

1414
run:
1515
$(eval TASK ?= clean $(BITSTREAM))
16-
$(MAKE) -C $(OSFLOW)/$(BOARD)/ \
16+
$(MAKE) -C $(OSFLOW) -f common.mk \
1717
BOARD_SRC=$(EXAMPLES)/neorv32_$(BOARD)_BoardTop_$(DESIGN).vhd \
1818
TOP=neorv32_$(BOARD)_BoardTop_$(DESIGN) \
1919
ID=$(DESIGN) \
20-
$(TASK)
21-
$(MV) $(OSFLOW)/$(BOARD)/$(BITSTREAM) ./
20+
$(TASK) \
21+
&& $(MV) $(OSFLOW)/$(BITSTREAM) ./
22+
23+
# Boards
2224

2325
Fomu:
2426
ifeq ($(DESIGN),Minimal)
25-
$(eval IMEM_SRC := ../../../rtl/core/neorv32_imem.vhd)
27+
$(eval IMEM_SRC := ../../rtl/core/neorv32_imem.vhd)
2628
else
27-
$(eval IMEM_SRC := ../devices/ice40/neorv32_imem.ice40up_spram.vhd)
29+
$(eval IMEM_SRC := devices/ice40/neorv32_imem.ice40up_spram.vhd)
2830
endif
2931
$(MAKE) \
3032
BITSTREAM=neorv32_$(BOARD)_$(FOMU_REV)_$(DESIGN).bit \
31-
NEORV32_MEM_SRC="${IMEM_SRC} ../devices/ice40/neorv32_dmem.ice40up_spram.vhd" \
33+
NEORV32_MEM_SRC="${IMEM_SRC} devices/ice40/neorv32_dmem.ice40up_spram.vhd" \
3234
run
3335

3436
iCESugar:
@@ -41,6 +43,8 @@ UPduino_v3:
4143
BITSTREAM=neorv32_$(BOARD)_$(DESIGN).bit \
4244
run
4345

46+
# Designs
47+
4448
Minimal:
4549
$(MAKE) \
4650
DESIGN=$@ \
@@ -63,5 +67,5 @@ MixedLanguage:
6367
$(MAKE) \
6468
DESIGN=$@ \
6569
DESIGN_SRC=$(TEMPLATES)/processor/neorv32_ProcessorTop_Minimal*.vhd \
66-
NEORV32_VERILOG_SRC='../devices/ice40/sb_ice40_components.v ../../examples/neorv32_Fomu_MixedLanguage_ClkGen.v' \
70+
NEORV32_VERILOG_SRC='devices/ice40/sb_ice40_components.v ../examples/neorv32_Fomu_MixedLanguage_ClkGen.v' \
6771
$(BOARD)

setups/osflow/.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
*.asc
2+
*.bit
3+
*.dfu
4+
*.history
5+
*.json
6+
*-report.txt

setups/osflow/Fomu/.gitignore

-5
This file was deleted.

setups/osflow/Fomu/Makefile

-51
This file was deleted.

setups/osflow/Fomu/board.mk

-30
This file was deleted.

setups/osflow/PnR_Bit.mk

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
${IMPL}.asc: $(IMPL).json $(PCF)
1+
${IMPL}.${PNR2BIT_EXT}: $(IMPL).json $(CONSTRAINTS)
22
$(NEXTPNR) \
33
$(PNRFLAGS) \
4-
--pcf $(PCF) \
4+
--$(CONSTRAINTS_FORMAT) $(CONSTRAINTS) \
55
--json $(IMPL).json \
6-
--asc $@ 2>&1 | tee nextpnr-report.txt
6+
--${NEXTPNR_OUT} $@ 2>&1 | tee nextpnr-report.txt
77

8-
${IMPL}.bit: $(IMPL).asc
9-
$(ICEPACK) $< $@
8+
${IMPL}.bit: ${IMPL}.${PNR2BIT_EXT}
9+
$(PACKTOOL) $< $@

setups/osflow/UPduino_v3/.gitignore

-8
This file was deleted.

setups/osflow/UPduino_v3/Makefile

-37
This file was deleted.

setups/osflow/boards/Fomu.mk

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
.PHONY: all
2+
3+
# Default target: run all required targets to build the DFU image.
4+
all: $(IMPL).dfu
5+
echo "! Built $(IMPL) for $(BOARD) $(FOMU_REV)"
6+
7+
# Use dfu-suffix to generate the DFU image from the FPGA bitstream.
8+
${IMPL}.dfu: $(IMPL).bit
9+
$(COPY) $< $@
10+
dfu-suffix -v 1209 -p 70b1 -a $@
11+
12+
# Use df-util to load the DFU image onto the Fomu.
13+
load: $(IMPL).dfu
14+
dfu-util -D $<
15+
16+
.PHONY: load

setups/osflow/boards/UPduino_v3.mk

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.PHONY: all
2+
3+
all: bit
4+
echo "! Built $(IMPL) for $(BOARD)"

setups/osflow/boards/iCESugar.mk

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.PHONY: all
2+
3+
all: bit
4+
echo "! Built $(IMPL) for $(BOARD)"

setups/osflow/boards/index.mk

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
PCF_PATH ?= constraints
2+
3+
4+
ifeq ($(BOARD),Fomu)
5+
6+
$(info Setting constraints and implementation args for BOARD Fomu)
7+
8+
# Different Fomu hardware revisions are wired differently and thus
9+
# require different configurations for yosys and nextpnr.
10+
# Configuration is performed by setting the environment variable FOMU_REV accordingly.
11+
12+
FOMU_REV ?= pvt
13+
14+
ifeq ($(FOMU_REV),evt1)
15+
YOSYSFLAGS ?= -D EVT=1 -D EVT1=1 -D HAVE_PMOD=1
16+
PNRFLAGS ?= --up5k --package sg48
17+
CONSTRAINTS ?= $(PCF_PATH)/fomu-evt2.pcf
18+
else ifeq ($(FOMU_REV),evt2)
19+
YOSYSFLAGS ?= -D EVT=1 -D EVT2=1 -D HAVE_PMOD=1
20+
PNRFLAGS ?= --up5k --package sg48
21+
CONSTRAINTS ?= $(PCF_PATH)/fomu-evt2.pcf
22+
else ifeq ($(FOMU_REV),evt3)
23+
YOSYSFLAGS ?= -D EVT=1 -D EVT3=1 -D HAVE_PMOD=1
24+
PNRFLAGS ?= --up5k --package sg48
25+
CONSTRAINTS ?= $(PCF_PATH)/fomu-evt3.pcf
26+
else ifeq ($(FOMU_REV),hacker)
27+
YOSYSFLAGS ?= -D HACKER=1
28+
PNRFLAGS ?= --up5k --package uwg30
29+
CONSTRAINTS ?= $(PCF_PATH)/fomu-hacker.pcf
30+
else ifeq ($(FOMU_REV),pvt)
31+
YOSYSFLAGS ?= -D PVT=1
32+
PNRFLAGS ?= --up5k --package uwg30
33+
CONSTRAINTS ?= $(PCF_PATH)/fomu-pvt.pcf
34+
else
35+
$(error Unrecognized FOMU_REV value. must be "evt1", "evt2", "evt3", "pvt", or "hacker")
36+
endif
37+
38+
IMPL := neorv32_Fomu_$(FOMU_REV)_$(ID)
39+
40+
endif
41+
42+
43+
ifeq ($(BOARD),iCESugar)
44+
$(info Setting constraints and implementation args for BOARD iCESugar)
45+
46+
CONSTRAINTS ?= $(PCF_PATH)/iCESugar.pcf
47+
PNRFLAGS ?= --up5k --package sg48 --ignore-loops --timing-allow-fail
48+
IMPL ?= neorv32_iCESugar_$(ID)
49+
50+
endif
51+
52+
53+
ifeq ($(BOARD),UPduino_v3)
54+
$(info Setting constraints and implementation args for BOARD UPduino)
55+
56+
CONSTRAINTS ?= $(PCF_PATH)/UPduino_v3.pcf
57+
PNRFLAGS ?= --up5k --package sg48 --ignore-loops --timing-allow-fail
58+
IMPL ?= neorv32_UPduino_v3_$(ID)
59+
60+
endif

setups/osflow/common.mk

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
ID ?= impl_1
2+
3+
include boards/index.mk
4+
5+
ifndef TOP
6+
$(error TOP needs to be specified!)
7+
endif
8+
9+
include filesets.mk
10+
11+
ifndef DESIGN_SRC
12+
ifndef BOARD_SRC
13+
$(error Neither DESIGN_SRC nor BOARD_SRC were set!)
14+
endif
15+
endif
16+
17+
include tools.mk
18+
19+
ifdef GHDL_PLUGIN_MODULE
20+
YOSYSFLAGS += -m $(GHDL_PLUGIN_MODULE)
21+
endif
22+
23+
include synthesis.mk
24+
include PnR_Bit.mk
25+
26+
.PHONY: syn impl bit clean
27+
28+
syn: ${IMPL}.json
29+
impl: ${IMPL}.${PNR2BIT_EXT}
30+
bit: ${IMPL}.bit
31+
32+
clean:
33+
rm -rf *.{${PNR2BIT_EXT},bit,cf,dfu,history,json,o} *-report.txt
34+
35+
include boards/$(BOARD).mk

0 commit comments

Comments
 (0)