Merge pull request #112 from efabless/volare_integration

Volare integration
diff --git a/.github/workflows/user_project_ci.yml b/.github/workflows/user_project_ci.yml
index cbd9563..d3e9f0c 100644
--- a/.github/workflows/user_project_ci.yml
+++ b/.github/workflows/user_project_ci.yml
@@ -20,14 +20,18 @@
         uses: docker/setup-buildx-action@v1
 
       - name: Export PDK ROOT
-        run: echo "PDK_ROOT=/usr/local/pdk" >> $GITHUB_ENV
+        run: echo "PDK_ROOT=/home/runner/work/pdk" >> $GITHUB_ENV
+      
+      - name: Export OPENLANE ROOT
+        run: echo "OPENLANE_ROOT=/home/runner/work/caravel_user_project/openlane" >> $GITHUB_ENV
 
       - name: Install dependencies
         run: |
           sudo mkdir -p ${{ env.PDK_ROOT }}
           sudo chown -R $USER:$USER ${{ env.PDK_ROOT }}
           make install
-          make pdk
+          make openlane
+          make pdk-with-volare
 
       - name: Tarball PDK
         run: |
@@ -55,7 +59,10 @@
 
       - name: Export PDK ROOT
         run: |
-          echo "PDK_ROOT=/usr/local/pdk" >> $GITHUB_ENV
+          echo "PDK_ROOT=/home/runner/work/pdk" >> $GITHUB_ENV
+      
+      - name: Export PDKPATH
+        run: echo "PDKPATH=/home/runner/work/pdk/sky130A" >> $GITHUB_ENV
 
       - name: Download PDK Tarball
         uses: actions/download-artifact@v2
@@ -68,22 +75,29 @@
           sudo mkdir -p ${{ env.PDK_ROOT }}/sky130A
           sudo chown -R $USER:$USER ${{ env.PDK_ROOT }}
           tar -xf /tmp/sky130A.tar -C $PDK_ROOT/sky130A .
-
       - name: Run MPW-Precheck
         run: |
           export INPUT_DIRECTORY=$(pwd)
           export PRECHECK_ROOT=$INPUT_DIRECTORY/mpw_precheck
           export OUTPUT_DIRECTORY=$INPUT_DIRECTORY/mpw_precheck_result
           export OUTPUT=$OUTPUT_DIRECTORY/logs/precheck.log
+          export PDKPATH=$PDK_ROOT/sky130A
 
           git clone --depth=1 -b mpw-5b https://github.com/efabless/mpw_precheck.git
 
-          docker run -v "$PRECHECK_ROOT":"$PRECHECK_ROOT" -v "$INPUT_DIRECTORY":"$INPUT_DIRECTORY" -v "${{ env.PDK_ROOT }}":"${{ env.PDK_ROOT }}" -e INPUT_DIRECTORY="$INPUT_DIRECTORY" -e PDK_ROOT="${{ env.PDK_ROOT }}" -u $(id -u "$USER"):$(id -g "$USER") efabless/mpw_precheck:latest bash -c "cd $PRECHECK_ROOT; python3 mpw_precheck.py --input_directory $INPUT_DIRECTORY --pdk_root ${{ env.PDK_ROOT }} --output_directory $OUTPUT_DIRECTORY license makefile consistency xor magic_drc klayout_beol klayout_feol klayout_met_min_ca_density klayout_offgrid klayout_pin_label_purposes_overlapping_drawing klayout_zeroarea"
+          docker run -v "$PRECHECK_ROOT":"$PRECHECK_ROOT" -v "$INPUT_DIRECTORY":"$INPUT_DIRECTORY" -v "${{ env.PDK_ROOT }}":"${{ env.PDK_ROOT }}" -e INPUT_DIRECTORY="$INPUT_DIRECTORY" -e PDK_ROOT="${{ env.PDK_ROOT }}" -e PDKPATH="${{ env.PDKPATH }}" -u $(id -u "$USER"):$(id -g "$USER") efabless/mpw_precheck:latest bash -c "cd $PRECHECK_ROOT; python3 mpw_precheck.py --input_directory $INPUT_DIRECTORY --pdk_root ${{ env.PDK_ROOT }} --output_directory $OUTPUT_DIRECTORY license makefile consistency xor magic_drc klayout_beol klayout_feol klayout_met_min_ca_density klayout_offgrid klayout_pin_label_purposes_overlapping_drawing klayout_zeroarea"
 
           cnt=$(grep -c "All Checks Passed" "$OUTPUT")
           if ! [[ $cnt ]]; then cnt=0; fi
           if [[ $cnt -eq 1 ]]; then exit 0; fi
           exit 2
+      - name: upload failure logs
+        if: failure()
+        uses: actions/upload-artifact@v2
+        with:
+          name: error
+          path: |
+            /home/runner/work/caravel_user_project/caravel_user_project/mpw_precheck_result/logs/*
 
   user_project_flow:
     timeout-minutes: 720
@@ -99,7 +113,7 @@
         uses: docker/setup-buildx-action@v1
 
       - name: Export PDK ROOT
-        run: echo "PDK_ROOT=/usr/local/pdk" >> $GITHUB_ENV
+        run: echo "PDK_ROOT=/home/runner/work/pdk" >> $GITHUB_ENV
 
       - name: Export OPENLANE ROOT
         run: echo "OPENLANE_ROOT=/home/runner/work/caravel_user_project/openlane" >> $GITHUB_ENV
diff --git a/Makefile b/Makefile
index b6de718..150e485 100644
--- a/Makefile
+++ b/Makefile
@@ -21,14 +21,14 @@
 SIM?=RTL
 
 export SKYWATER_COMMIT=c094b6e83a4f9298e47f696ec5a7fd53535ec5eb
-export OPEN_PDKS_COMMIT=7519dfb04400f224f140749cda44ee7de6f5e095
+export OPEN_PDKS_COMMIT?=7519dfb04400f224f140749cda44ee7de6f5e095
 export PDK_MAGIC_COMMIT=7d601628e4e05fd17fcb80c3552dacb64e9f6e7b
 export OPENLANE_TAG=2022.02.23_02.50.41
 
 # Install lite version of caravel, (1): caravel-lite, (0): caravel
 CARAVEL_LITE?=1
 
-MPW_TAG ?= mpw-5c
+MPW_TAG ?= mpw-6a
 
 ifeq ($(CARAVEL_LITE),1)
 	CARAVEL_NAME := caravel-lite
@@ -60,7 +60,7 @@
 	docker pull efabless/dv_setup:latest
 
 .PHONY: setup
-setup: install check-env install_mcw pdk openlane
+setup: install check-env install_mcw openlane pdk-with-volare
 
 # Openlane
 blocks=$(shell cd openlane && find * -maxdepth 0 -type d)
@@ -209,4 +209,3 @@
 	@$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$'
 
 
-
diff --git a/docs/source/index.rst b/docs/source/index.rst
index 052fcf7..e756a3f 100644
--- a/docs/source/index.rst
+++ b/docs/source/index.rst
@@ -55,7 +55,9 @@
 Prerequisites
 =============
 
-- Docker
+- Docker: `Linux <https://hub.docker.com/search?q=&type=edition&offering=community&operating_system=linux&utm_source=docker&utm_medium=webreferral&utm_campaign=dd-smartbutton&utm_location=header>`_ ||  `Windows <https://desktop.docker.com/win/main/amd64/Docker%20Desktop%20Installer.exe?utm_source=docker&utm_medium=webreferral&utm_campaign=dd-smartbutton&utm_location=header>`_ || `Mac with Intel Chip <https://desktop.docker.com/mac/main/amd64/Docker.dmg?utm_source=docker&utm_medium=webreferral&utm_campaign=dd-smartbutton&utm_location=header>`_ || `Mac with M1 Chip <https://desktop.docker.com/mac/main/arm64/Docker.dmg?utm_source=docker&utm_medium=webreferral&utm_campaign=dd-smartbutton&utm_location=header>`_
+
+- Python 3.6+ with PIP
 
 Install Caravel
 ===============
@@ -163,19 +165,16 @@
 Building the PDK 
 ================
 
-Make sure you have `Magic VLSI Layout Tool <http://opencircuitdesign.com/magic/index.html>`__ installed on your machine before building the pdk. 
-The pdk build is tested with magic version ``8.3.265``. 
+For more information about volare click `here <https://github.com/efabless/volare>`__
 
 .. code:: bash
 
     # set PDK_ROOT to the path you wish to use for the pdk
     export PDK_ROOT=<pdk-installation-path>
 
-    # you can optionally specify skywater-pdk and open-pdks commit used
-    # by setting and exporting SKYWATER_COMMIT and OPEN_PDKS_COMMIT
-    # if you do not set them, they default to the last verfied commits tested for this project
-
-    make pdk
+    # use volare to download the pdk
+    # To change the default pdk version you can export OPEN_PDKS_COMMIT=<pdk_commit>
+    make pdk-with-volare 
 
 Running Full Chip Simulation
 ============================
@@ -193,10 +192,8 @@
 .. code:: bash
 
     export PDK_ROOT=<pdk-installation-path>
-    # specify simulation mode: RTL/GL
-    export SIM=RTL
     # Run RTL simulation on IO ports testbench, make verify-io_ports
-    make verify-<testbench-name>
+    make verify-<testbench-name>-rtl
 
 Once you have the physical implementation done and you have the gate-level netlists ready, it is crucial to run full gate-level simulations to make sure that your design works as intended after running the physical implementation. 
 
@@ -205,10 +202,8 @@
 .. code:: bash
 
     export PDK_ROOT=<pdk-installation-path>
-    # specify simulation mode: RTL/GL
-    export SIM=GL
     # Run RTL simulation on IO ports testbench, make verify-io_ports
-    make verify-<testbench-name>
+    make verify-<testbench-name>-gl
 
 
 This sample project comes with four example testbenches to test the IO port connection, wishbone interface, and logic analyzer. The test-benches are under the
diff --git a/docs/source/quickstart.rst b/docs/source/quickstart.rst
index a62dd7e..e538e7e 100644
--- a/docs/source/quickstart.rst
+++ b/docs/source/quickstart.rst
@@ -27,6 +27,8 @@
 
 - Docker: `Linux <https://hub.docker.com/search?q=&type=edition&offering=community&operating_system=linux&utm_source=docker&utm_medium=webreferral&utm_campaign=dd-smartbutton&utm_location=header>`_ ||  `Windows <https://desktop.docker.com/win/main/amd64/Docker%20Desktop%20Installer.exe?utm_source=docker&utm_medium=webreferral&utm_campaign=dd-smartbutton&utm_location=header>`_ || `Mac with Intel Chip <https://desktop.docker.com/mac/main/amd64/Docker.dmg?utm_source=docker&utm_medium=webreferral&utm_campaign=dd-smartbutton&utm_location=header>`_ || `Mac with M1 Chip <https://desktop.docker.com/mac/main/arm64/Docker.dmg?utm_source=docker&utm_medium=webreferral&utm_campaign=dd-smartbutton&utm_location=header>`_
 
+- Python 3.6+ with PIP
+
 ===============================================================================================================================================================
 
 ---------------------
@@ -51,7 +53,7 @@
     .. code:: bash
 
         # Make sure that "caravel_example" matches the empty github repo name in step 1
-        git clone -b mpw-5c https://github.com/efabless/caravel_user_project caravel_example
+        git clone -b mpw-6a https://github.com/efabless/caravel_user_project caravel_example
         cd caravel_example
         git remote rename origin upstream