summaryrefslogtreecommitdiff
path: root/Makefile
blob: fa53ee8bd89da2c76fb73be48456f15fcaf0b5a6 (plain) (blame)
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
SOURCES := $(wildcard hdl/**.sv)
HEADERS := $(wildcard hdl/**.svh)
MEMORIES := $(addprefix build/, $(addsuffix .hex, $(basename $(wildcard mem/**.pal))))
QUARTUS := $(shell find altera tcl -name \*.cdf -o -name \*.sdc -o -name \*.tcl)

fpga: pdp8.sof
	quartus_pgm -c 1 -m JTAG -o "P;$<@1"
.PHONY: fpga

download-%: mem/%
	p8bin2uart 1 $< | tool/download.tcl  0 1
	p8bin2uart 1 $< | tool/download.tcl  1 1
	p8bin2uart 1 $< | tool/download.tcl  2 1
	p8bin2uart 1 $< | tool/download.tcl  3 1
	p8bin2uart 1 $< | tool/download.tcl  4 1
	p8bin2uart 1 $< | tool/download.tcl  5 1
	p8bin2uart 1 $< | tool/download.tcl  6 1
	p8bin2uart 1 $< | tool/download.tcl  7 1
	p8bin2uart 1 $< | tool/download.tcl  8 1
	p8bin2uart 1 $< | tool/download.tcl  9 1
	p8bin2uart 1 $< | tool/download.tcl 10 1
	p8bin2uart 1 $< | tool/download.tcl 11 1
	p8bin2uart 1 $< | tool/download.tcl 12 1
	p8bin2uart 1 $< | tool/download.tcl 13 1
	p8bin2uart 1 $< | tool/download.tcl 14 1
	p8bin2uart 1 $< | tool/download.tcl 15 1

term-mem:
	nios2-terminal --instance 0
.PHONY: term-mem

term-pdp8:
	nios2-terminal --instance 1
.PHONY: term-pdp8

build/%.bin: %.pal
	@mkdir -p $(dir $@)
	palbart $<
	mv -f $*.bin $*.lst $(dir $@)

pdp8.sof: $(SOURCES) $(HEADERS) $(MEMORIES) $(QUARTUS)
	[ ! -e pdp8.qpf ] || quartus_sh -t tcl/clean.tcl
	quartus_sh -t tcl/init.tcl
	quartus_sh --flow compile pdp8.qpf

clean:
	git clean -dfX
.PHONY: clean

.SECONDARY: