| 1 |
include ../config.mk |
| 2 |
LDLIBS = -lm -lstdc++ |
| 3 |
override CXXFLAGS += -DPREFIX='"$(PREFIX)"' -DCHIPDB_SUBDIR='"$(CHIPDB_SUBDIR)"' |
| 4 |
|
| 5 |
ifeq ($(STATIC),1) |
| 6 |
LDFLAGS += -static |
| 7 |
endif |
| 8 |
|
| 9 |
all: $(PROGRAM_PREFIX)icetime$(EXE) |
| 10 |
|
| 11 |
CHIPS=lp384 lp1k lp8k hx1k hx8k up5k u4k |
| 12 |
|
| 13 |
ifeq ($(EXE),.js) |
| 14 |
$(PROGRAM_PREFIX)icetime$(EXE): | share/$(CHIPDB_SUBDIR)/chipdb-384.txt share/$(CHIPDB_SUBDIR)/chipdb-1k.txt share/$(CHIPDB_SUBDIR)/chipdb-8k.txt share/$(CHIPDB_SUBDIR)/chipdb-5k.txt |
| 15 |
|
| 16 |
share/$(CHIPDB_SUBDIR)/chipdb-384.txt: ../icebox/chipdb-384.txt |
| 17 |
mkdir -p share/$(CHIPDB_SUBDIR) |
| 18 |
cp $< $@ |
| 19 |
share/$(CHIPDB_SUBDIR)/chipdb-1k.txt: ../icebox/chipdb-1k.txt |
| 20 |
mkdir -p share/$(CHIPDB_SUBDIR) |
| 21 |
cp $< $@ |
| 22 |
share/$(CHIPDB_SUBDIR)/chipdb-8k.txt: ../icebox/chipdb-8k.txt |
| 23 |
mkdir -p share/$(CHIPDB_SUBDIR) |
| 24 |
cp $< $@ |
| 25 |
share/$(CHIPDB_SUBDIR)/chipdb-5k.txt: ../icebox/chipdb-5k.txt |
| 26 |
mkdir -p share/$(CHIPDB_SUBDIR) |
| 27 |
cp $< $@ |
| 28 |
override LDFLAGS += --embed-file share |
| 29 |
endif |
| 30 |
|
| 31 |
$(PROGRAM_PREFIX)icetime$(EXE): icetime.o iceutil.o $(addsuffix .o, $(addprefix timings-, $(CHIPS))) |
| 32 |
$(CXX) -o $@ $(LDFLAGS) $^ $(LDLIBS) |
| 33 |
|
| 34 |
timings-%.cc: timings.py ../icefuzz/timings_%.txt |
| 35 |
$(PYTHON3) timings.py $* > $@ |
| 36 |
|
| 37 |
.PRECIOUS: timings-%.cc |
| 38 |
|
| 39 |
install: all |
| 40 |
mkdir -p $(DESTDIR)$(PREFIX)/bin |
| 41 |
mkdir -p $(DESTDIR)$(PREFIX)/share/$(PROGRAM_PREFIX)icebox |
| 42 |
cp $(PROGRAM_PREFIX)icetime$(EXE) $(DESTDIR)$(PREFIX)/bin/$(PROGRAM_PREFIX)icetime$(EXE) |
| 43 |
cp ../icefuzz/timings_*.txt $(DESTDIR)$(PREFIX)/share/$(PROGRAM_PREFIX)icebox/ |
| 44 |
|
| 45 |
uninstall: |
| 46 |
rm -f $(DESTDIR)$(PREFIX)/bin/$(PROGRAM_PREFIX)icetime$(EXE) |
| 47 |
|
| 48 |
|
| 49 |
# View timing netlist: |
| 50 |
# yosys -qp 'read_verilog -lib cells.v; prep; show' test0_ref.v |
| 51 |
# yosys -qp 'read_verilog -lib cells.v; prep; show' test0_out.v |
| 52 |
|
| 53 |
test0 test1 test2 test3 test4 test5 test6 test7 test8 test9: icetime |
| 54 |
test -f $@_ref.v || $(PYTHON3) mktest.py $@ |
| 55 |
./icetime -m -d hx1k -P tq144 -p [email protected] -o $@_out.v [email protected] |
| 56 |
yosys [email protected] |
| 57 |
|
| 58 |
run0 run1 run2 run3 run4 run5 run6 run7 run8 run9: icetime |
| 59 |
./icetime -t -d hx1k -P tq144 -p $(subst run,test,$@).pcf $(subst run,test,$@).asc |
| 60 |
|
| 61 |
show0 show1 show2 show3 show4 show5 show6 show7 show8 show9: icetime |
| 62 |
bash show.sh $(subst show,test,$@) |
| 63 |
xdot $(subst show,test,$@).dot |
| 64 |
|
| 65 |
test: test0 test1 test2 test3 test4 test5 test6 test7 test8 test9 |
| 66 |
|
| 67 |
show: show0 show1 show2 show3 show4 show5 show6 show7 show8 show9 |
| 68 |
|
| 69 |
clean: |
| 70 |
rm -f $(PROGRAM_PREFIX)icetime$(EXE) $(PROGRAM_PREFIX)icetime.exe *.o *.d timings-*.cc |
| 71 |
rm -rf test[0-9]* |
| 72 |
|
| 73 |
-include *.d |
| 74 |
|
| 75 |
.PHONY: all install uninstall clean |
| 76 |
|