Skip to content

Commit

Permalink
Merge branch 'main' of github.com:siliconcompiler/siliconcompiler int…
Browse files Browse the repository at this point in the history
…o tasks
  • Loading branch information
aolofsson committed Jan 17, 2023
2 parents 70106dc + d3ff33d commit dad088f
Show file tree
Hide file tree
Showing 33 changed files with 809 additions and 479 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/bin/install_surelog_macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@
pip3 install orderedmultidict

# Install Surelog
git submodule update --init --recursive third_party/tools/surelog
cd third_party/tools/surelog
git clone $(python3 setup/_tools.py --tool surelog --field git-url) surelog
cd surelog
git checkout $(python3 setup/_tools.py --tool surelog --field git-commit)
git submodule update --init --recursive

export ADDITIONAL_CMAKE_OPTIONS=-DPython3_ROOT_DIR=${pythonLocation}
make
make install PREFIX=$GITHUB_WORKSPACE/siliconcompiler/tools/surelog
9 changes: 7 additions & 2 deletions .github/workflows/bin/install_surelog_win.bat
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,13 @@ where ninja && ninja --version
:: Required for Surelog
pip3 install orderedmultidict

git submodule update --init --recursive third_party/tools/surelog
chdir third_party/tools/surelog
for /f "tokens=* USEBACKQ" %%i in (`python3 setup/_tools.py --tool surelog --field git-url`) do set GITURL=%%i
for /f "tokens=* USEBACKQ" %%i in (`python3 setup/_tools.py --tool surelog --field git-commit`) do set GITCOMMIT=%%i

git clone %GITURL%
cd Surelog
git checkout %GITCOMMIT%
git submodule update --init --recursive

make
make install
6 changes: 4 additions & 2 deletions .github/workflows/bin/setup_wheel_env_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ rpm -i klayout-0.27.5-0.x86_64.rpm
pip3 install orderedmultidict

# Build surelog (install prefix defined outside file)
git submodule update --init --recursive third_party/tools/surelog
cd third_party/tools/surelog
git clone $(python3 setup/_tools.py --tool surelog --field git-url) surelog
cd surelog
git checkout $(python3 setup/_tools.py --tool surelog --field git-commit)
git submodule update --init --recursive

export LDFLAGS="-lrt"
make
Expand Down
17 changes: 9 additions & 8 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Get Surelog version
id: get-surelog
run: |
echo "::set-output name=version::$(git rev-parse HEAD:third_party/tools/surelog)"
echo "version=$(python3 setup/_tools.py --tool surelog --field git-commit)" >> $GITHUB_OUTPUT
- uses: actions/cache@v2
id: surelog-cache
Expand Down Expand Up @@ -59,6 +59,11 @@ jobs:
if: matrix.os == 'macos-latest'
run: |
brew install graphviz
brew install bison
# https://github.com/The-OpenROAD-Project/OpenROAD/issues/1688
echo "/usr/local/opt/bison/bin" >> $GITHUB_PATH
brew install flex
echo "/usr/local/opt/flex/bin" >> $GITHUB_PATH
brew install --cask klayout
# https://github.com/ponty/PyVirtualDisplay/blob/master/.github/workflows/main.yml#L45
brew install --cask xquartz
Expand All @@ -77,16 +82,12 @@ jobs:

- uses: pypa/cibuildwheel@v2.1.1
env:
# Hack: LEF parser build is broken for currently bundled version of
# OpenROAD, so check out old version.
CIBW_BEFORE_ALL: >
git -C {package} submodule update --init --recursive third_party/tools/openroad &&
cd {package}/third_party/tools/openroad &&
git checkout 3be623 &&
git submodule update --init --recursive
CIBW_BEFORE_ALL_LINUX: >
export PREFIX={package}/siliconcompiler/tools/surelog &&
{package}/.github/workflows/bin/setup_wheel_env_linux.sh
CIBW_ENVIRONMENT_MACOS: >
LDFLAGS="-L/usr/local/opt/bison/lib -L/usr/local/opt/flex/lib"
CPPFLAGS="-I/usr/local/opt/flex/include"
CIBW_ENVIRONMENT_WINDOWS: SC_CMAKEARGS="-DCMAKE_TOOLCHAIN_FILE=$VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake."
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
CIBW_SKIP: "pp* *win32 *i686"
Expand Down
6 changes: 0 additions & 6 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,3 @@
[submodule "third_party/designs/OPBD"]
path = third_party/designs/OPBD
url = https://github.com/PrincetonUniversity/OPDB
[submodule "third_party/tools/openroad"]
path = third_party/tools/openroad
url = https://github.com/The-OpenROAD-Project/OpenROAD-flow-scripts.git
[submodule "third_party/tools/surelog"]
path = third_party/tools/surelog
url = https://github.com/chipsalliance/Surelog.git
22 changes: 21 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,25 @@ set(CMAKE_CXX_EXTENSIONS OFF)
find_package(PythonExtensions REQUIRED)
find_package(Cython REQUIRED)

execute_process(
COMMAND python3 ${CMAKE_CURRENT_LIST_DIR}/setup/_tools.py --tool openroad --field git-url
OUTPUT_VARIABLE openroad_URL
)
string(STRIP ${openroad_URL} openroad_URL)
execute_process(
COMMAND python3 ${CMAKE_CURRENT_LIST_DIR}/setup/_tools.py --tool openroad --field git-commit
OUTPUT_VARIABLE openroad_COMMIT
)
string(STRIP ${openroad_COMMIT} openroad_COMMIT)

include(FetchContent)
FetchContent_Declare(openroad
GIT_REPOSITORY ${openroad_URL}
GIT_TAG ${openroad_COMMIT}
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
)

# Needed to find *.pxd file
include_directories(${CMAKE_CURRENT_LIST_DIR}/siliconcompiler/leflib)

Expand Down Expand Up @@ -39,8 +58,9 @@ if(NOT WIN32)
target_compile_options(_leflib PRIVATE -Wall -Werror -Wno-error=deprecated-declarations)
endif()

FetchContent_Populate(openroad)
# Stuff to include Si2 LEF library
set(LEF_DIR ${CMAKE_CURRENT_LIST_DIR}/third_party/tools/openroad/tools/OpenROAD/src/odb/src/lef)
set(LEF_DIR ${openroad_SOURCE_DIR}/src/odb/src/lef)

# this lets us include lef headers
include_directories(${LEF_DIR}/lef)
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ To install the project from source (recommended for developers only).
```bash
git clone https://github.com/siliconcompiler/siliconcompiler
cd siliconcompiler
git submodule update --init --recursive third_party/tools/openroad
pip install -r requirements.txt
python -m pip install -e .
```
Expand All @@ -101,7 +100,7 @@ python -m pip install -e .

Installation instructions for all external tools can be found in the
[Tools](https://docs.siliconcompiler.com/en/latest/reference_manual/tools.html) section
of the reference manual. We have included shell setup scripts (Ubuntu) for most of the supported tools. See the [./setup](./setup) directory for a complete set of scripts.
of the reference manual. We have included shell setup scripts (Ubuntu) for most of the supported tools. See the [./setup](./setup) directory for a complete set of scripts and [./setup/_tools.json](./setup/_tools.json) for the currently recommended tool versions.

# Contributing

Expand Down
3 changes: 1 addition & 2 deletions examples/blinky/run.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/usr/bin/env bash

sc -input "rtl verilog blinky.v" \
-input "fpga pcf icebreaker.pcf" \
sc blinky.v icebreaker.pcf \
-fpga_partname "ice40up5k-sg48" \
-target "fpgaflow_demo" \
-design "blinky"
3 changes: 1 addition & 2 deletions examples/blinky/run_vivado.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#!/usr/bin/env bash

sc -input "rtl verilog blinky_fusesoc.v" \
sc blinky_fusesoc.v blinky_fusesoc.xdc \
-fpga_partname "xc7a35ticsg324" \
-target "fpgaflow_demo" \
-relax \
-input "fpga xdc blinky_fusesoc.xdc" \
-design "blinky"
4 changes: 0 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,6 @@ def parse_reqs():

return install_reqs, extras_reqs

OR_SUBMOD = 'third_party/tools/openroad'
if not on_rtd and not os.listdir(OR_SUBMOD):
subprocess.run(['git', 'submodule', 'update', '--init', '--recursive', OR_SUBMOD])

# Let us pass in generic arguments to CMake via an environment variable, since
# our automated build servers need to pass in a certain argument when building
# wheels on Windows.
Expand Down
14 changes: 14 additions & 0 deletions setup/_tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"openroad": {
"git-url": "https://github.com/The-OpenROAD-Project/OpenROAD.git",
"git-commit": "5e7c6c4294ca9e337d8aa6270e503ff9cf6a8f5c"
},
"yosys": {
"git-url": "https://github.com/YosysHQ/yosys.git",
"git-commit": "956c4e485a9463863f60c4dd03372db3fa8332a4"
},
"surelog": {
"git-url": "https://github.com/chipsalliance/Surelog.git",
"git-commit": "ad83eedc7de32ec15a3f7b4e271c6b45ddf547eb"
}
}
66 changes: 66 additions & 0 deletions setup/_tools.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#!/usr/bin/env python3
# Copyright 2023 Silicon Compiler Authors. All Rights Reserved.

import argparse
import json
import os

def bump_commit(tools, tool):
if "git-url" not in tools[tool]:
return None

import git, tempfile

with tempfile.TemporaryDirectory(prefix=tool) as repo_work_dir:
repo = git.Repo.clone_from(tools[tool]["git-url"], repo_work_dir)

return repo.head.commit.hexsha

return None

if __name__ == "__main__":
tools = None
data_file = os.path.join(os.path.dirname(__file__), "_tools.json")
with open(data_file, "r") as f:
tools = json.load(f)

supported_tools = ", ".join(tools.keys())
supported_fields = set()
for tool, fields in tools.items():
for field in fields:
supported_fields.add(field)
supported_fields = ", ".join(supported_fields)

parser = argparse.ArgumentParser(
prog = "SiliconCompiler Tool Helper",
description = "Maintains current known good versions for all install scripts to use")
parser.add_argument("--tool", type=str, required=True, help=f"Tool name, supported options: {supported_tools}")
group = parser.add_mutually_exclusive_group(required=True)
group.add_argument("--field", type=str, help=f"Field to get information from, supported options: {supported_fields}")
group.add_argument("--bump_commit", action="store_true", help="Flag to indicate that the speficied tool should be updated.")

args = parser.parse_args()

if args.tool not in tools:
print(f"{args.tool} is not a supported tool.")
print(f"Supported tools are: {supported_tools}")
exit(1)

if not args.bump_commit:
tool_fields = tools[args.tool]
if args.field not in tool_fields:
print(f"{args.field} is not a supported field for {args.tool}.")
tool_supported_fields = ", ".join(tool_fields.keys())
print(f"Supported fields are: {tool_supported_fields}")
exit(1)

print(tool_fields[args.field])
exit(0)

new_value = bump_commit(tools, args.tool)
if new_value and tools[args.tool]["git-commit"] != new_value:
print(f"Updating {args.tool} to {new_value}")
tools[args.tool]["git-commit"] = new_value

with open(data_file, "w") as f:
f.write(json.dumps(tools, indent=2))
4 changes: 2 additions & 2 deletions setup/install-klayout.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ if [ "$version" = "18.04" ]; then
url=https://www.klayout.org/downloads/Ubuntu-18/klayout_${pkg_version}_amd64.deb
elif [ "$version" = "20.04" ]; then
url=https://www.klayout.org/downloads/Ubuntu-20/klayout_${pkg_version}_amd64.deb
elif [ "$version" = "22.04" ]; then
url=https://www.klayout.org/downloads/Ubuntu-22/klayout_${pkg_version}_amd64.deb
else
echo "Script doesn't support Ubuntu version $version."
fi
Expand All @@ -23,6 +25,4 @@ sudo apt-get install -y libqt5core5a libqt5designer5 libqt5gui5 libqt5multimedia
# Install package
sudo dpkg -i klayout_${pkg_version}_amd64.deb

echo "Please add \"export QT_QPA_PLATFORM=offscreen\" to your .bashrc"

cd -
Loading

0 comments on commit dad088f

Please sign in to comment.