forked from ucb-bar/berkeley-hardfloat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
83 lines (57 loc) · 2.47 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
default: all
ifeq (, $(shell which testfloat_gen))
$(error "No testfloat_gen in $(PATH), install testfloat_gen")
endif
tests = \
f32_mulAdd \
f64_mulAdd \
f64_div \
f64_sqrt \
SBT = java -Xmx2048M -Xss8M -XX:MaxPermSize=128M -jar sbt-launch.jar
define test_template
test-$(1)/Test_$(1).cpp: src/main/scala/*.scala
$(SBT) -DchiselVersion=latest.release "run $(1) --targetDir test-$(1)"
test-$(1)/dut: test-$(1)/Test_$(1).cpp csrc/*.h csrc/*.cpp
g++ -c -o test-$(1)/emulator.o -Icsrc -Itest-$(1) -include csrc/emulator-$(1).h csrc/emulator.cpp
g++ -c -o test-$(1)/Test_$(1).o $$<
g++ -o $$@ test-$(1)/Test_$(1).o test-$(1)/emulator.o
test-c-$(1).near_even.log: test-$(1)/dut
{ time testfloat_gen -rnear_even $(1) | $$< 0 ; } > $$@ 2>&1
test-c-$(1).minMag.log: test-$(1)/dut
{ time testfloat_gen -rminMag $(1) | $$< 1 ; } > $$@ 2>&1
test-c-$(1).min.log: test-$(1)/dut
{ time testfloat_gen -rmin $(1) | $$< 2 ; } > $$@ 2>&1
test-c-$(1).max.log: test-$(1)/dut
{ time testfloat_gen -rmax $(1) | $$< 3 ; } > $$@ 2>&1
$(1): $$(addsuffix .log, $$(addprefix test-c-$(1)., near_even minMag min max))
test-$(1)/Test_$(1).v: src/main/scala/*.scala
$(SBT) -DchiselVersion=latest.release "run $(1) --targetDir test-$(1) --backend v"
test-$(1)/simv: test-$(1)/Test_$(1).v
cd test-$(1) && vcs -full64 -timescale=1ns/10ps +define+EXPERIMENT=\"emulator-$(1).vh\" +incdir+../vsrc +rad $$(notdir $$<) ../vsrc/emulator.v -o $$(notdir $$@)
test-$(1)/simv-debug: test-$(1)/Test_$(1).v
cd test-$(1) && vcs -full64 -timescale=1ns/10ps +define+EXPERIMENT=\"emulator-$(1).vh\" +incdir+../vsrc +define+DEBUG -debug_pp $$(notdir $$<) ../vsrc/emulator.v -o $$(notdir $$@)
test-v-$(1).near_even.log: test-$(1)/simv
{ time testfloat_gen -rnear_even $(1) | $$< +rm=0 ; } > $$@ 2>&1
test-v-$(1).minMag.log: test-$(1)/simv
{ time testfloat_gen -rminMag $(1) | $$< +rm=1 ; } > $$@ 2>&1
test-v-$(1).min.log: test-$(1)/simv
{ time testfloat_gen -rmin $(1) | $$< +rm=2 ; } > $$@ 2>&1
test-v-$(1).max.log: test-$(1)/simv
{ time testfloat_gen -rmax $(1) | $$< +rm=3 ; } > $$@ 2>&1
$(1)-v: $$(addsuffix .log, $$(addprefix test-v-$(1)., near_even minMag min max))
.PHONY: $(1) $(1)-v
endef
$(foreach test,$(tests),$(eval $(call test_template,$(test))))
all: $(tests)
@ if grep abort test-c-*.*.log; then \
echo "some tests FAILED!!!"; \
exit 1; \
fi
verilog: $(addsuffix -v, $(tests))
@ if grep abort test-v-*.*.log; then \
echo "some tests FAILED!!!"; \
exit 1; \
fi
clean:
rm -rf test* ucli.key
.PHONY: $(tests) clean