forked from pulp-platform/croc
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathenv.sh
More file actions
91 lines (81 loc) · 2.55 KB
/
env.sh
File metadata and controls
91 lines (81 loc) · 2.55 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/bin/bash
# Copyright (c) 2024 ETH Zurich and University of Bologna.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
#
# Environment setup for Croc SoC ASIC flow
# This file is sourced by all scripts to set up tool paths and PDK location
# Determine repository root
if [[ -n "${BASH_SOURCE[0]}" ]]; then
export CROC_ROOT=$(realpath $(dirname "${BASH_SOURCE[0]}"))
else
export CROC_ROOT=$(pwd)
fi
################
## Tool Paths ##
################
export BENDER="${BENDER:-bender}"
export PYTHON3="${PYTHON3:-python3}"
export YOSYS="${YOSYS:-yosys}"
export OPENROAD="${OPENROAD:-openroad}"
export KLAYOUT="${KLAYOUT:-klayout}"
export VERILATOR="${VERILATOR:-/foss/tools/bin/verilator}"
export VSIM="${VSIM:-vsim}"
################
## PDK Discovery (priority: PDK_ROOT → technology/ → ihp13/pdk/)
################
if [[ -z "${PDK_ROOT:-}" ]]; then
if [[ -d "${CROC_ROOT}/technology" ]]; then
export PDK_ROOT="${CROC_ROOT}/technology"
elif [[ -d "${CROC_ROOT}/ihp13/pdk" ]]; then
export PDK_ROOT="${CROC_ROOT}/ihp13/pdk"
else
echo "[WARNING] PDK not found. Set PDK_ROOT or ensure ihp13/pdk/ exists"
export PDK_ROOT="" # Set to empty to avoid unbound variable error
fi
else
# PDK_ROOT was already set, export it to ensure it's available
export PDK_ROOT
fi
################
## Project Settings ##
################
export PROJ_NAME="${PROJ_NAME:-croc}"
export TOP_DESIGN="${TOP_DESIGN:-croc_chip}"
export DUT_DESIGN="${DUT_DESIGN:-croc_soc}"
################
## Directory Structure ##
################
# Yosys
export YOSYS_DIR="${CROC_ROOT}/yosys"
export YOSYS_OUT="${YOSYS_DIR}/out"
export YOSYS_REPORTS="${YOSYS_DIR}/reports"
export YOSYS_TMP="${YOSYS_DIR}/tmp"
# OpenROAD
export OR_DIR="${CROC_ROOT}/openroad"
export OR_OUT="${OR_DIR}/out"
export OR_REPORTS="${OR_DIR}/reports"
export OR_SAVE="${OR_DIR}/save"
# KLayout
export KLAYOUT_DIR="${CROC_ROOT}/klayout"
# Software
export SW_DIR="${CROC_ROOT}/sw"
export SW_BIN="${SW_DIR}/bin"
################
## Netlist Paths ##
################
export NETLIST="${YOSYS_OUT}/${TOP_DESIGN}_yosys.v"
export NETLIST_DEBUG="${YOSYS_OUT}/${TOP_DESIGN}_yosys_debug.v"
################
## PDK Paths (derived from PDK_ROOT) ##
################
# Check if using ETHZ DZ cockpit or GitHub PDK
if [[ -d "${CROC_ROOT}/technology" ]]; then
# ETHZ DZ cockpit layout
export PDK_VARIANT="ethz_cockpit"
export PDK="${PDK_ROOT}"
else
# GitHub PDK layout
export PDK_VARIANT="github"
export PDK="${PDK_ROOT}/ihp-sg13g2"
fi