Skip to content

Commit

Permalink
Merged latest master. Signed-off-by: Andy Fox <[email protected]>
Browse files Browse the repository at this point in the history
Signed-off-by: andyfox-rushc <[email protected]>
  • Loading branch information
andyfox-rushc committed Sep 6, 2024
2 parents f04933b + 9c48043 commit 1621933
Show file tree
Hide file tree
Showing 143 changed files with 63,106 additions and 6,275 deletions.
55 changes: 43 additions & 12 deletions etc/DependencyInstaller.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ _installCommonDev() {
cmakeBin=${cmakePrefix}/bin/cmake
if [[ ! -f ${cmakeBin} || -z $(${cmakeBin} --version | grep ${cmakeVersionBig}) ]]; then
cd "${baseDir}"
wget https://cmake.org/files/v${cmakeVersionBig}/cmake-${cmakeVersionSmall}-${osName}-${arch}.sh
eval wget https://cmake.org/files/v${cmakeVersionBig}/cmake-${cmakeVersionSmall}-${osName}-${arch}.sh
md5sum -c <(echo "${cmakeChecksum} cmake-${cmakeVersionSmall}-${osName}-${arch}.sh") || exit 1
chmod +x cmake-${cmakeVersionSmall}-${osName}-${arch}.sh
./cmake-${cmakeVersionSmall}-${osName}-${arch}.sh --skip-license --prefix=${cmakePrefix}
Expand All @@ -108,15 +108,15 @@ _installCommonDev() {
if [[ ! -f ${swigBin} || -z $(${swigBin} -version | grep ${swigVersion}) ]]; then
cd "${baseDir}"
tarName="v${swigVersion}.tar.gz"
wget https://github.com/swig/swig/archive/${tarName}
eval wget https://github.com/swig/swig/archive/${tarName}
md5sum -c <(echo "${swigChecksum} ${tarName}") || exit 1
tar xfz ${tarName}
cd swig-${tarName%%.tar*} || cd swig-${swigVersion}

# Check if pcre2 is installed
if [[ -z $(pcre2-config --version) ]]; then
tarName="pcre2-${pcreVersion}.tar.gz"
wget https://github.com/PCRE2Project/pcre2/releases/download/pcre2-${pcreVersion}/${tarName}
eval wget https://github.com/PCRE2Project/pcre2/releases/download/pcre2-${pcreVersion}/${tarName}
md5sum -c <(echo "${pcreChecksum} ${tarName}") || exit 1
./Tools/pcre-build.sh
fi
Expand All @@ -133,8 +133,8 @@ _installCommonDev() {
if [[ -z $(grep "BOOST_LIB_VERSION \"${boostVersionBig//./_}\"" ${boostPrefix}/include/boost/version.hpp) ]]; then
cd "${baseDir}"
boostVersionUnderscore=${boostVersionSmall//./_}
wget https://sourceforge.net/projects/boost/files/boost/${boostVersionSmall}/boost_${boostVersionUnderscore}.tar.gz
# wget https://boostorg.jfrog.io/artifactory/main/release/${boostVersionSmall}/source/boost_${boostVersionUnderscore}.tar.gz
eval wget https://sourceforge.net/projects/boost/files/boost/${boostVersionSmall}/boost_${boostVersionUnderscore}.tar.gz
# eval wget https://boostorg.jfrog.io/artifactory/main/release/${boostVersionSmall}/source/boost_${boostVersionUnderscore}.tar.gz
md5sum -c <(echo "${boostChecksum} boost_${boostVersionUnderscore}.tar.gz") || exit 1
tar -xf boost_${boostVersionUnderscore}.tar.gz
cd boost_${boostVersionUnderscore}
Expand Down Expand Up @@ -208,7 +208,7 @@ _installCommonDev() {
gtestPrefix=${PREFIX:-"/usr/local"}
if [[ ! -d ${gtestPrefix}/include/gtest ]]; then
cd "${baseDir}"
wget https://github.com/google/googletest/archive/refs/tags/v${gtestVersion}.zip
eval wget https://github.com/google/googletest/archive/refs/tags/v${gtestVersion}.zip
md5sum -c <(echo "${gtestChecksum} v${gtestVersion}.zip") || exit 1
unzip v${gtestVersion}.zip
cd googletest-${gtestVersion}
Expand All @@ -230,7 +230,7 @@ _installCommonDev() {
ninjaBin=${ninjaPrefix}/bin/ninja
if [[ ! -d ${ninjaBin} ]]; then
cd "${baseDir}"
wget -O ninja-linux.zip https://github.com/ninja-build/ninja/releases/download/v${ninjaVersion}/ninja-linux.zip
eval wget -O ninja-linux.zip https://github.com/ninja-build/ninja/releases/download/v${ninjaVersion}/ninja-linux.zip
md5sum -c <(echo "${ninjaCheckSum} ninja-linux.zip") || exit 1
unzip -o ninja-linux.zip -d ${ninjaPrefix}/bin/
chmod +x ${ninjaBin}
Expand Down Expand Up @@ -282,8 +282,11 @@ _installOrTools() {
echo "OR-Tools is already installed"
fi
else
if [[ $version == rodete ]]; then
version=11
fi
orToolsFile=or-tools_${arch}_${os}-${version}_cpp_v${orToolsVersionSmall}.tar.gz
wget https://github.com/google/or-tools/releases/download/v${orToolsVersionBig}/${orToolsFile}
eval wget https://github.com/google/or-tools/releases/download/v${orToolsVersionBig}/${orToolsFile}
orToolsPath=${PREFIX:-"/opt/or-tools"}
if command -v brew &> /dev/null; then
orToolsPath="$(brew --prefix or-tools)"
Expand Down Expand Up @@ -423,7 +426,7 @@ _installRHELPackages() {
http://repo.okay.com.mx/centos/8/x86_64/release/bison-3.0.4-10.el8.x86_64.rpm \
https://forensics.cert.org/centos/cert/7/x86_64/flex-2.6.1-9.el7.x86_64.rpm

wget https://github.com/jgm/pandoc/releases/download/${version}/pandoc-${version}-linux-${arch}.tar.gz
eval wget https://github.com/jgm/pandoc/releases/download/${version}/pandoc-${version}-linux-${arch}.tar.gz
tar xvzf pandoc-${version}-linux-${arch}.tar.gz --strip-components 1 -C /usr/local/
rm -rf pandoc-${version}-linux-${arch}.tar.gz
}
Expand Down Expand Up @@ -587,6 +590,11 @@ _installDebianPackages() {
export DEBIAN_FRONTEND="noninteractive"
apt-get -y update
apt-get -y install --no-install-recommends tzdata
if [[ $1 == rodete ]]; then
tclver=8.6
else
tclver=
fi
apt-get -y install --no-install-recommends \
automake \
autotools-dev \
Expand All @@ -607,7 +615,7 @@ _installDebianPackages() {
libpcre2-dev \
libpcre3-dev \
libreadline-dev \
libtcl \
libtcl${tclver} \
pandoc \
python3-dev \
qt5-image-formats-plugins \
Expand All @@ -623,8 +631,13 @@ _installDebianPackages() {
qt5-default

else
if [[ $1 == rodete ]]; then
pythonver=3.12
else
pythonver=3.8
fi
apt-get install -y --no-install-recommends \
libpython3.8 \
libpython${pythonver} \
qtbase5-dev \
qtchooser \
qt5-qmake \
Expand All @@ -642,6 +655,14 @@ _installCI() {
parallel \
software-properties-common

if command -v docker &> /dev/null; then
# The user can uninstall docker if they want to reinstall it,
# and also this allows the user to choose drop in replacements
# for docker, such as podman-docker
echo "Docker is already installed, skip docker reinstall."
return 0
fi

# Add Docker's official GPG key:
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg \
Expand Down Expand Up @@ -698,6 +719,8 @@ Usage: $0
# sudo or with root access.
$0 -ci
# Installs dependencies required to run CI
$0 -nocert
# Disable certificate checks
EOF
exit "${1:-1}"
Expand Down Expand Up @@ -760,6 +783,11 @@ while [ "$#" -gt 0 ]; do
fi
export PREFIX="$(realpath $(echo $1 | sed -e 's/^[^=]*=//g'))"
;;
-nocert)
shopt -s expand_aliases
alias wget="wget --no-check-certificate"
export GIT_SSL_NO_VERIFY=true
;;
*)
echo "unknown option: ${1}" >&2
_help
Expand Down Expand Up @@ -880,8 +908,11 @@ To enable GCC-11 you need to run:
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-11 50
EOF
;;
"Debian GNU/Linux" )
"Debian GNU/Linux" | "Debian GNU/Linux rodete" )
version=$(awk -F= '/^VERSION_ID/{print $2}' /etc/os-release | sed 's/"//g')
if [[ -z ${version} ]]; then
version=$(awk -F= '/^VERSION_CODENAME/{print $2}' /etc/os-release | sed 's/"//g')
fi
if [[ ${CI} == "yes" ]]; then
echo "WARNING: Installing CI dependencies is only supported on Ubuntu 22.04" >&2
fi
Expand Down
2 changes: 2 additions & 0 deletions include/ord/Design.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,9 @@ class Design
bool child = false);
void link(const std::string& design_name);

void readDb(std::istream& stream);
void readDb(const std::string& file_name);
void writeDb(std::ostream& stream);
void writeDb(const std::string& file_name);
void writeDef(const std::string& file_name);

Expand Down
2 changes: 2 additions & 0 deletions include/ord/OpenRoad.hh
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,9 @@ class OpenRoad
// to notify the tools (eg dbSta, gui).
void designCreated();

void readDb(std::istream& stream);
void readDb(const char* filename);
void writeDb(std::ostream& stream);
void writeDb(const char* filename);

void diffDbs(const char* filename1, const char* filename2, const char* diffs);
Expand Down
12 changes: 12 additions & 0 deletions src/Design.cc
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,24 @@ void Design::link(const std::string& design_name)
app->linkDesign(design_name.c_str(), false);
}

void Design::readDb(std::istream& stream)
{
auto app = OpenRoad::openRoad();
app->readDb(stream);
}

void Design::readDb(const std::string& file_name)
{
auto app = OpenRoad::openRoad();
app->readDb(file_name.c_str());
}

void Design::writeDb(std::ostream& stream)
{
auto app = OpenRoad::openRoad();
app->writeDb(stream);
}

void Design::writeDb(const std::string& file_name)
{
auto app = OpenRoad::openRoad();
Expand Down
25 changes: 18 additions & 7 deletions src/OpenRoad.cc
Original file line number Diff line number Diff line change
Expand Up @@ -438,28 +438,39 @@ void OpenRoad::writeCdl(const char* outFilename,
}

void OpenRoad::readDb(const char* filename)
{
std::ifstream stream;
stream.open(filename, std::ios::binary);
try {
readDb(stream);
} catch (const std::ios_base::failure& f) {
logger_->error(ORD, 54, "odb file {} is invalid: {}", filename, f.what());
}
}

void OpenRoad::readDb(std::istream& stream)
{
if (db_->getChip() && db_->getChip()->getBlock()) {
logger_->error(
ORD, 47, "You can't load a new db file as the db is already populated");
}

std::ifstream stream;
stream.exceptions(std::ifstream::failbit | std::ifstream::badbit
| std::ios::eofbit);
stream.open(filename, std::ios::binary);

try {
db_->read(stream);
} catch (const std::ios_base::failure& f) {
logger_->error(ORD, 54, "odb file {} is invalid: {}", filename, f.what());
}
db_->read(stream);

for (OpenRoadObserver* observer : observers_) {
observer->postReadDb(db_);
}
}

void OpenRoad::writeDb(std::ostream& stream)
{
stream.exceptions(std::ofstream::failbit | std::ofstream::badbit);
db_->write(stream);
}

void OpenRoad::writeDb(const char* filename)
{
utl::StreamHandler stream_handler(filename, true);
Expand Down
4 changes: 2 additions & 2 deletions src/ant/include/ant/AntennaChecker.hh
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,10 @@ struct Violation
using LayerToNodeInfo = std::map<odb::dbTechLayer*, NodeInfo>;
using GraphNodes = std::vector<std::unique_ptr<GraphNode>>;
using LayerToGraphNodes = std::unordered_map<odb::dbTechLayer*, GraphNodes>;
using GateToLayerToNodeInfo = std::map<std::string, LayerToNodeInfo>;
using GateToLayerToNodeInfo = std::map<odb::dbITerm*, LayerToNodeInfo>;
using Violations = std::vector<Violation>;
using GateToViolationLayers
= std::unordered_map<std::string, std::unordered_set<odb::dbTechLayer*>>;
= std::unordered_map<odb::dbITerm*, std::unordered_set<odb::dbTechLayer*>>;

class AntennaChecker
{
Expand Down
35 changes: 22 additions & 13 deletions src/ant/src/AntennaChecker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,10 @@ void AntennaChecker::calculateAreas(const LayerToGraphNodes& node_by_layer_map,
if (!gate.isITerm) {
continue;
}
info.iterms.push_back(gate.iterm);

if (isValidGate(gate.iterm->getMTerm())) {
info.iterms.push_back(gate.iterm);
}
info.iterm_gate_area += gateArea(gate.iterm->getMTerm());
info.iterm_diff_area += diffArea(gate.iterm->getMTerm());
gates_count++;
Expand All @@ -463,10 +466,11 @@ void AntennaChecker::calculateAreas(const LayerToGraphNodes& node_by_layer_map,
continue;
}
// check if has another node with gate in the layer, then merge area
if (gate_info[gate.name].find(it.first) != gate_info[gate.name].end()) {
gate_info[gate.name][it.first] += info;
if (gate_info[gate.iterm].find(it.first)
!= gate_info[gate.iterm].end()) {
gate_info[gate.iterm][it.first] += info;
} else {
gate_info[gate.name][it.first] = info;
gate_info[gate.iterm][it.first] = info;
}
}
}
Expand Down Expand Up @@ -772,7 +776,11 @@ int AntennaChecker::checkGates(odb::dbNet* db_net,
for (const auto& [node, layer_to_node] : gate_info) {
bool pin_has_violation = false;

std::string pin_name = fmt::format(" Pin: {}", node);
odb::dbMTerm* mterm = node->getMTerm();
std::string pin_name = fmt::format(" Pin: {}/{} ({})",
node->getInst()->getConstName(),
mterm->getConstName(),
mterm->getMaster()->getConstName());
net_to_report_.at(db_net).report += pin_name + "\n";

for (const auto& [layer, node_info] : layer_to_node) {
Expand All @@ -798,7 +806,7 @@ int AntennaChecker::checkGates(odb::dbNet* db_net,
net_to_report_.at(db_net).report += "\n";
}

std::unordered_map<odb::dbTechLayer*, std::unordered_set<std::string>>
std::unordered_map<odb::dbTechLayer*, std::unordered_set<odb::dbITerm*>>
pin_added;
// if checkGates is used by repair antennas
if (pin_violation_count > 0) {
Expand Down Expand Up @@ -862,14 +870,14 @@ int AntennaChecker::checkGates(odb::dbNet* db_net,
}
}
}
// save the iterms of repaired node
for (const auto& iterm_iter : gates) {
pin_added[violation_layer].insert(iterm_iter->getName());
}
pin_added[violation_layer].insert(gate);
std::vector<odb::dbITerm*> gates_for_diode_insertion;
gates_for_diode_insertion.push_back(gate);
// save antenna violation
if (violated) {
antenna_violations.push_back(
{layer->getRoutingLevel(), gates, diode_count_per_gate});
antenna_violations.push_back({layer->getRoutingLevel(),
gates_for_diode_insertion,
diode_count_per_gate});
}

bool car_violation
Expand All @@ -882,7 +890,7 @@ int AntennaChecker::checkGates(odb::dbNet* db_net,
// best approach. as a first implementation, insert one diode per net.
// TODO: implement a proper approach for CAR violations
if (car_violation || csr_violation) {
std::vector<odb::dbITerm*> gates_for_diode_insertion;
gates_for_diode_insertion.clear();
for (auto gate : gates) {
odb::dbMaster* gate_master = gate->getMTerm()->getMaster();
if (gate_master->getType()
Expand Down Expand Up @@ -1042,6 +1050,7 @@ int AntennaChecker::checkAntennas(odb::dbNet* net,
const int num_threads,
bool verbose)
{
net_to_report_.clear();
initAntennaRules();

std::ofstream report_file;
Expand Down
Loading

0 comments on commit 1621933

Please sign in to comment.