Skip to content

Yosys upgrade WIP PR for testing #3087

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 4 additions & 1 deletion parmys/parmys-plugin/parmys.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1099,8 +1099,11 @@ struct ParMYSPass : public Pass {

log("Updating the Design\n");
Pass::call(design, "delete");

std::vector<RTLIL::Module*> modules_to_remove;
for (auto module : design->modules()) {
modules_to_remove.push_back(module);
}
for (auto module : modules_to_remove) {
design->remove(module);
}

Expand Down
4 changes: 2 additions & 2 deletions parmys/parmys-plugin/parmys_update.cc
Original file line number Diff line number Diff line change
Expand Up @@ -506,9 +506,9 @@ void define_logical_function_yosys(nnode_t *node, Module *module)
lutptr = &cell->parameters.at(ID::LUT);
for (int i = 0; i < (1 << node->num_input_pins); i++) {
if (i == 3 || i == 5 || i == 6 || i == 7) //"011 1\n101 1\n110 1\n111 1\n"
lutptr->bits.at(i) = RTLIL::State::S1;
lutptr->bits().at(i) = RTLIL::State::S1;
else
lutptr->bits.at(i) = RTLIL::State::S0;
lutptr->bits().at(i) = RTLIL::State::S0;
}
} else {
cell->parameters[ID::A_WIDTH] = RTLIL::Const(int(node->num_input_pins));
Expand Down
4 changes: 4 additions & 0 deletions yosys/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@ insert_final_newline = true
indent_style = space
indent_size = 2
trim_trailing_whitespace = false

[*.yml]
indent_style = space
indent_size = 2
2 changes: 1 addition & 1 deletion yosys/.gitcommit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
dac5bd1983a
$Format:%H$
6 changes: 4 additions & 2 deletions yosys/.github/actions/setup-build-env/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@ runs:
shell: bash
run: |
sudo apt-get update
sudo apt-get install gperf build-essential bison flex libreadline-dev gawk tcl-dev libffi-dev git graphviz xdot pkg-config python3 libboost-system-dev libboost-python-dev libboost-filesystem-dev zlib1g-dev
sudo apt-get install gperf build-essential bison flex libreadline-dev gawk tcl-dev libffi-dev git graphviz xdot pkg-config python3 libboost-system-dev libboost-python-dev libboost-filesystem-dev zlib1g-dev libbz2-dev

- name: Install macOS Dependencies
if: runner.os == 'macOS'
shell: bash
run: |
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 brew install bison flex gawk libffi pkg-config bash autoconf
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 brew update
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 brew install bison flex gawk libffi pkg-config bash autoconf llvm lld || true

- name: Linux runtime environment
if: runner.os == 'Linux'
Expand All @@ -28,6 +29,7 @@ runs:
shell: bash
run: |
echo "${{ github.workspace }}/.local/bin" >> $GITHUB_PATH
echo "$(brew --prefix llvm)/bin" >> $GITHUB_PATH
echo "$(brew --prefix bison)/bin" >> $GITHUB_PATH
echo "$(brew --prefix flex)/bin" >> $GITHUB_PATH
echo "procs=$(sysctl -n hw.ncpu)" >> $GITHUB_ENV
4 changes: 3 additions & 1 deletion yosys/.github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
submodules: true
persist-credentials: false

- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
Expand Down
15 changes: 11 additions & 4 deletions yosys/.github/workflows/extra-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
submodules: true
submodules: true
persist-credentials: false
- name: Build
run: make vcxsrc YOSYS_VER=latest
- uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -59,7 +60,8 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
submodules: true
submodules: true
persist-credentials: false
- name: Build
run: |
WASI_SDK=wasi-sdk-19.0
Expand All @@ -86,12 +88,17 @@ jobs:
name: "Build nix flake"
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
fail-fast: false
steps:
- uses: actions/checkout@v4
with:
submodules: true
persist-credentials: false
- uses: cachix/install-nix-action@v26
with:
install_url: https://releases.nixos.org/nix/nix-2.18.1/install
- run: nix build .?submodules=1
- run: nix build .?submodules=1 -L
83 changes: 83 additions & 0 deletions yosys/.github/workflows/prepare-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Build docs artifact with Verific

on: [push, pull_request]

jobs:
check_docs_rebuild:
runs-on: ubuntu-latest
outputs:
skip_check: ${{ steps.skip_check.outputs.should_skip }}
docs_export: ${{ steps.docs_var.outputs.docs_export }}
env:
docs_export: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/docs-preview') || startsWith(github.ref, 'refs/tags/') }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@v5
with:
paths_ignore: '["**/README.md"]'
# don't cancel in case we're updating docs
cancel_others: 'false'
# only run on push *or* pull_request, not both
concurrent_skipping: ${{ env.docs_export && 'never' || 'same_content_newer'}}
- id: docs_var
run: echo "docs_export=${docs_export}" >> $GITHUB_OUTPUT

prepare-docs:
# docs builds are needed for anything on main, any tagged versions, and any tag
# or branch starting with docs-preview
needs: check_docs_rebuild
if: ${{ needs.check_docs_rebuild.outputs.should_skip != 'true' }}
runs-on: [self-hosted, linux, x64, fast]
steps:
- name: Checkout Yosys
uses: actions/checkout@v4
with:
persist-credentials: false
submodules: true

- name: Runtime environment
run: |
echo "procs=$(nproc)" >> $GITHUB_ENV

- name: Build Yosys
run: |
make config-clang
echo "ENABLE_VERIFIC := 1" >> Makefile.conf
echo "ENABLE_VERIFIC_EDIF := 1" >> Makefile.conf
echo "ENABLE_VERIFIC_LIBERTY := 1" >> Makefile.conf
echo "ENABLE_VERIFIC_YOSYSHQ_EXTENSIONS := 1" >> Makefile.conf
echo "ENABLE_CCACHE := 1" >> Makefile.conf
make -j$procs ENABLE_LTO=1

- name: Prepare docs
shell: bash
run:
make docs/prep -j$procs TARGETS= EXTRA_TARGETS=

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: cmd-ref-${{ github.sha }}
path: |
docs/source/cmd
docs/source/generated
docs/source/_images
docs/source/code_examples

- name: Install doc prereqs
shell: bash
run: |
make docs/reqs

- name: Test build docs
shell: bash
run: |
make -C docs html -j$procs TARGETS= EXTRA_TARGETS=

- name: Trigger RTDs build
if: ${{ needs.check_docs_rebuild.outputs.docs_export == 'true' }}
uses: dfm/[email protected]
with:
webhook_url: ${{ secrets.RTDS_WEBHOOK_URL }}
webhook_token: ${{ secrets.RTDS_WEBHOOK_TOKEN }}
commit_ref: ${{ github.ref }}
34 changes: 34 additions & 0 deletions yosys/.github/workflows/source-vendor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Create source archive with vendored dependencies

on: [push, workflow_dispatch]

jobs:
vendor-sources:
runs-on: ubuntu-latest
steps:
- name: Checkout repository with submodules
uses: actions/checkout@v4
with:
submodules: 'recursive'
persist-credentials: false

- name: Create clean tarball
run: |
git archive --format=tar HEAD -o yosys-src-vendored.tar
git submodule foreach '
git archive --format=tar --prefix="${sm_path}/" HEAD --output=${toplevel}/vendor-${name}.tar
'

# 2008 bug https://lists.gnu.org/archive/html/bug-tar/2008-08/msg00002.html
for file in vendor-*.tar; do
tar --concatenate --file=yosys-src-vendored.tar "$file"
done

gzip yosys-src-vendored.tar

- name: Store tarball artifact
uses: actions/upload-artifact@v4
with:
name: vendored-sources
path: yosys-src-vendored.tar.gz
retention-days: 1
66 changes: 63 additions & 3 deletions yosys/.github/workflows/test-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ jobs:
uses: actions/checkout@v4
with:
submodules: true
persist-credentials: false

- name: Setup environment
uses: ./.github/actions/setup-build-env
Expand All @@ -56,7 +57,8 @@ jobs:
mkdir build
cd build
make -f ../Makefile config-$CC
make -f ../Makefile -j$procs
echo 'SANITIZER = undefined' >> Makefile.conf
make -f ../Makefile -j$procs ENABLE_LTO=1

- name: Log yosys-config output
run: |
Expand All @@ -82,13 +84,16 @@ jobs:
if: needs.pre_job.outputs.should_skip != 'true'
env:
CC: clang
UBSAN_OPTIONS: halt_on_error=1
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
fail-fast: false
steps:
- name: Checkout Yosys
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Setup environment
uses: ./.github/actions/setup-build-env
Expand All @@ -100,12 +105,22 @@ jobs:
cd iverilog
echo "IVERILOG_GIT=$(git rev-parse HEAD)" >> $GITHUB_ENV

- name: Get vcd2fst
shell: bash
run: |
git clone https://github.com/mmicko/libwave.git
mkdir -p ${{ github.workspace }}/.local/
cd libwave
cmake . -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/.local
make -j$procs
make install

- name: Cache iverilog
id: cache-iverilog
uses: actions/cache@v4
with:
path: .local/
key: ${{ matrix.os }}-${{ env.IVERILOG_GIT }}
key: ${{ matrix.os }}-${IVERILOG_GIT}

- name: Build iverilog
if: steps.cache-iverilog.outputs.cache-hit != 'true'
Expand Down Expand Up @@ -157,6 +172,8 @@ jobs:
steps:
- name: Checkout Yosys
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Setup environment
uses: ./.github/actions/setup-build-env
Expand All @@ -178,4 +195,47 @@ jobs:
- name: Run tests
shell: bash
run: |
make -C docs test -j${{ env.procs }}
make -C docs test -j$procs

test-docs-build:
name: Try build docs
runs-on: [self-hosted, linux, x64, fast]
needs: [pre_docs_job]
if: needs.pre_docs_job.outputs.should_skip != 'true'
strategy:
matrix:
docs-target: [html, latexpdf]
fail-fast: false
steps:
- name: Checkout Yosys
uses: actions/checkout@v4
with:
submodules: true
persist-credentials: false

- name: Runtime environment
run: |
echo "procs=$(nproc)" >> $GITHUB_ENV

- name: Build Yosys
run: |
make config-clang
echo "ENABLE_CCACHE := 1" >> Makefile.conf
make -j$procs

- name: Install doc prereqs
shell: bash
run: |
make docs/reqs

- name: Build docs
shell: bash
run: |
make docs DOC_TARGET=${{ matrix.docs-target }} -j$procs

- name: Store docs build artifact
uses: actions/upload-artifact@v4
with:
name: docs-build-${{ matrix.docs-target }}
path: docs/build/
retention-days: 7
14 changes: 6 additions & 8 deletions yosys/.github/workflows/test-compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,22 @@ jobs:
- ubuntu-latest
compiler:
# oldest supported
- 'clang-14'
- 'clang-10'
- 'gcc-10'
# newest
- 'clang'
- 'gcc'
# newest, make sure to update maximum standard step to match
- 'clang-19'
- 'gcc-13'
include:
# macOS
- os: macos-13
compiler: 'clang'
# oldest clang not available on ubuntu-latest
- os: ubuntu-22.04
compiler: 'clang-11'
fail-fast: false
steps:
- name: Checkout Yosys
uses: actions/checkout@v4
with:
submodules: true
persist-credentials: false

- name: Setup environment
uses: ./.github/actions/setup-build-env
Expand All @@ -72,7 +70,7 @@ jobs:

# maximum standard, only on newest compilers
- name: Build C++20
if: ${{ matrix.compiler == 'clang' || matrix.compiler == 'gcc'}}
if: ${{ matrix.compiler == 'clang-19' || matrix.compiler == 'gcc-13' }}
shell: bash
run: |
make config-$CC_SHORT
Expand Down
Loading
Loading