-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathradiant.sh
executable file
·112 lines (99 loc) · 2.84 KB
/
radiant.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
#!/bin/bash
radiantdir="${RADIANTDIR:-$HOME/lscc/radiant/3.0}"
export FOUNDRY="${radiantdir}/ispfpga"
bindir="${radiantdir}/bin/lin64"
LSC_DIAMOND=true
export LSC_DIAMOND
export NEOCAD_MAXLINEWIDTH=32767
export TCL_LIBRARY="${radiantdir}/tcltk/linux/lib/tcl8.6"
export fpgabindir=${FOUNDRY}/bin/lin64
ld_lib_path_orig=$LD_LIBRARY_PATH
export LD_LIBRARY_PATH="${bindir}:${fpgabindir}"
export LM_LICENSE_FILE="${radiantdir}/license/license.dat"
set -ex
V_SUB=${2%.v}
PART=$1
set -- "$1" $V_SUB
EXTRA_BIT_ARGS=
case "${PART}" in
LIFCL-17)
PACKAGE="${DEV_PACKAGE:-CABGA256}"
DEVICE="LIFCL-17"
LSE_ARCH="lifcl"
SPEED_GRADE="${SPEED_GRADE:-7_High-Performance_1.0V}"
;;
LIFCL-40)
PACKAGE="${DEV_PACKAGE:-CABGA400}"
DEVICE="LIFCL-40"
LSE_ARCH="lifcl"
SPEED_GRADE="${SPEED_GRADE:-7_High-Performance_1.0V}"
;;
LFD2NX-40)
PACKAGE="${DEV_PACKAGE:-CABGA256}"
DEVICE="LFD2NX-40"
LSE_ARCH="lfd2nx"
SPEED_GRADE="${SPEED_GRADE:-7_High-Performance_1.0V}"
;;
LFCPNX-100)
PACKAGE="${DEV_PACKAGE:-LFG672}"
DEVICE="LFCPNX-100"
LSE_ARCH="lfcpnx"
EXTRA_BIT_ARGS="-ipeval"
SPEED_GRADE="${SPEED_GRADE:-7_High-Performance_1.0V}"
;;
esac
SCRIPT_PATH=$(readlink -f "${BASH_SOURCE:-$0}")
SCRIPT_DIR=$(dirname "$SCRIPT_PATH")
bscache=${BITSTREAM_CACHE:-$SCRIPT_DIR/tools/bitstreamcache.py}
(
rm -rf "$2.tmp"
mkdir -p "$2.tmp"
cp "$2.v" "$2.tmp/input.v"
MAYBE_PDC=""
if [ -e "$2.pdc" ]; then cp "$2.pdc" "$2.tmp/input.pdc"; MAYBE_PDC="$2.tmp/input.pdc"; fi
if ([ -z "$FORCE_REBUILD"] && (LD_LIBRARY_PATH=$ld_lib_path_orig $bscache fetch $PART "$2.tmp" "$2.tmp/input.v" $MAYBE_PDC)); then
# Cache hit
echo "Cache hit, not running Radiant"
else
# Cache miss
cd "$2.tmp"
if [ -n "$STRUCT_VER" ]; then
"$fpgabindir"/sv2udb -o par.udb input.v
else
"$fpgabindir"/synthesis -a "$LSE_ARCH" -p "$DEVICE" -t "$PACKAGE" \
-use_io_insertion 1 -use_io_reg auto -use_carry_chain 1 \
-ver input.v \
-output_hdl synth.vm
"$fpgabindir"/postsyn -a "$LSE_ARCH" -p "$DEVICE" -t "$PACKAGE" -sp "$SPEED_GRADE" \
-top -w -o synth.udb synth.vm
if [ -e input.pdc ]; then
MAP_PDC="input.pdc"
else
MAP_PDC=""
fi
"$fpgabindir"/map -o map.udb synth.udb $MAP_PDC
"$fpgabindir"/par map.udb par.udb
fi
if [ -n "$GEN_RBF" ]; then
"$fpgabindir"/bitgen $EXTRA_BIT_ARGS -b -d -w par.udb
LD_LIBRARY_PATH=$ld_lib_path_orig $bscache commit $PART "input.v" $MAP_PDC output "par.udb" "par.rbt"
else
if [ -n "$RBK_MODE" ]; then
"$fpgabindir"/bitgen $EXTRA_BIT_ARGS -d -w -m 1 par.udb
mv par.rbk par.bit
else
"$fpgabindir"/bitgen $EXTRA_BIT_ARGS -d -w par.udb
fi
LD_LIBRARY_PATH=$ld_lib_path_orig $bscache commit $PART "input.v" $MAP_PDC output "par.udb" "par.bit"
fi
export LD_LIBRARY_PATH=""
fi
)
if [ -n "$GEN_RBF" ]; then
cp "$2.tmp"/par.rbt "$2.rbt"
else
cp "$2.tmp"/par.bit "$2.bit"
fi
if [ -n "$DO_UNPACK" ]; then
prjoxide unpack "$2.bit" "$2.fasm"
fi