forked from lowRISC/lowrisc-chip
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefrag-build
39 lines (32 loc) · 1.45 KB
/
Makefrag-build
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
# See LICENSE for license details.
#--------------------------------------------------------------------
# Build Verilog
#--------------------------------------------------------------------
$(generated_dir)/$(MODEL).$(CONFIG).sv: $(chisel_srcs)
cd $(base_dir) && mkdir -p $(generated_dir) && $(SBT) "run $(CHISEL_ARGS) --configDump --noInlineMem"
cd $(generated_dir) && \
if [ -a $(MODEL).$(CONFIG).conf ]; then \
$(mem_gen) $(generated_dir)/$(MODEL).$(CONFIG).conf >> $(generated_dir)/$(MODEL).$(CONFIG).sv; \
fi
$(generated_dir)/consts.vh: $(generated_dir)/$(MODEL).$(CONFIG).sv
echo "\`ifndef CONST_VH" > $@
echo "\`define CONST_VH" >> $@
sed -r 's/\(([A-Za-z0-9_]+),([A-Za-z0-9_]+)\)/ `define \1 \2/' \
$(generated_dir)/$(MODEL).$(CONFIG).prm >> $@
echo "\`endif // CONST_VH" >> $@
$(generated_dir)/dev_map.vh: $(generated_dir)/$(MODEL).$(CONFIG).sv
echo "\`ifndef DEV_MAP_VH" > $@
echo "\`define DEV_MAP_VH" >> $@
sed -r 's/#define ([A-Za-z0-9_]+) 0x([A-Za-z0-9_]+)/ `define \1 '\''h\2/' \
$(generated_dir)/$(MODEL).$(CONFIG).dev_map.h >> $@
echo "\`endif // DEV_MAP_VH" >> $@
$(generated_dir)/dev_map.h: $(generated_dir)/$(MODEL).$(CONFIG).sv
echo "#ifndef DEV_MAP_HEADER" > $@
echo "#define DEV_MAP_HEADER" >> $@
sed -r 's/#define ([A-Za-z0-9_]+) 0x([A-Za-z0-9_]+)/ #define \1 0x\2llu/' \
$(generated_dir)/$(MODEL).$(CONFIG).dev_map.h >> $@
echo "#endif // DEV_MAP_HEADER" >> $@
# emacs local variable
# Local Variables:
# mode: makefile
# End: