1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
include Makefile.config
include Makefile.util
include tools/Makefile.tools
TEST_TARGETS := $(addprefix test_,$(shell ls tests))
TOOLS_TARGETS := $(addprefix tools/,$(TOOLS))
GENERATED_MEM_FILES := $(shell find design/ -name "*.s.tcl")
GENERATED_MEM_FILES := $(basename $(basename $(GENERATED_MEM_FILES)))
GENERATED_MEM_FILES := $(addsuffix .mem,$(GENERATED_MEM_FILES))
all : design.bin
design.v : design/rom.mem design/*.v
$(IV) -E $(filter %.v,$^) -DROM_WORDS_COUNT=$(call FILE_LINES,$<) -o $@
design.json : design.v design/rom.mem design/font.mem
$(YOSYS) -p 'read_verilog -defer $<' \
-p 'synth_ice40 -top $(TOPMODULE) -json $@'
design.asc : design.json $(PCF)
$(PNR) --hx8k --asc $@ --pcf $(PCF) --json $< --package ct256
design.bin : design.asc
$(ICEPACK) $< $@
timing.rpt : design.asc
$(ICETIME) -d hx8k -mtr $@ $<
prog : design.bin
sudo iceprogduino $<
CALL_TESTS = \
cd tests/; \
for TEST in $(1); do \
echo "** $$TEST "; \
if ! $(MAKE) -C $$TEST $(2) 3>&1 1>/dev/null 2>&3; then \
FAIL=true; \
fi; \
done; \
[ "$$FAIL" != true ]
test :
$(call CALL_TESTS,*)
# Will skip VGA tests, because they take loooong time
quicktest :
$(call CALL_TESTS,*,QUICK_TEST=1)
stack_machine_test :
$(call CALL_TESTS,stack_machine_*)
stack_machine_quicktest :
$(call CALL_TESTS,stack_machine_*,QUICK_TEST=1)
wasm_compile_test :
$(call CALL_TESTS,wasm_compile_*)
$(TEST_TARGETS) : test_% :
$(MAKE) -C tests/$*
tools : $(TOOLS_TARGETS)
$(TOOLS_TARGETS) : tools/% :
$(MAKE) -C tools/ $*
clean :
for TEST in tests/*; do $(MAKE) -C $$TEST clean >/dev/null; done
rm $(GENERATED_MEM_FILES) 2>/dev/null || true
$(MAKE) -C tools/ clean >/dev/null
rm $(addprefix design.,v json asc bin) timing.rpt 2>/dev/null || true
.PHONY : all tools test quicktest stack_machine_test stack_machine_quicktest \
wasm_compile_test $(TEST_TARGETS) $(TOOLS_TARGETS) tools
|