blob: 83f8f0a40efbe5d36881125bccfdd0c9ea35dd22 [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
manarabdelatyd0e7afb2021-04-22 00:21:13 +020053Install Caravel
54===============
55
56To setup caravel, run the following:
57
58.. code:: bash
59
60 # By default, CARAVEL_ROOT is set to $(pwd)/caravel
61 # If you want to install caravel at a different location, run "export CARAVEL_ROOT=<caravel-path>"
62 # Disable submodule installation if needed by, run "export SUBMODULE=0"
63
64 make install
65
66To update the installed caravel to the latest, run:
67
68.. code:: bash
69
70 make update_caravel
71
72To remove caravel, run
73
74.. code:: bash
75
76 make uninstall
77
78By default
79`caravel-lite <https://github.com/efabless/caravel-lite.git>`__ is
80installed. To install the full version of caravel, run this prior to
81calling make install.
82
83.. code:: bash
84
85 export CARAVEL_LITE=0
86
Mohamed Kassem6f2fcd22021-04-19 10:14:19 -070087Caravel Integration
88===================
89
90Repo Integration
91----------------
92
93Caravel files are kept separate from the user project by having caravel
manarabdelatyd0e7afb2021-04-22 00:21:13 +020094as submodule. The submodule commit should point to the latest of
95caravel/caravel-lite master. The following files should have a symbolic
96link to `caravel's <https://github.com/efabless/caravel.git>`__
97corresponding files:
Mohamed Kassem6f2fcd22021-04-19 10:14:19 -070098
99- `Openlane Makefile <openlane/Makefile>`__: This provides an easier
manarabdelatyd0e7afb2021-04-22 00:21:13 +0200100 way for running openlane to harden your macros. Refer to `Hardening
101 the User Project Macro using
102 Openlane <#hardening-the-user-project-macro-using-openlane>`__. Also,
103 the makefile retains the openlane summary reports under the signoff
104 directory.
Mohamed Kassem6f2fcd22021-04-19 10:14:19 -0700105
106- `Pin order <openlane/user_project_wrapper/pin_order.cfg>`__ file for
107 the user wrapper: The hardened user project wrapper macro must have
108 the same pin order specified in caravel's repo. Failing to adhere to
109 the same order will fail the gds integration of the macro with
110 caravel's back-end.
111
manarabdelatyd0e7afb2021-04-22 00:21:13 +0200112The symbolic links are automatically set when you run ``make install``.
Mohamed Kassem6f2fcd22021-04-19 10:14:19 -0700113
114Verilog Integration
115-------------------
116
117You need to create a wrapper around your macro that adheres to the
118template at
119`user\_project\_wrapper <caravel/verilog/rtl/__user_project_wrapper.v>`__.
120The wrapper top module must be named ``user_project_wrapper`` and must
121have the same input and output ports. The wrapper gives access to the
122user space utilities provided by caravel like IO ports, logic analyzer
123probes, and wishbone bus connection to the management SoC.
124
125For this sample project, the user macro makes use of:
126
127- The IO ports for displaying the count register values on the IO pads.
128
129- The LA probes for supplying an optional reset and clock signals and
130 for setting an initial value for the count register.
131
132- The wishbeone port for reading/writing the count value through the
133 management SoC.
134
135Refer to `user\_project\_wrapper <verilog/rtl/user_project_wrapper.v>`__
136for more information.
137
138.. raw:: html
139
140 <p align="center">
141 <img src="./_static/counter_32.png" width="50%" height="50%">
142 </p>
manarabdelatyd0e7afb2021-04-22 00:21:13 +0200143
Mohamed Kassem6f2fcd22021-04-19 10:14:19 -0700144.. raw:: html
145
146 </p>
147
148Running Full Chip Simulation
149============================
150
manarabdelatyd0e7afb2021-04-22 00:21:13 +0200151First, you will need to install the simulation environment, by
152
153.. code:: bash
154
155 make simenv
156
157This will pull a docker image with the needed tools installed.
158
159Then, you will need to build the pdk to obtain the verilog views.
160
161.. code:: bash
162
163 # set PDK_ROOT to the path you wish to use for the pdk
164 export PDK_ROOT=<pdk-installation-path>
165
166 # you can optionally specify skywater-pdk and open-pdks commit used
167 # by setting and exporting SKYWATER_COMMIT and OPEN_PDKS_COMMIT
168 # if you do not set them, they default to the last verfied commits tested for this project
169
170 make pdk
171
172Then, run the RTL and GL simulation by
173
174.. code:: bash
175
176 export PDK_ROOT=<pdk-installation-path>
177 export CARAVEL_ROOT=$(pwd)/caravel
178 # specify simulation mode: RTL/GL
179 export SIM=RTL
180 # Run IO ports testbench, make verify-io_ports
181 make verify-<dv-pattern>
182
183The verilog test-benches are under this directory
184`verilog/dv <verilog/dv>`__. For more information on setting up the
185simulation environment and the available testbenches for this sample
186project, refer to `README <verilog/dv/README.md>`__.
Mohamed Kassem6f2fcd22021-04-19 10:14:19 -0700187
188Hardening the User Project Macro using Openlane
189===============================================
190
manarabdelatyd0e7afb2021-04-22 00:21:13 +0200191First, you will need to install the pdk by
192
193.. code:: bash
194
195 # set PDK_ROOT to the path you wish to use for the pdk
196 export PDK_ROOT=<pdk-installation-path>
197
198 # you can optionally specify skywater-pdk and open-pdks commit used
199 # by setting and exporting SKYWATER_COMMIT and OPEN_PDKS_COMMIT
200 # if you do not set them, they default to the last verfied commits tested for this project
201
202 make pdk
203
204Then, you will need to install openlane by
205
206.. code:: bash
207
208 export OPENLANE_ROOT=<openlane-installation-path>
209 export OPENLANE_TAG=v0.12
210 make openlane
211
212For detailed instructions on how to install openlane and the pdk refer
213to
Mohamed Kassem6f2fcd22021-04-19 10:14:19 -0700214`README <https://github.com/efabless/openlane/blob/master/README.md>`__.
215
216There are two options for hardening the user project macro using
217openlane:
218
2191. Hardening the user macro, then embedding it in the wrapper
2202. Flattening the user macro with the wrapper.
221
222For more details on this, refer to this
manarabdelatyd0e7afb2021-04-22 00:21:13 +0200223`README <https://github.com/efabless/caravel/blob/master/openlane/README.rst>`__.
Mohamed Kassem6f2fcd22021-04-19 10:14:19 -0700224
225For this sample project, we went for the first option where the user
226macro is hardened first, then it is inserted in the user project
227wrapper.
228
229.. raw:: html
230
231 <p align="center">
232 <img src="./_static/wrapper.png" width="50%" height="50%">
233 </p>
234
manarabdelatyd0e7afb2021-04-22 00:21:13 +0200235.. raw:: html
236
237 </p>
238
Mohamed Kassem6f2fcd22021-04-19 10:14:19 -0700239To reproduce hardening this project, run the following:
240
241.. code:: bash
242
243 export OPENLANE_TAG=v0.12
Mohamed Kassem6f2fcd22021-04-19 10:14:19 -0700244 # Run openlane to harden user_proj_example
245 make user_proj_example
246 # Run openlane to harden user_project_wrapper
247 make user_project_wrapper
248
249Checklist for Open-MPW Submission
250=================================
251
252- [x] The project repo adheres to the same directory structure in this
253 repo.
254- [x] The project repo contain info.yaml at the project root.
255- [x] Top level macro is named ``user_project_wrapper``.
256- [x] Full Chip Simulation passes for RTL and GL (gate-level)
257- [x] The hardened Macros are LVS and DRC clean
258- [x] The hardened ``user_project_wrapper`` adheres to the same pin
259 order specified at
260 `pin\_order <https://github.com/efabless/caravel/blob/master/openlane/user_project_wrapper_empty/pin_order.cfg>`__
261- [x] XOR check passes with zero total difference.
262- [x] Openlane summary reports are retained under ./signoff/
263
264.. |License| image:: https://img.shields.io/badge/License-Apache%202.0-blue.svg
265 :target: https://opensource.org/licenses/Apache-2.0
manarabdelatyd0e7afb2021-04-22 00:21:13 +0200266.. |User CI| image:: https://github.com/efabless/caravel_project_example/actions/workflows/user_project_ci.yml/badge.svg
267 :target: https://github.com/efabless/caravel_project_example/actions/workflows/user_project_ci.yml
268.. |Caravel Build| image:: https://github.com/efabless/caravel_project_example/actions/workflows/caravel_build.yml/badge.svg
269 :target: https://github.com/efabless/caravel_project_example/actions/workflows/caravel_build.yml