Merge pull request #3 from Manarabdelaty/patch_1
Update Makefile PDK_PATH and Add .gitignore for precheck results directory
diff --git a/.github/scripts/dv/run-dv-wrapper.sh b/.github/scripts/dv/run-dv-wrapper.sh
index f431eca..20bc951 100644
--- a/.github/scripts/dv/run-dv-wrapper.sh
+++ b/.github/scripts/dv/run-dv-wrapper.sh
@@ -32,8 +32,8 @@
cd ..
-export PDK_PATH=$(pwd)/pdks/sky130A
-if [ ! -d $PDK_PATH ]
+export PDK_ROOT=$(pwd)/pdks
+if [ ! -d $PDK_ROOT ]
then
echo "Directory /path/to/dir DOES NOT exists."
exit 9999
@@ -48,12 +48,12 @@
for id in "${DV_TEST_IDS[@]}"
do
- docker run -v $TARGET_PATH:$TARGET_PATH -v $PDK_PATH:$PDK_PATH \
+ docker run -v $TARGET_PATH:$TARGET_PATH -v $PDK_ROOT:$PDK_ROOT \
-v $CARAVEL_ROOT:$CARAVEL_ROOT \
- -e TARGET_PATH=$TARGET_PATH -e PDK_PATH=$PDK_PATH \
+ -e TARGET_PATH=$TARGET_PATH -e PDK_ROOT=$PDK_ROOT \
-e CARAVEL_ROOT=$CARAVEL_ROOT \
-u $(id -u $USER):$(id -g $USER) efabless/dv_setup:latest \
- bash -c "bash $TARGET_PATH/.github/scripts/dv/run-dv.sh $PDK_PATH $DV_PATH $id $SIM_MODE"
+ bash -c "bash $TARGET_PATH/.github/scripts/dv/run-dv.sh $PDK_ROOT $DV_PATH $id $SIM_MODE"
echo "DONE!"
diff --git a/.github/scripts/dv/run-dv.sh b/.github/scripts/dv/run-dv.sh
index 125cf3c..53b7e96 100644
--- a/.github/scripts/dv/run-dv.sh
+++ b/.github/scripts/dv/run-dv.sh
@@ -1,4 +1,4 @@
-PDK_PATH=$1
+PDK_ROOT=$1
DV_PATH=$2
DV_TEST_ID=$3
SIM_MODE=$4
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..f4e486c
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+precheck_results
\ No newline at end of file
diff --git a/verilog/dv/mprj_por/Makefile b/verilog/dv/mprj_por/Makefile
index e54380b..5d0825f 100644
--- a/verilog/dv/mprj_por/Makefile
+++ b/verilog/dv/mprj_por/Makefile
@@ -14,6 +14,9 @@
#
# SPDX-License-Identifier: Apache-2.0
+## PDK
+PDK_PATH = $(PDK_ROOT)/sky130A
+
## Caravel Pointers
CARAVEL_ROOT ?= ../../../caravel
CARAVEL_PATH ?= $(CARAVEL_ROOT)
@@ -30,9 +33,9 @@
## RISCV GCC
GCC_PATH?=/ef/apps/bin
GCC_PREFIX?=riscv32-unknown-elf
-PDK_PATH?=/ef/tech/SW/sky130A
## Simulation mode: RTL/GL
+SIM_DEFINES = -DFUNCTIONAL -DSIM
SIM?=RTL
.SUFFIXES:
@@ -45,12 +48,12 @@
%.vvp: %_tb.v %.hex
ifeq ($(SIM),RTL)
- iverilog -DFUNCTIONAL -DSIM -I $(PDK_PATH) \
+ iverilog $(SIM_DEFINES) -I $(PDK_PATH) \
-I $(CARAVEL_BEHAVIOURAL_MODELS) -I $(CARAVEL_RTL_PATH) \
-I $(UPRJ_BEHAVIOURAL_MODELS) -I $(UPRJ_RTL_PATH) \
$< -o $@
else
- iverilog -DFUNCTIONAL -DSIM -DGL -I $(PDK_PATH) \
+ iverilog $(SIM_DEFINES) -DGL -I $(PDK_PATH) \
-I $(CARAVEL_BEHAVIOURAL_MODELS) -I $(CARAVEL_RTL_PATH) -I $(CARAVEL_VERILOG_PATH) \
-I $(UPRJ_BEHAVIOURAL_MODELS) -I$(UPRJ_RTL_PATH) -I $(UPRJ_VERILOG_PATH) \
$< -o $@
@@ -59,7 +62,7 @@
%.vcd: %.vvp
vvp $<
-%.elf: %.c $(CARAVEL_FIRMWARE_PATH)/sections.lds $(CARAVEL_FIRMWARE_PATH)/start.s
+%.elf: %.c $(CARAVEL_FIRMWARE_PATH)/sections.lds $(CARAVEL_FIRMWARE_PATH)/start.s check-env
${GCC_PATH}/${GCC_PREFIX}-gcc -I $(CARAVEL_PATH) -march=rv32imc -mabi=ilp32 -Wl,-Bstatic,-T,$(CARAVEL_FIRMWARE_PATH)/sections.lds,--strip-debug -ffreestanding -nostdlib -o $@ $(CARAVEL_FIRMWARE_PATH)/start.s $<
%.hex: %.elf
@@ -70,6 +73,21 @@
%.bin: %.elf
${GCC_PATH}/${GCC_PREFIX}-objcopy -O binary $< /dev/stdout | tail -c +1048577 > $@
+check-env:
+ifndef PDK_ROOT
+ $(error PDK_ROOT is undefined, please export it before running make)
+endif
+ifeq (,$(wildcard $(PDK_ROOT)/sky130A))
+ $(error $(PDK_ROOT)/sky130A not found, please install pdk before running make)
+endif
+ifeq (,$(wildcard $(GCC_PATH)/$(GCC_PREFIX)-gcc ))
+ $(error $(GCC_PATH)/$(GCC_PREFIX)-gcc is not found, please export GCC_PATH and GCC_PREFIX before running make)
+endif
+# check for efabless style installation
+ifeq (,$(wildcard $(PDK_ROOT)/sky130A/libs.ref/*/verilog))
+SIM_DEFINES := ${SIM_DEFINES} -DEF_STYLE
+endif
+
# ---- Clean ----
clean: