Skip to content
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

Update index.rst #290

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
122 changes: 103 additions & 19 deletions .github/workflows/user_project_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,67 @@ jobs:
name: pdk-tarball
path: /tmp/pdk.tar

- name: Tarball OpenLane
run: |
tar -cf /tmp/openlane.tar -C $OPENLANE_ROOT .

- name: Upload OpenLane Tarball
uses: actions/upload-artifact@v2
with:
name: openlane-tarball
path: /tmp/openlane.tar

dependencies:
timeout-minutes: 720
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Export env variables
run: |
echo "CARAVEL_ROOT=/home/runner/work/caravel_user_project/caravel" >> $GITHUB_ENV
echo "MCW_ROOT=/home/runner/work/caravel_user_project/mgmt_core_wrapper" >> $GITHUB_ENV

- name: Install dependencies
run: |
make install
make install_mcw
make install-caravel-cocotb
make simenv

- name: Tarball caravel
run: |
tar -cf /tmp/caravel.tar -C $CARAVEL_ROOT .

- name: Upload caravel Tarball
uses: actions/upload-artifact@v2
with:
name: caravel-tarball
path: /tmp/caravel.tar

- name: Tarball mgmt_core_wrapper
run: |
tar -cf /tmp/mgmt_core_wrapper.tar -C $MCW_ROOT .

- name: Upload mgmt_core_wrapper Tarball
uses: actions/upload-artifact@v2
with:
name: mgmt_core_wrapper-tarball
path: /tmp/mgmt_core_wrapper.tar

user_project_flow:
timeout-minutes: 720
runs-on: ubuntu-latest
strategy:
matrix:
pdk: ["sky130A", "sky130B"]
needs: [pdk]
needs: [pdk, dependencies]
steps:
- uses: actions/checkout@v2

Expand All @@ -68,6 +122,11 @@ jobs:
- name: Export OPENLANE ROOT
run: echo "OPENLANE_ROOT=/home/runner/work/caravel_user_project/openlane" >> $GITHUB_ENV

- name: Export env variables
run: |
echo "CARAVEL_ROOT=/home/runner/work/caravel_user_project/caravel" >> $GITHUB_ENV
echo "MCW_ROOT=/home/runner/work/caravel_user_project/mgmt_core_wrapper" >> $GITHUB_ENV

- name: Download PDK Tarball
uses: actions/download-artifact@v2
with:
Expand All @@ -80,12 +139,41 @@ jobs:
sudo chown -R $USER:$USER ${{ env.PDK_ROOT }}
tar -xf /tmp/pdk.tar -C $PDK_ROOT .

- name: Install dependencies
- name: Download OpenLane Tarball
uses: actions/download-artifact@v2
with:
name: openlane-tarball
path: /tmp

- name: Unpack OpenLane Tarball
run: |
make install
make install_mcw
make openlane
make simenv
sudo mkdir -p ${{ env.OPENLANE_ROOT }}
sudo chown -R $USER:$USER ${{ env.OPENLANE_ROOT }}
tar -xf /tmp/openlane.tar -C $OPENLANE_ROOT .

- name: Download caravel Tarball
uses: actions/download-artifact@v2
with:
name: caravel-tarball
path: /tmp

- name: Unpack caravel Tarball
run: |
sudo mkdir -p ${{ env.CARAVEL_ROOT }}
sudo chown -R $USER:$USER ${{ env.CARAVEL_ROOT }}
tar -xf /tmp/caravel.tar -C $CARAVEL_ROOT .

- name: Download mgmt_core_wrapper Tarball
uses: actions/download-artifact@v2
with:
name: mgmt_core_wrapper-tarball
path: /tmp

- name: Unpack mgmt_core_wrapper Tarball
run: |
sudo mkdir -p ${{ env.MCW_ROOT }}
sudo chown -R $USER:$USER ${{ env.MCW_ROOT }}
tar -xf /tmp/mgmt_core_wrapper.tar -C $MCW_ROOT .

- name: Harden using Openlane
run: |
Expand Down Expand Up @@ -117,18 +205,14 @@ jobs:
path: |
/home/runner/work/caravel_user_project/caravel_user_project/mpw_precheck_result/logs/*

- name: setup cocotb environment
run: |
make setup-cocotb-env

- name: Run DV RTL tests
run: |
make verify-io_ports-rtl
make verify-la_test1-rtl
make verify-la_test2-rtl
make verify-mprj_stimulus-rtl
make verify-wb_port-rtl

# - name: Run DV GL tests
# run: |
# make verify-io_ports-gl
# make verify-la_test1-gl
# make verify-la_test2-gl
# make verify-mprj_stimulus-gl
# make verify-wb_port-gl
make cocotb-verify-all-rtl

- name: Run DV GL tests
run: |
make cocotb-verify-all-gl
46 changes: 35 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ export PDK?=sky130A
#export PDK?=gf180mcuC
export PDKPATH?=$(PDK_ROOT)/$(PDK)

PYTHON_BIN ?= python3

ROOTLESS ?= 0
USER_ARGS = -u $$(id -u $$USER):$$(id -g $$USER)
ifeq ($(ROOTLESS), 1)
Expand Down Expand Up @@ -106,6 +108,11 @@ install:
simenv:
docker pull efabless/dv:latest

# Install cocotb docker
.PHONY: simenv-cocotb
simenv-cocotb:
docker pull efabless/dv:cocotb

.PHONY: setup
setup: check_dependencies install check-env install_mcw openlane pdk-with-volare setup-timing-scripts setup-cocotb precheck

Expand All @@ -116,8 +123,12 @@ $(blocks): % :
$(MAKE) -C openlane $*

dv_patterns=$(shell cd verilog/dv && find * -maxdepth 0 -type d)
cocotb-dv_patterns=$(shell cd verilog/dv/cocotb && find . -name "*.c" | sed -e 's|^.*/||' -e 's/.c//')
$(info VAR1 is $(cocotb-dv_patterns))
dv-targets-rtl=$(dv_patterns:%=verify-%-rtl)
cocotb-dv-targets-rtl=$(cocotb-dv_patterns:%=cocotb-verify-%-rtl)
dv-targets-gl=$(dv_patterns:%=verify-%-gl)
cocotb-dv-targets-gl=$(cocotb-dv_patterns:%=cocotb-verify-%-gl)
dv-targets-gl-sdf=$(dv_patterns:%=verify-%-gl-sdf)

TARGET_PATH=$(shell pwd)
Expand Down Expand Up @@ -322,20 +333,33 @@ setup-timing-scripts: $(TIMING_ROOT)
@( cd $(TIMING_ROOT) && git pull )
@#( cd $(TIMING_ROOT) && git fetch && git checkout $(MPW_TAG); )

.PHONY: setup-cocotb
setup-cocotb:
@pip install caravel-cocotb==1.0.0
.PHONY: install-caravel-cocotb
install-caravel-cocotb:
rm -rf ./venv
$(PYTHON_BIN) -m venv ./venv
./venv/bin/$(PYTHON_BIN) -m pip install --upgrade --no-cache-dir pip
./venv/bin/$(PYTHON_BIN) -m pip install --upgrade --no-cache-dir caravel-cocotb

.PHONY: setup-cocotb-env
setup-cocotb-env:
@(python3 $(PROJECT_ROOT)/verilog/dv/setup-cocotb.py $(CARAVEL_ROOT) $(MCW_ROOT) $(PDK_ROOT) $(PDK) $(PROJECT_ROOT))
@docker pull efabless/dv:latest
@docker pull efabless/dv:cocotb

.PHONY: cocotb-verify-rtl
cocotb-verify-rtl:
@(cd $(PROJECT_ROOT)/verilog/dv/cocotb && caravel_cocotb -tl counter_tests/counter_tests.yaml -v )
.PHONY: setup-cocotb
setup-cocotb: install-caravel-cocotb setup-cocotb-env simenv-cocotb

.PHONY: cocotb-verify-all-rtl
cocotb-verify-all-rtl:
@(cd $(PROJECT_ROOT)/verilog/dv/cocotb && caravel_cocotb -tl user_proj_tests/user_proj_tests.yaml )

.PHONY: cocotb-verify-all-gl
cocotb-verify-all-gl:
@(cd $(PROJECT_ROOT)/verilog/dv/cocotb && caravel_cocotb -tl user_proj_tests/user_proj_tests_gl.yaml -verbosity quiet)

$(cocotb-dv-targets-rtl): cocotb-verify-%-rtl:
@(cd $(PROJECT_ROOT)/verilog/dv/cocotb && caravel_cocotb -t $* )

.PHONY: cocotb-verify-gl
cocotb-verify-gl:
@(cd $(PROJECT_ROOT)/verilog/dv/cocotb && caravel_cocotb -tl counter_tests/counter_tests_gl.yaml -v -verbosity quiet)
$(cocotb-dv-targets-gl): cocotb-verify-%-gl:
@(cd $(PROJECT_ROOT)/verilog/dv/cocotb && caravel_cocotb -t $* -verbosity quiet)

./verilog/gl/user_project_wrapper.v:
$(error you don't have $@)
Expand Down
38 changes: 31 additions & 7 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,12 @@ Starting your project

make setup

* This command will setup your environment by installing the following
* This command will setup your environment by installing the following

- caravel_lite (a lite version of caravel)
- management core for simulation
- openlane to harden your design
- pdk
- caravel_lite (a lite version of caravel)
- management core for simulation
- openlane to harden your design
- pdk


#. Now you can start hardening your design
Expand Down Expand Up @@ -148,6 +148,30 @@ Starting your project
# for example
make verify-io_ports-rtl

#. Run cocotb simulation on your design

* You need to include your rtl/gl/gl+sdf files in ``verilog/includes/includes.<rtl/gl/gl+sdf>.caravel_user_project``

* To make sure the cocotb flow works, run the following commands for testing the counter example

.. code:: bash
# To run all tests in user_project_tests list found at ``verilog/dv/cocotb/user_project_tests/user_project_tests.yaml``
# RTL tests
make cocotb-verify-all-rtl

# OR GL simulation using
make cocotb-verify-all-gl

# To run any test under ``verilog/dv/cocotb/*``
# RTL
make cocotb-verify-<test_name>-rtl
# GL
make cocotb-verify-<test_name>-gl

* To run cocotb tests on your design, Follow the steps below
* Add cocotb tests under ``verilog/dv/cocotb`` follow steps at `Adding_cocotb_test <https://caravel-sim-infrastructure.readthedocs.io/en/latest/usage.html#adding-a-test>`_
* Run cocotb tests using ``caravel_cocotb`` command steps at `Running_cocotb_tests <https://caravel-sim-infrastructure.readthedocs.io/en/latest/usage.html#running-a-test>`_

#. Run opensta on your design

* Extract spefs for ``user_project_wrapper`` and macros inside it:
Expand All @@ -168,15 +192,15 @@ Starting your project

make caravel-sta

**NOTE:** To update timing scripts run ``make setup-timing-scripts``
**NOTE:** To update timing scripts run ``make setup-timing-scripts``

#. Run standalone LVS

.. code:: bash

make lvs-<macro_name> # macro is the name of the macro you want to run LVS on

**NOTE:** You have to create a new config file for each macro under ``lvs/<macro_name>/lvs_config.json``
**NOTE:** You have to create a new config file for each macro under ``lvs/<macro_name>/lvs_config.json``

#. Run the precheck locally

Expand Down
24 changes: 20 additions & 4 deletions verilog/dv/cocotb/cocotb_tests.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,23 @@
# SPDX-FileCopyrightText: 2023 Efabless Corporation

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

# http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# SPDX-License-Identifier: Apache-2.0

from hello_world.hello_world import hello_world
from hello_world_uart.hello_world_uart import hello_world_uart
from counter_tests.counter_wb.counter_wb import counter_wb
from counter_tests.counter_la.counter_la import counter_la
from counter_tests.counter_la_reset.counter_la_reset import counter_la_reset
from counter_tests.counter_la_clk.counter_la_clk import counter_la_clk
from user_proj_tests.counter_wb.counter_wb import counter_wb
from user_proj_tests.counter_la.counter_la import counter_la
from user_proj_tests.counter_la_reset.counter_la_reset import counter_la_reset
from user_proj_tests.counter_la_clk.counter_la_clk import counter_la_clk
from gpio_test.gpio_test import gpio_test
7 changes: 0 additions & 7 deletions verilog/dv/cocotb/counter_tests/counter_la/counter_la.yaml

This file was deleted.

This file was deleted.

This file was deleted.

9 changes: 0 additions & 9 deletions verilog/dv/cocotb/counter_tests/counter_tests.yaml

This file was deleted.

8 changes: 0 additions & 8 deletions verilog/dv/cocotb/counter_tests/counter_tests_gl.yaml

This file was deleted.

6 changes: 0 additions & 6 deletions verilog/dv/cocotb/counter_tests/counter_wb/counter_wb.yaml

This file was deleted.

17 changes: 17 additions & 0 deletions verilog/dv/cocotb/design_info.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
# SPDX-FileCopyrightText: 2023 Efabless Corporation

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

# http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# SPDX-License-Identifier: Apache-2.0


# yaml file contain general design information that would mostly need to be updated in the first run only

#eg CARAVEL_ROOT: "/usr/Desktop/caravel_project/caravel/"
Expand Down
Loading
Loading