Add pdk build target to the Makefile and explain usage in the doc.
diff --git a/Makefile b/Makefile
index e0a9e5c..4513822 100644
--- a/Makefile
+++ b/Makefile
@@ -6,14 +6,18 @@
ARCHIVES := $(shell find . -type f -name "*.gz")
ARCHIVE_SOURCES := $(basename $(ARCHIVES))
+# 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
+SKYWATER_COMMIT ?= ca58d58c07ab2dac53488df393da633fd5fb9a02
+OPEN_PDKS_COMMIT ?= b427e3bd10dcdc36891ae270a1ef0bd02602c553
.DEFAULT_GOAL := ship
# We need portable GDS_FILE pointers...
.PHONY: ship
-ship: uncompress
- ifndef PDK_ROOT
- $(error PDK_ROOT is undefined, please export it before running make)
- endif
+ship: check-env uncompress
@echo "###############################################"
@echo "Generating Caravel GDS (sources are in the 'gds' directory)"
@sleep 1
@@ -53,3 +57,50 @@
.PHONY: uncompress
uncompress: $(ARCHIVE_SOURCES)
@echo "All files are uncompressed!"
+
+.PHONY: pdk
+pdk: skywater-pdk skywater-library open_pdks build-pdk
+
+$(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 -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 && \
+ $(MAKE) -j$(THREADS) 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 -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 --with-sky130-source=$(PDK_ROOT)/skywater-pdk/libraries --with-sky130-local-path=$(PDK_ROOT) && \
+ cd sky130 && \
+ $(MAKE) veryclean && \
+ $(MAKE) && \
+ $(MAKE) install-local
+
+check-env:
+ifndef PDK_ROOT
+ $(error PDK_ROOT is undefined, please export it before running make)
+endif
\ No newline at end of file
diff --git a/README.md b/README.md
index 3e002ed..d05d9aa 100644
--- a/README.md
+++ b/README.md
@@ -15,19 +15,19 @@
make uncompress
```
+Install the required version of the PDK by running the following commands:
+
+```bash
+export PDK_ROOT=<The place where you want to install the pdk>
+make pdk
+```
+
Then, you can learn more about the caravel chip by watching these video:
- Caravel User Project Features -- https://youtu.be/zJhnmilXGPo
- Aboard Caravel -- How to put your design on Caravel? -- https://youtu.be/9QV8SDelURk
- Things to Clarify About Caravel -- What versions to use with Caravel? -- https://youtu.be/-LZ522mxXMw
## Aboard Caravel:
-### Versions:
-- [OpenLANE](https://github.com/efabless/openlane) rc4 or rc5.
-- latest [Skywater-pdk](https://github.com/google/skywater-pdk).
- - sky130_fd_sc_hd
- - sky130_fd_sc_hvl
- - sky130_fd_io
-- latest [open_pdks](https://github.com/RTimothyEdwards/open_pdks).
Your area is the full user_project_wrapper, so feel free to add your project there or create a differnt macro and harden it seperately then insert it into the user_project_wrapper.
@@ -41,7 +41,7 @@
Run the following command:
```bash
-export PDK_ROOT=<The place where the installed pdk resides>
+export PDK_ROOT=<The place where the installed pdk resides. The same PDK_ROOT used in the pdk installation step>
make
```