This repository has been archived by the owner on Sep 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
97 lines (75 loc) · 2.4 KB
/
Makefile
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
.PHONY: clean
clean:
rm -rf dist-newstyle
rm -rf verilog
rm -rf netlist
format:
stylish-haskell -c ./.stylish-haskell.yaml -r -i src tests
check_format:
cp ./.stylish-haskell.yaml ./.stylish-haskell-check.yaml
echo "exit_code: error_on_format" >> ./.stylish-haskell-check.yaml
stylish-haskell -c ./.stylish-haskell-check.yaml -r src tests
clean_tests:
rm ./.stylish-haskell-check.yaml
test:
cabal test
/run/netns/colorlight:
sudo ip netns add colorlight
sudo ip link set $(IFNAME) netns colorlight
sudo ip netns exec colorlight ip addr add 192.168.1.0/24 dev $(IFNAME)
sudo ip netns exec colorlight ip6tables -A OUTPUT -p icmpv6 --icmpv6-type router-solicitation -j DROP
sudo ip netns exec colorlight ip link set $(IFNAME) up
.PHONY: namespace
namespace: /run/netns/colorlight
.PHONY: delete_namespace
delete_namespace:
@if [ -f /run/netns/colorlight ]; then \
echo "Deleting namespace colorlight"; \
sudo ip netns delete colorlight; \
else \
echo "Namespace colorlight does not exist"; \
fi
.PHONY: python_test
python_test: /run/netns/colorlight prog
sudo ip netns exec colorlight \
sudo "IFNAME=$(IFNAME)" "DEV=$(DEV)" "PATH=$$PATH" "PYTHONPATH=$$PYTHONPATH" python3 -m unittest discover -s python_tests
HASKELL_SOURCES=$(shell find src -type f -iname '*.hs')
verilog=verilog/Clash.Lattice.ECP5.Colorlight.TopEntity.topEntity/topEntity.v
netlist=netlist/synth.json
pnr=netlist/pnr.cfg
bitstream=netlist/clash-eth.bit
${verilog}: ${HASKELL_SOURCES}
cabal run clash -- Clash.Lattice.ECP5.Colorlight.TopEntity --verilog -g -fclash-clear
.PHONY: verilog
verilog: $(verilog)
${netlist}: ${verilog}
mkdir -p netlist
yosys \
-m ${YOSYS_ECP5_INFER_OUTREG_LIB} \
-p "synth_ecp5 -no-rw-check -abc2 -top topEntity" \
-p "ecp5_infer_bram_outreg" \
-p "write_json ${netlist}" \
verilog/Clash.Lattice.ECP5.Colorlight.TopEntity.topEntity/*.v
.PHONY: netlist
netlist: $(netlist)
${pnr}: ${netlist} pinout.lpf
nextpnr-ecp5 --json ${netlist} \
--lpf pinout.lpf \
--textcfg ${pnr} --25k \
--speed 6 \
--package CABGA256 \
--randomize-seed --timing-allow-fail
.PHONY: pnr
pnr: $(pnr)
${bitstream}: ${pnr}
ecppack ${pnr} --bit ${bitstream} --bootaddr 0
.PHONY: bitstream
bitstream: $(bitstream)
prog: ${bitstream}
sudo "PATH=$$PATH" env ecpprog -S ${bitstream}
flash: ${bitstream}
sudo "PATH=$$PATH" env ecpprog -p -a ${bitstream}
int:
cabal run -- clashi
hoogle:
hoogle server --local --port 8080