Merge branch 'caravel_user_project_analog' into main
diff --git a/.github/workflows/user_project_ci.yml b/.github/workflows/user_project_ci.yml
index 3317f6d..7bda09b 100644
--- a/.github/workflows/user_project_ci.yml
+++ b/.github/workflows/user_project_ci.yml
@@ -53,48 +53,48 @@
               path: |
                 /home/runner/work/caravel_user_project/caravel_user_project/mpw_precheck_result/logs/*
 
-  mpw_precheck_sky130B:
-        timeout-minutes: 720
-        runs-on: ubuntu-latest
-        steps:
-          - uses: actions/checkout@v2
+    mpw_precheck_sky130B:
+          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 QEMU
+              uses: docker/setup-qemu-action@v1
 
-          - name: Set up Docker Buildx
-            uses: docker/setup-buildx-action@v1
+            - name: Set up Docker Buildx
+              uses: docker/setup-buildx-action@v1
 
-          - name: Export PDK ROOT
-            run: |
-              echo "PDK_ROOT=/home/runner/work/pdk" >> $GITHUB_ENV
+            - name: Export PDK ROOT
+              run: |
+                echo "PDK_ROOT=/home/runner/work/pdk" >> $GITHUB_ENV
 
-          - name: Export PDKPATH
-            run: echo "PDKPATH=/home/runner/work/pdk/sky130B" >> $GITHUB_ENV
+            - name: Export PDKPATH
+              run: echo "PDKPATH=/home/runner/work/pdk/sky130B" >> $GITHUB_ENV
 
-          - name: Download PDK
-            run: |
-              MPW_TAG=main CARAVEL_LITE=0 make install
-              make pdk-with-volare
-          
-          - 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
-              git clone --depth=1 -b mpw-7a 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 }}" -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_path ${{ env.PDKPATH }} --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: Download PDK
+              run: |
+                MPW_TAG=main CARAVEL_LITE=0 make install
+                make pdk-with-volare
 
-          - 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/*
+            - 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
+                git clone --depth=1 -b mpw-7a 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 }}" -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_path ${{ env.PDKPATH }} --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/*
 
diff --git a/Makefile b/Makefile
index bc049d4..c82563a 100644
--- a/Makefile
+++ b/Makefile
@@ -19,12 +19,12 @@
 SIM ?= RTL
 
 export OPEN_PDKS_COMMIT?=41c0908b47130d5675ff8484255b43f66463a7d6
-export PDK?=sky130B
+export PDK?=sky130A
 export PDKPATH?=$(PDK_ROOT)/$(PDK)
 # Install lite version of caravel, (1): caravel-lite, (0): caravel
 CARAVEL_LITE?=1
 
-MPW_TAG ?= mpw-7a
+MPW_TAG ?= mpw-8b
 
 ifeq ($(CARAVEL_LITE),1)
 	CARAVEL_NAME := caravel-lite
diff --git a/verilog/rtl/user_defines.v b/verilog/rtl/user_defines.v
new file mode 100644
index 0000000..ee44b08
--- /dev/null
+++ b/verilog/rtl/user_defines.v
@@ -0,0 +1,92 @@
+// SPDX-FileCopyrightText: 2022 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
+
+`default_nettype none
+
+`ifndef __USER_DEFINES_H
+// User GPIO initial configuration parameters
+`define __USER_DEFINES_H
+
+// deliberately erroneous placeholder value; user required to config GPIO's to other
+`define GPIO_MODE_INVALID                  13'hXXXX
+
+// Authoritive source of these MODE defs is: caravel/verilog/rtl/user_defines.v
+// Useful GPIO mode values.  These match the names used in defs.h.
+//
+`define GPIO_MODE_MGMT_STD_INPUT_NOPULL    13'h0403
+`define GPIO_MODE_MGMT_STD_INPUT_PULLDOWN  13'h0c01
+`define GPIO_MODE_MGMT_STD_INPUT_PULLUP    13'h0801
+`define GPIO_MODE_MGMT_STD_OUTPUT          13'h1809
+`define GPIO_MODE_MGMT_STD_BIDIRECTIONAL   13'h1801
+`define GPIO_MODE_MGMT_STD_ANALOG          13'h000b
+
+`define GPIO_MODE_USER_STD_INPUT_NOPULL    13'h0402
+`define GPIO_MODE_USER_STD_INPUT_PULLDOWN  13'h0c00
+`define GPIO_MODE_USER_STD_INPUT_PULLUP    13'h0800
+`define GPIO_MODE_USER_STD_OUTPUT          13'h1808
+`define GPIO_MODE_USER_STD_BIDIRECTIONAL   13'h1800
+`define GPIO_MODE_USER_STD_OUT_MONITORED   13'h1802
+`define GPIO_MODE_USER_STD_ANALOG          13'h000a
+
+// The power-on configuration for GPIO 0 to 4 is fixed and cannot be
+// modified (allowing the SPI and debug to always be accessible unless
+// overridden by a flash program).
+
+// The values below can be any of the standard types defined above,
+// or they can be any 13-bit value if the user wants a non-standard
+// startup state for the GPIO.  By default, every GPIO from 5 to 37
+// is set to power up as an input controlled by the management SoC.
+// Users may want to redefine these so that the user project powers
+// up in a state that can be used immediately without depending on
+// the management SoC to run a startup program to configure the GPIOs.
+
+`define USER_CONFIG_GPIO_5_INIT  `GPIO_MODE_INVALID
+`define USER_CONFIG_GPIO_6_INIT  `GPIO_MODE_INVALID
+`define USER_CONFIG_GPIO_7_INIT  `GPIO_MODE_INVALID
+`define USER_CONFIG_GPIO_8_INIT  `GPIO_MODE_INVALID
+`define USER_CONFIG_GPIO_9_INIT  `GPIO_MODE_INVALID
+`define USER_CONFIG_GPIO_10_INIT `GPIO_MODE_INVALID
+`define USER_CONFIG_GPIO_11_INIT `GPIO_MODE_INVALID
+`define USER_CONFIG_GPIO_12_INIT `GPIO_MODE_INVALID
+`define USER_CONFIG_GPIO_13_INIT `GPIO_MODE_INVALID
+
+// Configurations of GPIO 14 to 24 are used on caravel but not caravan.
+`define USER_CONFIG_GPIO_14_INIT `GPIO_MODE_INVALID
+`define USER_CONFIG_GPIO_15_INIT `GPIO_MODE_INVALID
+`define USER_CONFIG_GPIO_16_INIT `GPIO_MODE_INVALID
+`define USER_CONFIG_GPIO_17_INIT `GPIO_MODE_INVALID
+`define USER_CONFIG_GPIO_18_INIT `GPIO_MODE_INVALID
+`define USER_CONFIG_GPIO_19_INIT `GPIO_MODE_INVALID
+`define USER_CONFIG_GPIO_20_INIT `GPIO_MODE_INVALID
+`define USER_CONFIG_GPIO_21_INIT `GPIO_MODE_INVALID
+`define USER_CONFIG_GPIO_22_INIT `GPIO_MODE_INVALID
+`define USER_CONFIG_GPIO_23_INIT `GPIO_MODE_INVALID
+`define USER_CONFIG_GPIO_24_INIT `GPIO_MODE_INVALID
+
+`define USER_CONFIG_GPIO_25_INIT `GPIO_MODE_INVALID
+`define USER_CONFIG_GPIO_26_INIT `GPIO_MODE_INVALID
+`define USER_CONFIG_GPIO_27_INIT `GPIO_MODE_INVALID
+`define USER_CONFIG_GPIO_28_INIT `GPIO_MODE_INVALID
+`define USER_CONFIG_GPIO_29_INIT `GPIO_MODE_INVALID
+`define USER_CONFIG_GPIO_30_INIT `GPIO_MODE_INVALID
+`define USER_CONFIG_GPIO_31_INIT `GPIO_MODE_INVALID
+`define USER_CONFIG_GPIO_32_INIT `GPIO_MODE_INVALID
+`define USER_CONFIG_GPIO_33_INIT `GPIO_MODE_INVALID
+`define USER_CONFIG_GPIO_34_INIT `GPIO_MODE_INVALID
+`define USER_CONFIG_GPIO_35_INIT `GPIO_MODE_INVALID
+`define USER_CONFIG_GPIO_36_INIT `GPIO_MODE_INVALID
+`define USER_CONFIG_GPIO_37_INIT `GPIO_MODE_INVALID
+
+`endif // __USER_DEFINES_H