Add files via upload
diff --git a/caravel/LICENSE b/caravel/LICENSE
new file mode 100644
index 0000000..d645695
--- /dev/null
+++ b/caravel/LICENSE
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   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.
diff --git a/caravel/Makefile b/caravel/Makefile
new file mode 100644
index 0000000..ee51b5b
--- /dev/null
+++ b/caravel/Makefile
@@ -0,0 +1,506 @@
+# SPDX-FileCopyrightText: 2020 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
+
+# cannot commit files larger than 100 MB to GitHub
+FILE_SIZE_LIMIT_MB = 25
+
+# Commands to be used to compress/uncompress files
+# they must operate **in place** (otherwise, modify the target to delete the
+# intermediate file/archive)
+COMPRESS ?= gzip -n --best
+UNCOMPRESS ?= gzip -d
+ARCHIVE_EXT ?= gz
+
+# The following variables are to build static pattern rules
+
+# Needed to rebuild archives that were previously split
+SPLIT_FILES := $(shell find . -type f -name "*.$(ARCHIVE_EXT).00.split")
+SPLIT_FILES_SOURCES := $(basename $(basename $(basename $(SPLIT_FILES))))
+
+# Needed to uncompress the existing archives
+ARCHIVES := $(shell find . -type f -name "*.$(ARCHIVE_EXT)")
+ARCHIVE_SOURCES := $(basename $(ARCHIVES))
+
+# Needed to compress and split files/archives that are too large
+LARGE_FILES := $(shell find ./gds -type f -name "*.gds")
+LARGE_FILES += $(shell find . -type f -size +$(FILE_SIZE_LIMIT_MB)M -not -path "./.git/*" -not -path "./gds/*" -not -path "./openlane/*")
+LARGE_FILES_GZ := $(addsuffix .$(ARCHIVE_EXT), $(LARGE_FILES))
+LARGE_FILES_GZ_SPLIT := $(addsuffix .$(ARCHIVE_EXT).00.split, $(LARGE_FILES))
+# consider splitting existing archives
+LARGE_FILES_GZ_SPLIT += $(addsuffix .00.split, $(ARCHIVES))
+
+# Caravel Root (Default: pwd)
+# Need to be overwritten if running the makefile from UPRJ_ROOT,
+# If caravel is sub-moduled in the user project, run export CARAVEL_ROOT=$(pwd)/caravel
+CARAVEL_ROOT ?= $(shell pwd)
+
+# User project root
+UPRJ_ROOT ?= $(shell pwd)
+
+# Build tasks such as make ship, make generate_fill, make set_user_id, make final run in the foreground (1) or background (0)
+FOREGROUND ?= 1
+
+# PDK setup configs
+THREADS ?= $(shell nproc)
+STD_CELL_LIBRARY ?= sky130_fd_sc_hd
+SPECIAL_VOLTAGE_LIBRARY ?= sky130_fd_sc_hvl
+IO_LIBRARY ?= sky130_fd_io
+PRIMITIVES_LIBRARY ?= sky130_fd_pr
+SKYWATER_COMMIT ?= bb2f842ac8d1b750677ca25bc71fb312859edb82
+OPEN_PDKS_COMMIT ?= b06f0f2148abd1b4f8ef60999f9991775cd87a7e
+INSTALL_SRAM ?= disabled
+
+.DEFAULT_GOAL := ship
+# We need portable GDS_FILE pointers...
+.PHONY: ship
+ship: check-env uncompress
+ifeq ($(FOREGROUND),1)
+	@echo "Running make ship in the foreground..."
+	$(MAKE) __ship
+	@echo "Make ship completed." 2>&1 | tee -a ./signoff/build/make_ship.out
+else
+	@echo "Running make ship in the background..."
+	nohup $(MAKE) __ship >/dev/null 2>&1 &
+	tail -f signoff/build/make_ship.out
+	@echo "Make ship completed."  2>&1 | tee -a ./signoff/build/make_ship.out
+endif
+
+__ship:
+	@echo "###############################################"
+	@echo "Generating Caravel GDS (sources are in the 'gds' directory)"
+	@sleep 1
+#### Runs from the CARAVEL_ROOT mag directory 
+	@echo "\
+		random seed `$(CARAVEL_ROOT)/scripts/set_user_id.py -report`; \
+		gds readonly true; \
+		gds rescale false; \
+		gds read $(UPRJ_ROOT)/gds/user_project_wrapper.gds; \
+		load caravel -dereference;\
+		select top cell;\
+		gds write $(UPRJ_ROOT)/gds/caravel.gds; \
+		exit;" > $(CARAVEL_ROOT)/mag/mag2gds_caravel.tcl
+### Runs from UPRJ_ROOT
+	@mkdir -p ./signoff/build
+	@cd $(CARAVEL_ROOT)/mag && PDKPATH=${PDK_ROOT}/sky130A magic -noc -dnull mag2gds_caravel.tcl 2>&1 | tee $(UPRJ_ROOT)/signoff/build/make_ship.out
+	@rm $(CARAVEL_ROOT)/mag/mag2gds_caravel.tcl
+
+.PHONY: clean
+clean:
+	cd $(CARAVEL_ROOT)/verilog/dv/caravel/mgmt_soc/ && \
+		$(MAKE) -j$(THREADS) clean
+	cd $(CARAVEL_ROOT)/verilog/dv/wb_utests/ && \
+		$(MAKE) -j$(THREADS) clean
+
+
+.PHONY: verify
+verify:
+	cd $(CARAVEL_ROOT)/verilog/dv/caravel/mgmt_soc/ && \
+		$(MAKE) -j$(THREADS) all
+	cd $(CARAVEL_ROOT)/verilog/dv/wb_utests/ && \
+		$(MAKE) -j$(THREADS) all
+
+
+
+#####
+$(LARGE_FILES_GZ): %.$(ARCHIVE_EXT): %
+	@if ! [ $(suffix $<) = ".$(ARCHIVE_EXT)" ]; then\
+		$(COMPRESS) $< > /dev/null &&\
+		echo "$< -> $@";\
+	fi
+
+$(LARGE_FILES_GZ_SPLIT): %.$(ARCHIVE_EXT).00.split: %.$(ARCHIVE_EXT)
+	@if [ -n "$$(find "$<" -prune -size +$(FILE_SIZE_LIMIT_MB)M)" ]; then\
+		split $< -b $(FILE_SIZE_LIMIT_MB)M $<. -d &&\
+		rm $< &&\
+		for file in $$(ls $<.*); do mv "$$file" "$$file.split"; done &&\
+		echo -n "$< -> $$(ls $<.*.split)" | tr '\n' ' ' && echo "";\
+	fi
+
+# This target compresses all files larger than $(FILE_SIZE_LIMIT_MB) MB
+.PHONY: compress
+compress: $(LARGE_FILES_GZ) $(LARGE_FILES_GZ_SPLIT)
+	@echo "Files larger than $(FILE_SIZE_LIMIT_MB) MBytes are compressed!"
+
+
+
+#####
+$(ARCHIVE_SOURCES): %: %.$(ARCHIVE_EXT)
+	@$(UNCOMPRESS) $<
+	@echo "$< -> $@"
+
+.SECONDEXPANSION:
+$(SPLIT_FILES_SOURCES): %: $$(sort $$(wildcard %.$(ARCHIVE_EXT).*.split))
+	@cat $? > $@.$(ARCHIVE_EXT)
+	@rm $?
+	@echo "$? -> $@.$(ARCHIVE_EXT)"
+	@$(UNCOMPRESS) $@.$(ARCHIVE_EXT)
+	@echo "$@.$(ARCHIVE_EXT) -> $@"
+
+
+.PHONY: uncompress
+uncompress: $(SPLIT_FILES_SOURCES) $(ARCHIVE_SOURCES)
+	@echo "All files are uncompressed!"
+
+
+# verify that the wrapper was respected
+xor-wrapper: uncompress
+### first erase the user's user_project_wrapper.gds
+	sh $(CARAVEL_ROOT)/utils/erase_box.sh gds/user_project_wrapper.gds 0 0 2920 3520
+### do the same for the empty wrapper
+	sh $(CARAVEL_ROOT)/utils/erase_box.sh $(CARAVEL_ROOT)/gds/user_project_wrapper_empty.gds 0 0 2920 3520
+	mkdir -p signoff/user_project_wrapper_xor
+### XOR the two resulting layouts
+	sh $(CARAVEL_ROOT)/utils/xor.sh \
+		$(CARAVEL_ROOT)/gds/user_project_wrapper_empty_erased.gds gds/user_project_wrapper_erased.gds \
+		user_project_wrapper user_project_wrapper.xor.xml
+	sh $(CARAVEL_ROOT)/utils/xor.sh \
+		$(CARAVEL_ROOT)/gds/user_project_wrapper_empty_erased.gds gds/user_project_wrapper_erased.gds \
+		user_project_wrapper gds/user_project_wrapper.xor.gds > signoff/user_project_wrapper_xor/xor.log 
+	rm $(CARAVEL_ROOT)/gds/user_project_wrapper_empty_erased.gds gds/user_project_wrapper_erased.gds
+	mv gds/user_project_wrapper.xor.gds gds/user_project_wrapper.xor.xml signoff/user_project_wrapper_xor
+	python $(CARAVEL_ROOT)/utils/parse_klayout_xor_log.py \
+		-l signoff/user_project_wrapper_xor/xor.log \
+		-o signoff/user_project_wrapper_xor/total.txt
+### screenshot the result for convenience
+	sh $(CARAVEL_ROOT)/utils/scrotLayout.sh \
+		$(PDK_ROOT)/sky130A/libs.tech/klayout/sky130A.lyt \
+		signoff/user_project_wrapper_xor/user_project_wrapper.xor.gds
+	@cat signoff/user_project_wrapper_xor/total.txt
+
+# verify that the wrapper was respected
+xor-analog-wrapper: uncompress
+### first erase the user's user_project_wrapper.gds
+	sh $(CARAVEL_ROOT)/utils/erase_box.sh gds/user_analog_project_wrapper.gds 0 0 2920 3520
+### do the same for the empty wrapper
+	sh $(CARAVEL_ROOT)/utils/erase_box.sh $(CARAVEL_ROOT)/gds/user_analog_project_wrapper_empty.gds 0 0 2920 3520
+	mkdir -p signoff/user_analog_project_wrapper_xor
+### XOR the two resulting layouts
+	sh $(CARAVEL_ROOT)/utils/xor.sh \
+		$(CARAVEL_ROOT)/gds/user_analog_project_wrapper_empty_erased.gds gds/user_analog_project_wrapper_erased.gds \
+		user_analog_project_wrapper user_analog_project_wrapper.xor.xml
+	sh $(CARAVEL_ROOT)/utils/xor.sh \
+		$(CARAVEL_ROOT)/gds/user_analog_project_wrapper_empty_erased.gds gds/user_analog_project_wrapper_erased.gds \
+		user_analog_project_wrapper gds/user_analog_project_wrapper.xor.gds > signoff/user_analog_project_wrapper_xor/xor.log 
+	rm $(CARAVEL_ROOT)/gds/user_analog_project_wrapper_empty_erased.gds gds/user_analog_project_wrapper_erased.gds
+	mv gds/user_analog_project_wrapper.xor.gds gds/user_analog_project_wrapper.xor.xml signoff/user_analog_project_wrapper_xor
+	python $(CARAVEL_ROOT)/utils/parse_klayout_xor_log.py \
+		-l signoff/user_analog_project_wrapper_xor/xor.log \
+		-o signoff/user_analog_project_wrapper_xor/total.txt
+### screenshot the result for convenience
+	sh $(CARAVEL_ROOT)/utils/scrotLayout.sh \
+		$(PDK_ROOT)/sky130A/libs.tech/klayout/sky130A.lyt \
+		signoff/user_analog_project_wrapper_xor/user_analog_project_wrapper.xor.gds
+	@cat signoff/user_analog_project_wrapper_xor/total.txt
+
+# LVS
+BLOCKS = $(shell cd openlane && find * -maxdepth 0 -type d)
+LVS_BLOCKS = $(foreach block, $(BLOCKS), lvs-$(block))
+$(LVS_BLOCKS): lvs-% : ./mag/%.mag ./verilog/gl/%.v
+	echo "Extracting $*"
+	mkdir -p ./mag/tmp
+	echo "addpath $(CARAVEL_ROOT)/mag/hexdigits;\
+		addpath \$$PDKPATH/libs.ref/sky130_ml_xx_hd/mag;\
+		load $* -dereference;\
+		select top cell;\
+		foreach cell [cellname list children] {\
+			load \$$cell -dereference;\
+			property LEFview TRUE;\
+		};\
+		load $* -dereference;\
+		select top cell;\
+		extract no all;\
+		extract do local;\
+		extract unique;\
+		extract;\
+		ext2spice lvs;\
+		ext2spice $*.ext;\
+		feedback save extract_$*.log;\
+		exit;" > ./mag/extract_$*.tcl
+	cd mag && \
+		export MAGTYPE=maglef; \
+		magic -rcfile ${PDK_ROOT}/sky130A/libs.tech/magic/sky130A.magicrc -noc -dnull extract_$*.tcl < /dev/null
+	mv ./mag/$*.spice ./spi/lvs
+	rm ./mag/*.ext
+	mv -f ./mag/extract_$*.tcl ./mag/tmp
+	mv -f ./mag/extract_$*.log ./mag/tmp
+	####
+	mkdir -p ./spi/lvs/tmp
+	sh $(CARAVEL_ROOT)/spi/lvs/run_lvs.sh ./spi/lvs/$*.spice ./verilog/gl/$*.v $*
+	@echo ""
+	python3 $(CARAVEL_ROOT)/scripts/count_lvs.py -f ./verilog/gl/$*.v_comp.json | tee ./spi/lvs/tmp/$*.lvs.summary.log
+	mv -f ./verilog/gl/*.out ./spi/lvs/tmp 2> /dev/null || true
+	mv -f ./verilog/gl/*.json ./spi/lvs/tmp 2> /dev/null || true
+	mv -f ./verilog/gl/*.log ./spi/lvs/tmp 2> /dev/null || true
+	@echo ""
+	@echo "LVS: ./spi/lvs/$*.spice vs. ./verilog/gl/$*.v"
+	@echo "Comparison result: ./spi/lvs/tmp/$*.v_comp.out"
+	@awk '/^NET mismatches/,0' ./spi/lvs/tmp/$*.v_comp.out
+
+
+LVS_GDS_BLOCKS = $(foreach block, $(BLOCKS), lvs-gds-$(block))
+$(LVS_GDS_BLOCKS): lvs-gds-% : ./gds/%.gds ./verilog/gl/%.v
+	echo "Extracting $*"
+	mkdir -p ./gds/tmp
+	echo "gds read ./$*.gds;\
+		load $* -dereference;\
+		select top cell;\
+		extract no all;\
+		extract do local;\
+		extract unique;\
+		extract;\
+		ext2spice lvs;\
+		ext2spice $*.ext;\
+		feedback save extract_$*.log;\
+		exit;" > ./gds/extract_$*.tcl
+	cd gds && \
+		magic -rcfile ${PDK_ROOT}/sky130A/libs.tech/magic/sky130A.magicrc -noc -dnull extract_$*.tcl < /dev/null
+	mv ./gds/$*.spice ./spi/lvs
+	rm ./gds/*.ext
+	mv -f ./gds/extract_$*.tcl ./gds/tmp
+	mv -f ./gds/extract_$*.log ./gds/tmp
+	####
+	mkdir -p ./spi/lvs/tmp
+	MAGIC_EXT_USE_GDS=1 sh $(CARAVEL_ROOT)/spi/lvs/run_lvs.sh ./spi/lvs/$*.spice ./verilog/gl/$*.v $*
+	@echo ""
+	python3 $(CARAVEL_ROOT)/scripts/count_lvs.py -f ./verilog/gl/$*.v_comp.json | tee ./spi/lvs/tmp/$*.lvs.summary.log
+	mv -f ./verilog/gl/*.out ./spi/lvs/tmp 2> /dev/null || true
+	mv -f ./verilog/gl/*.json ./spi/lvs/tmp 2> /dev/null || true
+	mv -f ./verilog/gl/*.log ./spi/lvs/tmp 2> /dev/null || true
+	@echo ""
+	@echo "LVS: ./spi/lvs/$*.spice vs. ./verilog/gl/$*.v"
+	@echo "Comparison result: ./spi/lvs/tmp/$*.v_comp.out"
+	@awk '/^NET mismatches/,0' ./spi/lvs/tmp/$*.v_comp.out
+
+
+# connect-by-label is enabled here!
+LVS_MAGLEF_BLOCKS = $(foreach block, $(BLOCKS), lvs-maglef-$(block))
+$(LVS_MAGLEF_BLOCKS): lvs-maglef-% : ./mag/%.mag ./verilog/gl/%.v
+	echo "Extracting $*"
+	mkdir -p ./maglef/tmp
+	echo "load $* -dereference;\
+		select top cell;\
+		foreach cell [cellname list children] {\
+			load \$$cell -dereference;\
+			property LEFview TRUE;\
+		};\
+		load $* -dereference;\
+		select top cell;\
+		extract no all;\
+		extract do local;\
+		extract;\
+		ext2spice lvs;\
+		ext2spice $*.ext;\
+		feedback save extract_$*.log;\
+		exit;" > ./mag/extract_$*.tcl
+	cd mag && export MAGTYPE=maglef; magic -noc -dnull extract_$*.tcl < /dev/null
+	mv ./mag/$*.spice ./spi/lvs
+	rm ./mag/*.ext
+	mv -f ./mag/extract_$*.tcl ./maglef/tmp
+	mv -f ./mag/extract_$*.log ./maglef/tmp
+	####
+	mkdir -p ./spi/lvs/tmp
+	sh $(CARAVEL_ROOT)/spi/lvs/run_lvs.sh ./spi/lvs/$*.spice ./verilog/gl/$*.v $*
+	@echo ""
+	python3 $(CARAVEL_ROOT)/scripts/count_lvs.py -f ./verilog/gl/$*.v_comp.json | tee ./spi/lvs/tmp/$*.maglef.lvs.summary.log
+	mv -f ./verilog/gl/*{.out,.json,.log} ./spi/lvs/tmp 2> /dev/null || true
+	@echo ""
+	@echo "LVS: ./spi/lvs/$*.spice vs. ./verilog/gl/$*.v"
+	@echo "Comparison result: ./spi/lvs/tmp/$*.v_comp.out"
+	@awk '/^NET mismatches/,0' ./spi/lvs/tmp/$*.v_comp.out
+
+# DRC
+BLOCKS = $(shell cd openlane && find * -maxdepth 0 -type d)
+DRC_BLOCKS = $(foreach block, $(BLOCKS), drc-$(block))
+$(DRC_BLOCKS): drc-% : ./gds/%.gds
+	echo "Running DRC on $*"
+	mkdir -p ./gds/tmp
+	cd gds && export DESIGN_IN_DRC=$* && export MAGTYPE=mag; magic -rcfile ${PDK_ROOT}/sky130A/libs.tech/magic/sky130A.magicrc -noc -dnull $(CARAVEL_ROOT)/gds/drc_on_gds.tcl < /dev/null
+	@echo "DRC result: ./gds/tmp/$*.drc"
+
+# Antenna
+BLOCKS = $(shell cd openlane && find * -maxdepth 0 -type d)
+ANTENNA_BLOCKS = $(foreach block, $(BLOCKS), antenna-$(block))
+$(ANTENNA_BLOCKS): antenna-% : ./gds/%.gds
+	echo "Running Antenna Checks on $*"
+	mkdir -p ./gds/tmp
+	cd gds && export DESIGN_IN_ANTENNA=$* && export MAGTYPE=mag; magic -rcfile ${PDK_ROOT}/sky130A/libs.tech/magic/sky130A.magicrc -noc -dnull $(CARAVEL_ROOT)/gds/antenna_on_gds.tcl < /dev/null 2>&1 | tee ./tmp/$*.antenna
+	mv -f ./gds/*.ext ./gds/tmp/
+	@echo "Antenna result: ./gds/tmp/$*.antenna"
+
+.PHONY: help
+help:
+	@$(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 '^$@$$'
+
+.PHONY: generate_fill
+generate_fill: check-env check-uid uncompress
+ifeq ($(FOREGROUND),1)
+	@echo "Running generate_fill in the foreground..."
+	$(MAKE) __generate_fill
+	@echo "Generate fill completed." 2>&1 | tee -a ./signoff/build/generate_fill.out
+else
+	@echo "Running generate_fill in the background..."
+	@nohup $(MAKE) __generate_fill >/dev/null 2>&1 &
+	tail -f signoff/build/generate_fill.out
+	@echo "Generate fill completed." | tee -a signoff/build/generate_fill.out
+endif
+
+__generate_fill:
+	@mkdir -p ./signoff/build
+	@cp -r $(CARAVEL_ROOT)/mag/.magicrc $(shell pwd)/mag
+	python3 $(CARAVEL_ROOT)/scripts/generate_fill.py $(USER_ID) $(shell pwd) -dist 2>&1 | tee ./signoff/build/generate_fill.out
+
+
+.PHONY: final
+final: check-env check-uid uncompress
+ifeq ($(FOREGROUND),1)
+	$(MAKE) __final
+	@echo "Final build completed." 2>&1 | tee -a ./signoff/build/final_build.out
+else
+	$(MAKE) __final >/dev/null 2>&1 &
+	tail -f signoff/build/final_build.out
+	@echo "Final build completed." 2>&1 | tee -a ./signoff/build/final_build.out
+endif
+
+__final:
+	mkdir -p ./mag/tmp 
+	cp -r ./mag/*.mag ./mag/tmp
+	cp -r $(CARAVEL_ROOT)/mag/* mag/tmp/
+	cp -r $(CARAVEL_ROOT)/mag/.magicrc mag/tmp/
+	sed -i 's@../gds@../../$(CARAVEL_ROOT)/gds@g' ./mag/tmp/*.mag
+	sed -i 's@../maglef@../../$(CARAVEL_ROOT)/maglef@g' ./mag/tmp/caravel.mag
+	sed -i 's@../subcells@../../$(CARAVEL_ROOT)/subcells@g' ./mag/tmp/.magicrc
+	python3 $(CARAVEL_ROOT)/scripts/compositor.py $(USER_ID) $(shell pwd) $(shell pwd)/mag/tmp $(shell pwd)/gds
+	@rm -rf ./mag/tmp
+
+.PHONY: set_user_id
+set_user_id: check-env check-uid uncompress
+ifeq ($(FOREGROUND),1)
+	$(MAKE) __set_user_id 
+	@echo "Set user ID completed." 2>&1 | tee -a ./signoff/build/set_user_id.out
+else
+	$(MAKE) __set_user_id >/dev/null 2>&1 &
+	tail -f signoff/build/set_user_id.out
+	@echo "Set user ID completed." 2>&1 | tee -a ./signoff/build/set_user_id.out
+endif
+
+__set_user_id: 
+	mkdir -p ./signoff/build
+	# Update info.yaml
+	sed -r "s/^(\s*project_id\s*:\s*).*/\1${USER_ID}/" -i info.yaml
+	python3 $(CARAVEL_ROOT)/scripts/set_user_id.py $(USER_ID) $(CARAVEL_ROOT) 2>&1 | tee ./signoff/build/set_user_id.out
+
+.PHONY: update_caravel
+update_caravel:
+	cd caravel/ && \
+		git checkout master && \
+		git pull
+
+###########################################################################
+.PHONY: pdk
+pdk: skywater-pdk skywater-library skywater-timing open_pdks build-pdk gen-sources
+
+$(PDK_ROOT)/skywater-pdk:
+	git clone https://github.com/google/skywater-pdk.git $(PDK_ROOT)/skywater-pdk
+
+.PHONY: skywater-pdk
+skywater-pdk: check-env $(PDK_ROOT)/skywater-pdk
+	cd $(PDK_ROOT)/skywater-pdk && \
+		git checkout main && git pull && \
+		git checkout -qf $(SKYWATER_COMMIT)
+
+.PHONY: skywater-library
+skywater-library: check-env $(PDK_ROOT)/skywater-pdk
+	cd $(PDK_ROOT)/skywater-pdk && \
+		git submodule update --init libraries/$(STD_CELL_LIBRARY)/latest && \
+		git submodule update --init libraries/$(IO_LIBRARY)/latest && \
+		git submodule update --init libraries/$(SPECIAL_VOLTAGE_LIBRARY)/latest && \
+		git submodule update --init libraries/$(PRIMITIVES_LIBRARY)/latest
+
+gen-sources: $(PDK_ROOT)/sky130A
+	touch $(PDK_ROOT)/sky130A/SOURCES
+	echo -ne "skywater-pdk " >> $(PDK_ROOT)/sky130A/SOURCES
+	cd $(PDK_ROOT)/skywater-pdk && git rev-parse HEAD >> $(PDK_ROOT)/sky130A/SOURCES
+	echo -ne "open_pdks " >> $(PDK_ROOT)/sky130A/SOURCES
+	cd $(PDK_ROOT)/open_pdks && git rev-parse HEAD >> $(PDK_ROOT)/sky130A/SOURCES
+
+skywater-timing: check-env $(PDK_ROOT)/skywater-pdk
+	cd $(PDK_ROOT)/skywater-pdk && \
+		$(MAKE) timing
+### OPEN_PDKS
+$(PDK_ROOT)/open_pdks:
+	git clone https://github.com/RTimothyEdwards/open_pdks.git $(PDK_ROOT)/open_pdks
+
+.PHONY: open_pdks
+open_pdks: check-env $(PDK_ROOT)/open_pdks
+	cd $(PDK_ROOT)/open_pdks && \
+		git checkout master && git pull && \
+		git checkout -qf $(OPEN_PDKS_COMMIT)
+
+.PHONY: build-pdk
+build-pdk: check-env $(PDK_ROOT)/open_pdks $(PDK_ROOT)/skywater-pdk
+	[ -d $(PDK_ROOT)/sky130A ] && \
+		(echo "Warning: A sky130A build already exists under $(PDK_ROOT). It will be deleted first!" && \
+		sleep 5 && \
+		rm -rf $(PDK_ROOT)/sky130A) || \
+		true
+	cd $(PDK_ROOT)/open_pdks && \
+		./configure --enable-sky130-pdk=$(PDK_ROOT)/skywater-pdk/libraries --with-sky130-local-path=$(PDK_ROOT) --disable-sram-sky130 && \
+		cd sky130 && \
+		$(MAKE) veryclean && \
+		$(MAKE) && \
+		$(MAKE) install-local && \
+		$(MAKE) clean
+
+.RECIPE: manifest
+manifest: mag/ maglef/ verilog/rtl/ scripts/ Makefile
+	touch manifest && \
+	find verilog/rtl/* -type f ! -name "caravel_netlists.v" ! -name "user_*.v" ! -name "README" ! -name "defines.v" -exec shasum {} \; > manifest && \
+	shasum scripts/set_user_id.py scripts/generate_fill.py scripts/compositor.py >> manifest
+# shasum lef/user_project_wrapper_empty.lef >> manifest
+# find maglef/*.mag -type f ! -name "user_project_wrapper.mag" -exec shasum {} \; >> manifest && \
+# shasum mag/caravel.mag mag/.magicrc >> manifest
+
+check-env:
+ifndef PDK_ROOT
+	$(error PDK_ROOT is undefined, please export it before running make)
+endif
+
+check-uid:
+ifndef USER_ID
+	$(error USER_ID is undefined, please export it before running make set_user_id)
+else 
+	@echo USER_ID is set to $(USER_ID)
+endif
+
+# Make README.rst
+README.rst: README.src.rst docs/source/getting-started.rst docs/source/tool-versioning.rst openlane/README.src.rst docs/source/caravel-with-openlane.rst Makefile
+	pip -q install rst_include && \
+	rm -f README.rst && \
+		rst_include include README.src.rst - | \
+			sed \
+				-e's@\.\/\_static@\/docs\/source\/\_static@g' \
+				-e's@:doc:`tool-versioning`@`tool-versioning.rst <./docs/source/tool-versioning.rst>`__@g' \
+				-e's@.. note::@**NOTE:**@g' \
+				-e's@.. warning::@**WARNING:**@g' \
+				> README.rst && \
+		rst_include include openlane/README.src.rst - | \
+			sed \
+				-e's@https://github.com/efabless/caravel/blob/master/verilog@../verilog@g' \
+				-e's@:ref:`getting-started`@`README.rst <../README.rst>`__@g' \
+				-e's@https://github.com/efabless/caravel/blob/master/openlane/@./@g' \
+				-e's@.. note::@**NOTE:**@g' \
+				-e's@.. warning::@**WARNING:**@g' \
+				> openlane/README.rst
diff --git a/caravel/info.yaml b/caravel/info.yaml
new file mode 100644
index 0000000..6acab21
--- /dev/null
+++ b/caravel/info.yaml
@@ -0,0 +1,19 @@
+---
+project:
+  description: "General Purpose Bandgap Reference"
+  foundry: "SkyWater"
+  git_url: "https://github.com/vsdip/avsdbgp_3v3_sky130_v2"
+  organization: "VLSI System Design Corp. Pvt. Ltd."
+  organization_url: "https://www.vlsisystemdesign.com/"
+  owner: "Anmol Purty"
+  process: "SKY130"
+  project_name: "avsdbgp_3v3_sky130_v2"
+  project_id: "00000000"
+  tags:
+    - "Open MPW"
+    - "Test Harness"
+  category: "Test Harness"
+  top_level_netlist: "caravel/verilog/gl/caravel.v"
+  user_level_netlist: "verilog/gl/user_project_wrapper.v"
+  version: "1.00"
+  cover_image: "docs/source/_static/caravel_harness.png"
diff --git a/caravel/manifest b/caravel/manifest
new file mode 100644
index 0000000..798bc8b
--- /dev/null
+++ b/caravel/manifest
@@ -0,0 +1,47 @@
+d328f88dd48e015bbaa95e0d7c88954343cc5632  verilog/rtl/DFFRAM.v
+dab57f3c5464ce3354219840dae589a3fcd27135  verilog/rtl/DFFRAMBB.v
+535d0592c0b1349489b6b86fd5449f9d1d81482e  verilog/rtl/__uprj_analog_netlists.v
+87735eb5981740ca4d4b48e6b0321c8bb0023800  verilog/rtl/__uprj_netlists.v
+ef9cf827273c2a245f807725f33bb3bc6e51ba54  verilog/rtl/__user_analog_project_wrapper.v
+c3616f10b8d437432a30dc0dbf2235d50c4f5847  verilog/rtl/__user_project_wrapper.v
+6229bc5cbbe404575340153b4274033ca8d66c38  verilog/rtl/caravan.v
+31775f9c43c80b137a1cbbc9dd78e4e96708a8e9  verilog/rtl/caravan_netlists.v
+6ff514c11754375cd9c86229d4466c071617e8c2  verilog/rtl/caravel.v
+b2feeb2a098894d5d731a5b011858a471e855d73  verilog/rtl/caravel_clocking.v
+7c4b2a8c1a70bbf13291f25973a4f776c804909e  verilog/rtl/chip_io.v
+a6f9dbe63659a716d85f646b14421b9ad0425186  verilog/rtl/chip_io_alt.v
+d772308bd2a72121d7ed9dcdd40c8e6cbbe4b43c  verilog/rtl/clock_div.v
+f937b52e53d45bdbe41bcbd07c65b41104c21756  verilog/rtl/convert_gpio_sigs.v
+21204dc96bdb3c1295dd06375293ee3d811d2f7e  verilog/rtl/counter_timer_high.v
+6b9b2ab85a85f73d6ce686c67fc85e59d9623ee6  verilog/rtl/counter_timer_low.v
+fff2d08e49701312c2ebd6714b7425baf83f3d35  verilog/rtl/digital_pll.v
+ce49f9af199b5f16d2c39c417d58e5890bc7bab2  verilog/rtl/digital_pll_controller.v
+89dee515f5819e4f5d572f9542ca19798f4b6c4e  verilog/rtl/gpio_control_block.v
+57554b3586f306944b31718a8c52526fa9a8a574  verilog/rtl/gpio_wb.v
+baf3aba29655ca7021398ddc3f68be81eff0fa0c  verilog/rtl/housekeeping_spi.v
+6c11ee92e0b2995982041d8a599b5d46b7dde838  verilog/rtl/la_wb.v
+ff3e65a783f3807340e25efac9207787d39fb6cd  verilog/rtl/mem_wb.v
+0894819fdfdcc1cb7a0fcacca3ac133f9884cc5a  verilog/rtl/mgmt_core.v
+65934e08f3ad2d5fbacd8fc68eae0bb485c25309  verilog/rtl/mgmt_protect.v
+3b1ff20593bc386d13f5e2cf1571f08121889957  verilog/rtl/mgmt_protect_hv.v
+85bc308843b6aad96ac9e75f49c942db8e1c0afe  verilog/rtl/mgmt_soc.v
+9816acedf3dc3edd193861cc217ec46180ac1cdd  verilog/rtl/mprj2_logic_high.v
+b4395fbd17108e58e33a620159464ae944a15878  verilog/rtl/mprj_ctrl.v
+a61f5566f5d369d879c47d6b65f99cf297debe8f  verilog/rtl/mprj_io.v
+b928ab6205a267f6ac83c603965c6f34a486724e  verilog/rtl/mprj_logic_high.v
+eac1e6d413cdfbc2f802e229ae5058828e01be1e  verilog/rtl/pads.v
+b5aff2fda5078cfda377b98337fcc91040815fc2  verilog/rtl/picorv32.v
+669d16642d5dd5f6824812754db20db98c9fe17b  verilog/rtl/ring_osc2x13.v
+6864cc10dacfd3edb4c66825b7a301ab097cea0d  verilog/rtl/simple_por.v
+917aa6e1bb869f973c79fb2c7894eab882ead74c  verilog/rtl/simple_spi_master.v
+d43221ffa0f2d760991d8b911b4a5292911203f5  verilog/rtl/simpleuart.v
+46bca62460c4dbfac30233318b24c3d526a40058  verilog/rtl/sky130_fd_sc_hvl__lsbufhv2lv_1_wrapped.v
+eb0c856ab69e8c364c04bdc149db9d82ae67b39d  verilog/rtl/spimemio.v
+3b4c3de623f8af0f0780f1e5b0f2217ef6406a2f  verilog/rtl/sram_1rw1r_32_256_8_sky130.v
+da42d868bfe847b83ed0a3e6e8307216a6f3fa21  verilog/rtl/storage.v
+7e8d789570ed224df49cf61f69593cc738790a5d  verilog/rtl/storage_bridge_wb.v
+5e314e94a13d7291117123395ae088e1d17cf487  verilog/rtl/sysctrl.v
+e6246df6bbf0860a331b3547d64f7d235b0eca9a  verilog/rtl/wb_intercon.v
+9d06bd68e8ec6918cd3ef5467cb8cee44e7e3a26  scripts/set_user_id.py
+be50a23e39bf13eed5090ac819b785afdba587b0  scripts/generate_fill.py
+e3793327393803e44a90a702c5413facbb4b46e8  scripts/compositor.py