-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathenv.sh
More file actions
69 lines (58 loc) · 1.51 KB
/
env.sh
File metadata and controls
69 lines (58 loc) · 1.51 KB
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
set -e
export XS_PROJECT_ROOT=$(dirname $(realpath ${BASH_SOURCE[0]:-$0}))
# submodule
export NEMU_HOME=${XS_PROJECT_ROOT}/NEMU
export AM_HOME=${XS_PROJECT_ROOT}/nexus-am
export NOOP_HOME=${XS_PROJECT_ROOT}/XiangShan
export DRAMSIM3_HOME=${XS_PROJECT_ROOT}/DRAMsim3
export GEM5_HOME=${XS_PROJECT_ROOT}/GEM5
export GEM5_DATA_PROC_HOME=${XS_PROJECT_ROOT}/gem5_data_proc
export TLT_HOME=${XS_PROJECT_ROOT}/tl-test-new
# assets and workdir
export ASSETS_DIR=${XS_PROJECT_ROOT}/assets
export WORK_DIR=${XS_PROJECT_ROOT}/work
function get_asset() {
local ASSET=$1
local BUILT=$2
local FOLDER=${ASSET%%/*}
local FILE=
[[ "$ASSET" == */* ]] && FILE=${ASSET#*/}
if [ -n "${BUILT}" ] && [ -e "${BUILT}" ]; then
echo "${BUILT}"
return
fi
if [ -e "${ASSETS_DIR}/${ASSET}" ]; then
echo "${ASSETS_DIR}/${ASSET}"
return
fi
echo "Asset ${ASSET} not found, downloading..." >&2
bash ${XS_PROJECT_ROOT}/download_assets.sh ${FOLDER} >&2
if [ $? -ne 0 ]; then
echo "Failed to download asset ${FOLDER}" >&2
exit 1
fi
echo "${ASSETS_DIR}/${ASSET}"
}
# override tail for jupyter-rise
export _tail=$(which tail)
function tail() {
$_tail "$@" | while IFS= read -r line; do
echo "$line"
sleep 0.01
done
}
# override head for jupyuter-rise
export _head=$(which head)
function head() {
$_head "$@" | while IFS= read -r line; do
echo "$line"
sleep 0.01
done
}
# output buffer for jupyter-rise
function outputBuffer() {
while IFS= read -r line; do
echo "$line"
sleep 0.01
done
}