Add default target to "load" user design on caravel
- Also, don't save timestamp when gzipping files
diff --git a/Makefile b/Makefile
index 4a3ddd6..59724a4 100644
--- a/Makefile
+++ b/Makefile
@@ -6,6 +6,22 @@
ARCHIVES := $(shell find . -type f -name "*.gz")
ARCHIVE_SOURCES := $(basename $(ARCHIVES))
+ifndef PDK_ROOT
+$(error PDK_ROOT is undefined, please export it before running make)
+endif
+
+.DEFAULT_GOAL := ship
+
+# We need portable GDS_FILE pointers...
+.PHONY: ship
+ship: uncompress
+ @echo "###############################################"
+ @echo "Generating Caravel GDS (sources are in the 'gds' directory)"
+ @sleep 1
+ @cd mag && MAGTYPE=mag magic -rcfile ${PDK_ROOT}/sky130A/libs.tech/magic/current/sky130A.magicrc -noc -dnull mag2gds.tcl < /dev/null
+ mv mag/caravel_out.gds gds
+
+
.PHONY: clean
clean:
echo "clean"
@@ -19,10 +35,8 @@
$(LARGE_FILES_GZ): %.gz: %
- @if [ $(suffix $<) == ".gz" ]; then\
- echo "Warning: $< is already compressed. Skipping...";\
- else\
- gzip $< > /dev/null &&\
+ @if ! [ $(suffix $<) == ".gz" ]; then\
+ gzip -n $< > /dev/null &&\
echo "$< -> $@";\
fi
@@ -34,7 +48,7 @@
$(ARCHIVE_SOURCES): %: %.gz
- @gzip -d $< &&\
+ gzip -d $< &&\
echo "$< -> $@"
.PHONY: uncompress
diff --git a/mag/mag2gds.tcl b/mag/mag2gds.tcl
new file mode 100644
index 0000000..8fb640c
--- /dev/null
+++ b/mag/mag2gds.tcl
@@ -0,0 +1,32 @@
+drc off
+gds readonly true
+gds rescale false
+
+# Switch to GDS only (currently magic hangs if all statements are gds read?)
+load chip_io -dereference
+
+load gpio_control_block -dereference
+
+load mgmt_protect -dereference
+
+load simple_por -dereference
+
+load digital_pll -dereference
+load DFFRAM -dereference
+load mgmt_core -dereference
+
+gds read ../gds/sram_1rw1r_32_256_8_sky130_lp1.gds
+load storage -dereference
+
+load user_id_programming -dereference
+
+# Your project goes aboard here
+gds read ../gds/user_project_wrapper.gds
+
+load caravel -dereference
+
+select top cell
+
+# cif *hier write disable
+
+gds write caravel_out.gds