OpenCores
URL https://opencores.org/ocsvn/yifive/yifive/trunk

Subversion Repositories yifive

[/] [yifive/] [trunk/] [caravel_yifive/] [Makefile] - Blame information for rev 23

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 dinesha
# SPDX-FileCopyrightText: 2020 Efabless Corporation
2
#
3
# Licensed under the Apache License, Version 2.0 (the "License");
4
# you may not use this file except in compliance with the License.
5
# You may obtain a copy of the License at
6
#
7
#      http://www.apache.org/licenses/LICENSE-2.0
8
#
9
# Unless required by applicable law or agreed to in writing, software
10
# distributed under the License is distributed on an "AS IS" BASIS,
11
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
# See the License for the specific language governing permissions and
13
# limitations under the License.
14
#
15
# SPDX-License-Identifier: Apache-2.0
16
 
17
CARAVEL_ROOT?=$(PWD)/caravel
18
PRECHECK_ROOT?=${HOME}/open_mpw_precheck
19
SIM ?= RTL
20
 
21
# Install lite version of caravel, (1): caravel-lite, (0): caravel
22
CARAVEL_LITE?=1
23
 
24
ifeq ($(CARAVEL_LITE),1)
25
        CARAVEL_NAME := caravel-lite
26
        CARAVEL_REPO := https://github.com/efabless/caravel-lite
27
        CARAVEL_BRANCH := main
28
else
29
        CARAVEL_NAME := caravel
30
        CARAVEL_REPO := https://github.com/efabless/caravel
31
        CARAVEL_BRANCH := master
32
endif
33
 
34
# Install caravel as submodule, (1): submodule, (0): clone
35
SUBMODULE?=1
36
 
37
# Include Caravel Makefile Targets
38
.PHONY: %
39
%:
40
        $(MAKE) -f $(CARAVEL_ROOT)/Makefile $@
41
 
42
# Verify Target for running simulations
43
.PHONY: verify
44
verify:
45
        cd ./verilog/dv/ && \
46
        export SIM=${SIM} && \
47
                $(MAKE) -j$(THREADS)
48
 
49
# Install DV setup
50
.PHONY: simenv
51
simenv:
52
        docker pull efabless/dv_setup:latest
53
 
54
PATTERNS=$(shell cd verilog/dv && find * -maxdepth 0 -type d)
55
DV_PATTERNS = $(foreach dv, $(PATTERNS), verify-$(dv))
56
TARGET_PATH=$(shell pwd)
57
PDK_PATH=${PDK_ROOT}/sky130A
58 23 dinesha
#dinesh-a: iverilog version inside the docker is not able to compile the rtl code
59
#  So We are running upto hex file generation inside docker and iverilog outside the docker
60
#VERIFY_COMMAND="cd ${TARGET_PATH}/verilog/dv/$* && export SIM=${SIM} && make"
61
VERIFY_COMMAND="cd ${TARGET_PATH}/verilog/dv/$* && export SIM=${SIM} && make hex"
62 2 dinesha
$(DV_PATTERNS): verify-% : ./verilog/dv/%
63
        docker run -v ${TARGET_PATH}:${TARGET_PATH} -v ${PDK_PATH}:${PDK_PATH} \
64
                -v ${CARAVEL_ROOT}:${CARAVEL_ROOT} \
65
                -e TARGET_PATH=${TARGET_PATH} -e PDK_PATH=${PDK_PATH} \
66
                -e CARAVEL_ROOT=${CARAVEL_ROOT} \
67
                -u $(id -u $$USER):$(id -g $$USER) efabless/dv_setup:latest \
68
                sh -c $(VERIFY_COMMAND)
69 23 dinesha
        cd ${TARGET_PATH}/verilog/dv/$* && $(MAKE) all
70 2 dinesha
 
71
# Openlane Makefile Targets
72
BLOCKS = $(shell cd openlane && find * -maxdepth 0 -type d)
73
.PHONY: $(BLOCKS)
74
$(BLOCKS): %:
75
        cd openlane && $(MAKE) $*
76
 
77
# Install caravel
78
.PHONY: install
79
install:
80
ifeq ($(SUBMODULE),1)
81
        @echo "Installing $(CARAVEL_NAME) as a submodule.."
82
# Convert CARAVEL_ROOT to relative path because .gitmodules doesn't accept '/'
83
        $(eval CARAVEL_PATH := $(shell realpath --relative-to=$(shell pwd) $(CARAVEL_ROOT)))
84
        @if [ ! -d $(CARAVEL_ROOT) ]; then git submodule add --name $(CARAVEL_NAME) $(CARAVEL_REPO) $(CARAVEL_PATH); fi
85
        @git submodule update --init
86
        @cd $(CARAVEL_ROOT); git checkout $(CARAVEL_BRANCH)
87
        $(MAKE) simlink
88
else
89
        @echo "Installing $(CARAVEL_NAME).."
90
        @git clone $(CARAVEL_REPO) $(CARAVEL_ROOT)
91
        @cd $(CARAVEL_ROOT); git checkout $(CARAVEL_BRANCH)
92
endif
93
 
94
# Create symbolic links to caravel's main files
95
.PHONY: simlink
96
simlink: check-caravel
97
### Symbolic links relative path to $CARAVEL_ROOT
98
        $(eval MAKEFILE_PATH := $(shell realpath --relative-to=openlane $(CARAVEL_ROOT)/openlane/Makefile))
99
        $(eval PIN_CFG_PATH  := $(shell realpath --relative-to=openlane/user_project_wrapper $(CARAVEL_ROOT)/openlane/user_project_wrapper_empty/pin_order.cfg))
100
        mkdir -p openlane
101
        mkdir -p openlane/user_project_wrapper
102
        cd openlane &&\
103
        ln -sf $(MAKEFILE_PATH) Makefile
104
        cd openlane/user_project_wrapper &&\
105
        ln -sf $(PIN_CFG_PATH) pin_order.cfg
106
 
107
# Update Caravel
108
.PHONY: update_caravel
109
update_caravel: check-caravel
110
ifeq ($(SUBMODULE),1)
111
        @git submodule update --init --recursive
112
        cd $(CARAVEL_ROOT) && \
113
        git checkout $(CARAVEL_BRANCH) && \
114
        git pull
115
else
116
        cd $(CARAVEL_ROOT)/ && \
117
                git checkout $(CARAVEL_BRANCH) && \
118
                git pull
119
endif
120
 
121
# Uninstall Caravel
122
.PHONY: uninstall
123
uninstall:
124
ifeq ($(SUBMODULE),1)
125
        git config -f .gitmodules --remove-section "submodule.$(CARAVEL_NAME)"
126
        git add .gitmodules
127
        git submodule deinit -f $(CARAVEL_ROOT)
128
        git rm --cached $(CARAVEL_ROOT)
129
        rm -rf .git/modules/$(CARAVEL_NAME)
130
        rm -rf $(CARAVEL_ROOT)
131
else
132
        rm -rf $(CARAVEL_ROOT)
133
endif
134
 
135
# Install Openlane
136
.PHONY: openlane
137
openlane:
138
        cd openlane && $(MAKE) openlane
139
 
140
# Install Pre-check
141
# Default installs to the user home directory, override by "export PRECHECK_ROOT="
142
.PHONY: precheck
143
precheck:
144
        @git clone https://github.com/efabless/open_mpw_precheck.git --depth=1 $(PRECHECK_ROOT)
145
        @docker pull efabless/open_mpw_precheck:latest
146
 
147
.PHONY: run-precheck
148
run-precheck: check-precheck check-pdk check-caravel
149
        $(eval TARGET_PATH := $(shell pwd))
150
        cd $(PRECHECK_ROOT) && \
151
        docker run -v $(PRECHECK_ROOT):/usr/local/bin -v $(TARGET_PATH):$(TARGET_PATH) -v $(PDK_ROOT):$(PDK_ROOT) -v $(CARAVEL_ROOT):$(CARAVEL_ROOT) \
152
        -u $(shell id -u $(USER)):$(shell id -g $(USER)) efabless/open_mpw_precheck:latest bash -c "python3 open_mpw_prechecker.py --pdk_root $(PDK_ROOT) --target_path $(TARGET_PATH) -rfc -c $(CARAVEL_ROOT) "
153
 
154
# Install PDK using OL's Docker Image
155
.PHONY: pdk-nonnative
156
pdk-nonnative: skywater-pdk skywater-library skywater-timing open_pdks
157
        docker run --rm -v $(PDK_ROOT):$(PDK_ROOT) -v $(pwd):/user_project -v $(CARAVEL_ROOT):$(CARAVEL_ROOT) -e CARAVEL_ROOT=$(CARAVEL_ROOT) -e PDK_ROOT=$(PDK_ROOT) -u $(shell id -u $(USER)):$(shell id -g $(USER)) efabless/openlane:current sh -c "cd $(CARAVEL_ROOT); make build-pdk; make gen-sources"
158
 
159
# Clean
160
.PHONY: clean
161
clean:
162
        cd ./verilog/dv/ && \
163
                $(MAKE) -j$(THREADS) clean
164
 
165
check-caravel:
166
        @if [ ! -d "$(CARAVEL_ROOT)" ]; then \
167
                echo "Caravel Root: "$(CARAVEL_ROOT)" doesn't exists, please export the correct path before running make. "; \
168
                exit 1; \
169
        fi
170
 
171
check-precheck:
172
        @if [ ! -d "$(PRECHECK_ROOT)" ]; then \
173
                echo "Pre-check Root: "$(PRECHECK_ROOT)" doesn't exists, please export the correct path before running make. "; \
174
                exit 1; \
175
        fi
176
 
177
check-pdk:
178
        @if [ ! -d "$(PDK_ROOT)" ]; then \
179
                echo "PDK Root: "$(PDK_ROOT)" doesn't exists, please export the correct path before running make. "; \
180
                exit 1; \
181
        fi
182
 
183
.PHONY: help
184
help:
185
        cd $(CARAVEL_ROOT) && $(MAKE) help
186
        @$(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 '^$@$$'

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.