-
Notifications
You must be signed in to change notification settings - Fork 6
/
import_all_primitives.sh
executable file
·130 lines (112 loc) · 5.73 KB
/
import_all_primitives.sh
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#!/bin/bash
#
# Helper script which imports all primitives and writes their corresponding
# Racket to racket/generated/.
if [[ -z "${LAKEROAD_DIR}" ]]; then
echo "LAKEROAD_DIR is not set"
exit 1
fi
# We save into $out and then echo $out into a file because just using > causes
# the .rkt file to be emptied out, which then causes Lakeroad's Racket files not
# to load. It's probably due to some incorrect chain of dependencies.
out=$($LAKEROAD_DIR/bin/verilog_to_racket.py \
--infile $LAKEROAD_DIR/modules_for_importing/lattice_ecp5/CCU2C.v \
--top CCU2C \
--function-name lattice-ecp5-ccu2c \
| sed 's#(require (file.*#(require "../signal.rkt\")#' )
echo "$out" > $LAKEROAD_DIR/racket/generated/lattice-ecp5-ccu2c.rkt
out=$($LAKEROAD_DIR/bin/verilog_to_racket.py \
--infile $LAKEROAD_DIR/modules_for_importing/lattice_ecp5/LUT2.v \
--top LUT2 \
--function-name lattice-ecp5-lut2 \
| sed 's#(require (file.*#(require "../signal.rkt\")#' )
echo "$out" > $LAKEROAD_DIR/racket/generated/lattice-ecp5-lut2.rkt
out=$($LAKEROAD_DIR/bin/verilog_to_racket.py \
--infile $LAKEROAD_DIR/modules_for_importing/lattice_ecp5/LUT4.v \
--top LUT4 \
--function-name lattice-ecp5-lut4 \
| sed 's#(require (file.*#(require "../signal.rkt\")#' )
echo "$out" > $LAKEROAD_DIR/racket/generated/lattice-ecp5-lut4.rkt
out=$($LAKEROAD_DIR/bin/verilog_to_racket.py \
--infile $LAKEROAD_DIR/modules_for_importing/SOFA/frac_lut4.v \
--top frac_lut4 \
--function-name sofa-frac-lut4 \
--include $LAKEROAD_DIR/verilog/simulation/skywater \
--define SKY130_FD_SC_HD__UDP_MUX_2TO1_LAKEROAD_HACK \
--define NO_PRIMITIVES \
--define FUNCTIONAL \
| sed 's#(require (file.*#(require "../signal.rkt\")#' )
echo "$out" > $LAKEROAD_DIR/racket/generated/sofa-frac-lut4.rkt
out=$($LAKEROAD_DIR/bin/verilog_to_racket.py \
--infile $LAKEROAD_DIR/modules_for_importing/xilinx_ultrascale_plus/CARRY8.v \
--top CARRY8 \
--function-name xilinx-ultrascale-plus-carry8 \
| sed 's#(require (file.*#(require "../signal.rkt\")#' )
echo "$out" > $LAKEROAD_DIR/racket/generated/xilinx-ultrascale-plus-carry8.rkt
# Note: requires GNU sed. Install with Brew on Mac.
out=$("$LAKEROAD_DIR"/bin/verilog_to_racket.py \
--infile "$LAKEROAD_DIR"/modules_for_importing/xilinx_ultrascale_plus/DSP48E2.v \
--top DSP48E2 \
--define XIL_XECLIB \
--function-name xilinx-ultrascale-plus-dsp48e2 \
| sed 's#(require (file.*#(require "../signal.rkt\")#' \
| sed "s/constant 'unnamed-input-[[:digit:]]\+ (bitvector \([[:digit:]]\+\))/bv 0 \1/" )
echo "$out" > "$LAKEROAD_DIR"/racket/generated/xilinx-ultrascale-plus-dsp48e2.rkt
out=$($LAKEROAD_DIR/bin/verilog_to_racket.py \
--infile $LAKEROAD_DIR/modules_for_importing/xilinx_ultrascale_plus/LUT6_2.v \
--top LUT6_2 \
--function-name xilinx-ultrascale-plus-lut6-2 \
| sed 's#(require (file.*#(require "../signal.rkt\")#' )
echo "$out" > $LAKEROAD_DIR/racket/generated/xilinx-ultrascale-plus-lut6-2.rkt
out=$($LAKEROAD_DIR/bin/verilog_to_racket.py \
--infile $LAKEROAD_DIR/modules_for_importing/xilinx_ultrascale_plus/LUT6.v \
--top LUT6 \
--function-name xilinx-ultrascale-plus-lut6 \
| sed 's#(require (file.*#(require "../signal.rkt\")#' )
echo "$out" > $LAKEROAD_DIR/racket/generated/xilinx-ultrascale-plus-lut6.rkt
if [ -z ${LAKEROAD_PRIVATE_DIR+x} ]; then
echo "not importing modules as LAKEROAD_PRIVATE_DIR is not set"
else
out=$("$LAKEROAD_DIR"/bin/verilog_to_racket.py \
--infile "$LAKEROAD_PRIVATE_DIR"/lattice_ecp5/modified_ALU54B.v \
--top ALU54B \
--function-name lattice-ecp5-alu54b \
| sed 's#(require (file.*#(require "../signal.rkt\")#' )
echo "$out" > "$LAKEROAD_DIR"/racket/generated/lattice-ecp5-alu54b.rkt
out=$("$LAKEROAD_DIR"/bin/verilog_to_racket.py \
--infile "$LAKEROAD_PRIVATE_DIR"/lattice_ecp5/ALU54A_modified_for_racket_import.v \
--top ALU54A \
--function-name lattice-ecp5-alu54a \
| sed 's#(require (file.*#(require "../signal.rkt\")#' )
echo "$out" > "$LAKEROAD_DIR"/racket/generated/lattice-ecp5-alu54a.rkt
out=$("$LAKEROAD_DIR"/bin/verilog_to_racket.py \
--infile "$LAKEROAD_PRIVATE_DIR"/lattice_ecp5/MULT18X18D_modified_for_racket_import.v \
--top MULT18X18D \
--function-name lattice-ecp5-mult18x18d \
| sed 's#(require (file.*#(require "../signal.rkt\")#' )
echo "$out" > "$LAKEROAD_DIR"/racket/generated/lattice-ecp5-mult18x18d.rkt
out=$("$LAKEROAD_DIR"/bin/verilog_to_racket.py \
--infile "$LAKEROAD_PRIVATE_DIR"/lattice_ecp5/MULT18X18C_modified_for_racket_import.v \
--top MULT18X18C \
--function-name lattice-ecp5-mult18x18c \
| sed 's#(require (file.*#(require "../signal.rkt\")#' )
echo "$out" > "$LAKEROAD_DIR"/racket/generated/lattice-ecp5-mult18x18c.rkt
out=$("$LAKEROAD_DIR"/bin/verilog_to_racket.py \
--infile "$LAKEROAD_PRIVATE_DIR"/intel_cyclone10lp/cyclone10lp_mac_mult_modified_for_racket_import.v \
--top cyclone10lp_mac_mult \
--function-name intel-cyclone10lp-mac-mult \
| sed 's#(require (file.*#(require "../signal.rkt\")#' )
echo "$out" > "$LAKEROAD_DIR"/racket/generated/intel-cyclone10lp-mac-mult.rkt
out=$("$LAKEROAD_DIR"/bin/verilog_to_racket.py \
--infile "$LAKEROAD_PRIVATE_DIR"/intel_cyclone10lp/cyclone10lp_mac_mult_modified_for_racket_import.v \
--top cyclone10lp_mac_out \
--function-name intel-cyclone10lp-mac-out \
| sed 's#(require (file.*#(require "../signal.rkt\")#' )
echo "$out" > "$LAKEROAD_DIR"/racket/generated/intel-cyclone10lp-mac-out.rkt
out=$("$LAKEROAD_DIR"/bin/verilog_to_racket.py \
--infile "$LAKEROAD_PRIVATE_DIR"/DSP48E1/DSP48E1_modified_for_racket_import.v \
--top DSP48E1 \
--function-name xilinx-7-series-dsp48e1 \
| sed 's#(require (file.*#(require "../signal.rkt\")#' )
echo "$out" > "$LAKEROAD_DIR"/racket/generated/xilinx-7-series-dsp48e1.rkt
fi