-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
79 lines (61 loc) · 1.58 KB
/
Copy pathMakefile
File metadata and controls
79 lines (61 loc) · 1.58 KB
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
# Project setup
PROJ = top
BUILD = ./build
DEVICE = 8k
FOOTPRINT = ct256
# Files
FILES = cpu.v alu8.v alu4.v pg.v MEMORY.v
.PHONY: all compile analyze burn stats svg ps1 ps2 verilator run test clean
all: compile analyze
analyze: compile
burn: compile
run: verilator
test: verilator
compile:
mkdir -p $(BUILD)
yosys -p "synth_ice40 -top $(PROJ) -blif $(BUILD)/$(PROJ).blif" $(PROJ).v $(FILES)
analyze:
arachne-pnr -d $(DEVICE) -P $(FOOTPRINT) -o $(BUILD)/$(PROJ).asc $(BUILD)/$(PROJ).blif
icetime -d hx$(DEVICE) $(BUILD)/$(PROJ).asc
burn:
arachne-pnr -d $(DEVICE) -P $(FOOTPRINT) -o $(BUILD)/$(PROJ).asc -p $(PROJ).pcf $(BUILD)/$(PROJ).blif
icepack $(BUILD)/$(PROJ).asc $(BUILD)/$(PROJ).bin
iceprog -S $(BUILD)/$(PROJ).bin
stat:
yosys \
-p "hierarchy -check -top cpu" \
-p "proc; opt; onehot;" \
-p "stat" \
$(FILES)
svg:
yosys -o synth.v \
-p "hierarchy -check -top cpu" \
-p "proc; opt; onehot" \
-p "show -format svg -prefix .yosys_show_3 cpu" \
$(FILES)
ps1:
yosys -o synth.v \
-p "hierarchy -check -top cpu" \
-p "proc; opt; onehot" \
-p "show -format ps -prefix .yosys_show_1 -viewer echo" \
$(FILES)
ps2:
yosys -o synth.v \
-p "hierarchy -check -top cpu" \
-p "proc; opt; onehot" \
-p "techmap; opt" \
-p "show -format ps -prefix .yosys_show_2 -viewer echo" \
$(FILES)
verilator:
verilator -CFLAGS "-DVL_DEBUG=0 -Wno-write-strings" -cc cpu.v --exe cpu.cpp
make -j -C obj_dir -f Vcpu.mk && obj_dir/Vcpu > test_out.txt;
run:
less test_out.txt
test:
./test.sh
clean:
rm -f obj_dir/*
rm -f build/*
rm -f synth.v
rm -f .yosys_*.dot
rm -f .yosys_*.ps