blob: 4bbbc5d8c9a8e395bf49b7d997d5236481e9c59f [file] [log] [blame]
Mohamed Kassem6f2fcd22021-04-19 10:14:19 -07001.. raw:: html
2
3 <!---
4 # SPDX-FileCopyrightText: 2020 Efabless Corporation
5 #
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
9 #
10 # http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 #
18 # SPDX-License-Identifier: Apache-2.0
19 -->
20
21Caravel User Project
22====================
23
manarabdelatyd0e7afb2021-04-22 00:21:13 +020024|License| |User CI| |Caravel Build|
Mohamed Kassem6f2fcd22021-04-19 10:14:19 -070025
26Table of contents
27=================
28
29- `Overview <#overview>`__
manarabdelatyd0e7afb2021-04-22 00:21:13 +020030- `Install Caravel <#install-caravel>`__
Mohamed Kassem6f2fcd22021-04-19 10:14:19 -070031- `Caravel Integration <#caravel-integration>`__
32
33 - `Repo Integration <#repo-integration>`__
34 - `Verilog Integration <#verilog-integration>`__
35
36- `Running Full Chip Simulation <#running-full-chip-simulation>`__
37- `Hardening the User Project Macro using
38 Openlane <#hardening-the-user-project-macro-using-openlane>`__
39- `Checklist for Open-MPW
40 Submission <#checklist-for-open-mpw-submission>`__
41
42Overview
43========
44
45This repo contains a sample user project that utilizes the
46`caravel <https://github.com/efabless/caravel.git>`__ chip user space.
47The user project is a simple counter that showcases how to make use of
48`caravel's <https://github.com/efabless/caravel.git>`__ user space
49utilities like IO pads, logic analyzer probes, and wishbone port. The
50repo also demonstrates the recommended structure for the open-mpw
51shuttle projects.
52
manarabdelatyd8dd0102021-04-30 08:40:52 +020053Prerequisites
54=============
55
56- Docker
57
manarabdelatyd0e7afb2021-04-22 00:21:13 +020058Install Caravel
59===============
60
61To setup caravel, run the following:
62
63.. code:: bash
64
65 # By default, CARAVEL_ROOT is set to $(pwd)/caravel
66 # If you want to install caravel at a different location, run "export CARAVEL_ROOT=<caravel-path>"
67 # Disable submodule installation if needed by, run "export SUBMODULE=0"
Mohamed Kassem9ae1f072021-04-23 12:19:31 -070068
manarabdelaty0218c0f2021-04-29 18:31:49 +020069 git clone https://github.com/efabless/caravel_user_project.git
Mohamed Kassem9ae1f072021-04-23 12:19:31 -070070 cd caravel_user_project
manarabdelatyd0e7afb2021-04-22 00:21:13 +020071 make install
72
73To update the installed caravel to the latest, run:
74
75.. code:: bash
76
77 make update_caravel
78
79To remove caravel, run
80
81.. code:: bash
82
83 make uninstall
84
85By default
86`caravel-lite <https://github.com/efabless/caravel-lite.git>`__ is
87installed. To install the full version of caravel, run this prior to
88calling make install.
89
90.. code:: bash
91
92 export CARAVEL_LITE=0
93
Mohamed Kassem6f2fcd22021-04-19 10:14:19 -070094Caravel Integration
95===================
96
97Repo Integration
98----------------
99
100Caravel files are kept separate from the user project by having caravel
manarabdelatyd0e7afb2021-04-22 00:21:13 +0200101as submodule. The submodule commit should point to the latest of
102caravel/caravel-lite master. The following files should have a symbolic
103link to `caravel's <https://github.com/efabless/caravel.git>`__
104corresponding files:
Mohamed Kassem6f2fcd22021-04-19 10:14:19 -0700105
106- `Openlane Makefile <openlane/Makefile>`__: This provides an easier
manarabdelatyd0e7afb2021-04-22 00:21:13 +0200107 way for running openlane to harden your macros. Refer to `Hardening
108 the User Project Macro using
109 Openlane <#hardening-the-user-project-macro-using-openlane>`__. Also,
110 the makefile retains the openlane summary reports under the signoff
111 directory.
Mohamed Kassem6f2fcd22021-04-19 10:14:19 -0700112
113- `Pin order <openlane/user_project_wrapper/pin_order.cfg>`__ file for
114 the user wrapper: The hardened user project wrapper macro must have
115 the same pin order specified in caravel's repo. Failing to adhere to
116 the same order will fail the gds integration of the macro with
117 caravel's back-end.
118
manarabdelatyd0e7afb2021-04-22 00:21:13 +0200119The symbolic links are automatically set when you run ``make install``.
Mohamed Kassem6f2fcd22021-04-19 10:14:19 -0700120
121Verilog Integration
122-------------------
123
124You need to create a wrapper around your macro that adheres to the
125template at
126`user\_project\_wrapper <caravel/verilog/rtl/__user_project_wrapper.v>`__.
127The wrapper top module must be named ``user_project_wrapper`` and must
128have the same input and output ports. The wrapper gives access to the
129user space utilities provided by caravel like IO ports, logic analyzer
130probes, and wishbone bus connection to the management SoC.
131
132For this sample project, the user macro makes use of:
133
134- The IO ports for displaying the count register values on the IO pads.
135
136- The LA probes for supplying an optional reset and clock signals and
137 for setting an initial value for the count register.
138
matt venn4acd8b72021-04-27 11:34:42 +0200139- The wishbone port for reading/writing the count value through the
Mohamed Kassem6f2fcd22021-04-19 10:14:19 -0700140 management SoC.
141
142Refer to `user\_project\_wrapper <verilog/rtl/user_project_wrapper.v>`__
143for more information.
144
145.. raw:: html
146
147 <p align="center">
148 <img src="./_static/counter_32.png" width="50%" height="50%">
149 </p>
manarabdelatyd0e7afb2021-04-22 00:21:13 +0200150
Mohamed Kassem6f2fcd22021-04-19 10:14:19 -0700151.. raw:: html
152
153 </p>
154
manarabdelatyd8dd0102021-04-30 08:40:52 +0200155Building the PDK
156================
Mohamed Kassem6f2fcd22021-04-19 10:14:19 -0700157
manarabdelatyd8dd0102021-04-30 08:40:52 +0200158You have two options for building the pdk:
manarabdelatyd0e7afb2021-04-22 00:21:13 +0200159
manarabdelatyd8dd0102021-04-30 08:40:52 +0200160- Build the pdk natively.
manarabdelatyd0e7afb2021-04-22 00:21:13 +0200161
manarabdelatyd8dd0102021-04-30 08:40:52 +0200162Make sure you have `Magic VLSI Layout Tool <http://opencircuitdesign.com/magic/index.html>`__ installed on your machine before building the pdk.
manarabdelatyd0e7afb2021-04-22 00:21:13 +0200163
164.. code:: bash
165
166 # set PDK_ROOT to the path you wish to use for the pdk
167 export PDK_ROOT=<pdk-installation-path>
168
169 # you can optionally specify skywater-pdk and open-pdks commit used
170 # by setting and exporting SKYWATER_COMMIT and OPEN_PDKS_COMMIT
171 # if you do not set them, they default to the last verfied commits tested for this project
172
173 make pdk
174
manarabdelatyd8dd0102021-04-30 08:40:52 +0200175- Build the pdk using openlane's docker image which has magic installed.
176
177.. code:: bash
178
179 # set PDK_ROOT to the path you wish to use for the pdk
180 export PDK_ROOT=<pdk-installation-path>
181
182 # you can optionally specify skywater-pdk and open-pdks commit used
183 # by setting and exporting SKYWATER_COMMIT and OPEN_PDKS_COMMIT
184 # if you do not set them, they default to the last verfied commits tested for this project
185
186 make pdk-nonnative
187
188Running Full Chip Simulation
189============================
190
191First, you will need to install the simulation environment, by
192
193.. code:: bash
194
195 make simenv
196
197This will pull a docker image with the needed tools installed.
198
manarabdelatyd0e7afb2021-04-22 00:21:13 +0200199Then, run the RTL and GL simulation by
200
201.. code:: bash
202
203 export PDK_ROOT=<pdk-installation-path>
204 export CARAVEL_ROOT=$(pwd)/caravel
205 # specify simulation mode: RTL/GL
206 export SIM=RTL
207 # Run IO ports testbench, make verify-io_ports
208 make verify-<dv-pattern>
209
210The verilog test-benches are under this directory
Manarffaf9842021-04-30 22:55:37 +0200211`verilog/dv <https://github.com/efabless/caravel_user_project/tree/main/verilog/dv>`__. For more information on setting up the
manarabdelatyd0e7afb2021-04-22 00:21:13 +0200212simulation environment and the available testbenches for this sample
Manarffaf9842021-04-30 22:55:37 +0200213project, refer to `README <https://github.com/efabless/caravel_user_project/blob/main/verilog/dv/README.md>`__.
Mohamed Kassem6f2fcd22021-04-19 10:14:19 -0700214
215Hardening the User Project Macro using Openlane
216===============================================
217
manarabdelatyd8dd0102021-04-30 08:40:52 +0200218You will need to install openlane by running the following
manarabdelatyd0e7afb2021-04-22 00:21:13 +0200219
220.. code:: bash
221
manarabdelaty0218c0f2021-04-29 18:31:49 +0200222 export OPENLANE_ROOT=<openlane-installation-path>
223 export OPENLANE_TAG=<latest-openlane-tag>
224 make openlane
manarabdelatyd0e7afb2021-04-22 00:21:13 +0200225
226For detailed instructions on how to install openlane and the pdk refer
227to
Mohamed Kassem6f2fcd22021-04-19 10:14:19 -0700228`README <https://github.com/efabless/openlane/blob/master/README.md>`__.
229
230There are two options for hardening the user project macro using
231openlane:
232
2331. Hardening the user macro, then embedding it in the wrapper
2342. Flattening the user macro with the wrapper.
235
236For more details on this, refer to this
manarabdelatyd0e7afb2021-04-22 00:21:13 +0200237`README <https://github.com/efabless/caravel/blob/master/openlane/README.rst>`__.
Mohamed Kassem6f2fcd22021-04-19 10:14:19 -0700238
239For this sample project, we went for the first option where the user
240macro is hardened first, then it is inserted in the user project
241wrapper.
242
243.. raw:: html
244
245 <p align="center">
246 <img src="./_static/wrapper.png" width="50%" height="50%">
247 </p>
248
manarabdelatyd0e7afb2021-04-22 00:21:13 +0200249.. raw:: html
250
251 </p>
252
Mohamed Kassem6f2fcd22021-04-19 10:14:19 -0700253To reproduce hardening this project, run the following:
254
255.. code:: bash
256
manarabdelaty0218c0f2021-04-29 18:31:49 +0200257 # Run openlane to harden user_proj_example
258 make user_proj_example
259 # Run openlane to harden user_project_wrapper
260 make user_project_wrapper
261
262
manarabdelaty0218c0f2021-04-29 18:31:49 +0200263Running Open-MPW Precheck Locally
264=================================
265
266You can install the precheck by running
267
268.. code:: bash
269
270 # By default, this install the precheck in your home directory
271 # To change the installtion path, run "export PRECHECK_ROOT=<precheck installation path>"
272 make precheck
273
274This will clone the precheck repo and pull the latest precheck docker image.
275
276
277Then, you can run the precheck by running
manarabdelatyd8dd0102021-04-30 08:40:52 +0200278Specify CARAVEL_ROOT before running any of the following,
manarabdelaty0218c0f2021-04-29 18:31:49 +0200279
280.. code:: bash
281
manarabdelatyd8dd0102021-04-30 08:40:52 +0200282 # export CARAVEL_ROOT=$(pwd)/caravel
283 export CARAVEL_ROOT=<path-to-caravel>
manarabdelaty0218c0f2021-04-29 18:31:49 +0200284 make run-precheck
285
286This will run all the precheck checks on your project and will produce the logs under the ``checks`` directory.
287
288
289Other Miscellaneous Targets
290============================
291
292The makefile provides a number of useful that targets that can run LVS, DRC, and XOR checks on your hardened design outside of openlane's flow.
293
294Run ```make help`` to display available targets.
295
296Specify CARAVEL_ROOT before running any of the following,
297
298.. code:: bash
manarabdelatyd8dd0102021-04-30 08:40:52 +0200299
300 # export CARAVEL_ROOT=$(pwd)/caravel
manarabdelaty0218c0f2021-04-29 18:31:49 +0200301 export CARAVEL_ROOT=<path-to-caravel>
302
303Run lvs on spice,
304
305.. code:: bash
306
307 make lvs-<macro_name>
308
309Run lvs on the gds,
310
311.. code:: bash
312
313 make lvs-gds-<macro_name>
314
315Run lvs on the maglef,
316
317.. code:: bash
318
319 make lvs-maglef-<macro_name>
320
321Run drc using magic,
322
323.. code:: bash
324
325 make drc-<macro_name>
326
327Run antenna check using magic,
328
329.. code:: bash
330
331 make antenna-<macro_name>
332
333Run XOR check,
334
335.. code:: bash
336
337 make xor-wrapper
338
Mohamed Kassem6f2fcd22021-04-19 10:14:19 -0700339
340Checklist for Open-MPW Submission
341=================================
342
343- [x] The project repo adheres to the same directory structure in this
344 repo.
345- [x] The project repo contain info.yaml at the project root.
346- [x] Top level macro is named ``user_project_wrapper``.
347- [x] Full Chip Simulation passes for RTL and GL (gate-level)
348- [x] The hardened Macros are LVS and DRC clean
349- [x] The hardened ``user_project_wrapper`` adheres to the same pin
350 order specified at
351 `pin\_order <https://github.com/efabless/caravel/blob/master/openlane/user_project_wrapper_empty/pin_order.cfg>`__
352- [x] XOR check passes with zero total difference.
353- [x] Openlane summary reports are retained under ./signoff/
354
355.. |License| image:: https://img.shields.io/badge/License-Apache%202.0-blue.svg
356 :target: https://opensource.org/licenses/Apache-2.0
manarabdelatyd0e7afb2021-04-22 00:21:13 +0200357.. |User CI| image:: https://github.com/efabless/caravel_project_example/actions/workflows/user_project_ci.yml/badge.svg
358 :target: https://github.com/efabless/caravel_project_example/actions/workflows/user_project_ci.yml
359.. |Caravel Build| image:: https://github.com/efabless/caravel_project_example/actions/workflows/caravel_build.yml/badge.svg
Mohamed Kassem9ae1f072021-04-23 12:19:31 -0700360 :target: https://github.com/efabless/caravel_project_example/actions/workflows/caravel_build.yml