|
| 1 | +# Caravel User Project |
| 2 | + |
| 3 | +[](https://opensource.org/licenses/Apache-2.0) [](https://github.com/efabless/caravel_project_example/actions/workflows/user_project_ci.yml) [](https://github.com/efabless/caravel_project_example/actions/workflows/caravel_build.yml) |
| 4 | + |
| 5 | +## Table of Contents |
| 6 | + |
| 7 | +- [Overview](#overview) |
| 8 | +- [Quickstart](#quickstart) |
| 9 | +- [Caravel Integration](#caravel-integration) |
| 10 | + - [Repo Integration](#repo-integration) |
| 11 | + - [Verilog Integration](#verilog-integration) |
| 12 | + - [GPIO Configuration](#gpio-configuration) |
| 13 | + - [Layout Integration](#layout-integration) |
| 14 | +- [Running Full Chip Simulation](#running-full-chip-simulation) |
| 15 | +- [User Project Wrapper Requirements](#user-project-wrapper-requirements) |
| 16 | +- [Hardening the User Project using OpenLane](#hardening-the-user-project-using-openlane) |
| 17 | +- [Running Timing Analysis on Existing Projects](#running-timing-analysis-on-existing-projects) |
| 18 | +- [Checklist for Open-MPW Submission](#checklist-for-open-mpw-submission) |
| 19 | + |
| 20 | +## Overview |
| 21 | + |
| 22 | +This repository contains a sample user project for the [Caravel](https://github.com/efabless/caravel.git) chip user space. It includes a simple counter demonstrating how to use Caravel's utilities such as IO pads, logic analyzer probes, and the Wishbone port. The repository also follows the recommended structure for open-mpw shuttle projects. |
| 23 | + |
| 24 | +## Prerequisites |
| 25 | + |
| 26 | +- Docker: [Linux](https://docs.docker.com/desktop/install/linux-install/r) | [Windows](https://desktop.docker.com/win/main/amd64/Docker%20Desktop%20Installer.exe?utm_source=docker&utm_medium=webreferral&utm_campaign=dd-smartbutton&utm_location=header) | [Mac with Intel Chip](https://desktop.docker.com/mac/main/amd64/Docker.dmg?utm_source=docker&utm_medium=webreferral&utm_campaign=dd-smartbutton&utm_location=header) | [Mac with M1 Chip](https://desktop.docker.com/mac/main/arm64/Docker.dmg?utm_source=docker&utm_medium=webreferral&utm_campaign=dd-smartbutton&utm_location=header) |
| 27 | +- Python 3.8+ with PIP |
| 28 | + |
| 29 | +## Quickstart |
| 30 | + |
| 31 | +### Starting Your Project |
| 32 | + |
| 33 | +1. Create a new repository based on the [caravel_user_project](https://github.com/efabless/caravel_user_project/) template. Ensure your repo is public and includes a README. |
| 34 | + |
| 35 | + - Follow [this link](https://github.com/efabless/caravel_user_project/generate) to create your repository. |
| 36 | + - Clone the repository using: |
| 37 | + |
| 38 | + ```bash |
| 39 | + git clone <your github repo URL> |
| 40 | + ``` |
| 41 | + |
| 42 | +2. Set up your local environment: |
| 43 | + |
| 44 | + ```bash |
| 45 | + cd <project_name> |
| 46 | + make setup |
| 47 | + ``` |
| 48 | + |
| 49 | + This command installs: |
| 50 | + |
| 51 | + - caravel_lite |
| 52 | + - Management core for simulation |
| 53 | + - OpenLane for design hardening |
| 54 | + - PDK |
| 55 | + - Timing scripts |
| 56 | + |
| 57 | +3. Start hardening your design: |
| 58 | + |
| 59 | + - For hardening, provide an RTL Verilog model of your design to OpenLane. |
| 60 | + - Create a subdirectory for each macro in your project under the `openlane/` directory with OpenLane configuration files. |
| 61 | + |
| 62 | + ```bash |
| 63 | + make <module_name> |
| 64 | + ``` |
| 65 | + |
| 66 | + Refer to [Hardening the User Project using OpenLane](#hardening-the-user-project-using-openlane) for examples. |
| 67 | + |
| 68 | +4. Integrate modules into the user_project_wrapper: |
| 69 | + |
| 70 | + - Update environment variables `VERILOG_FILES_BLACKBOX`, `EXTRA_LEFS`, and `EXTRA_GDS_FILES` in `openlane/user_project_wrapper/config.tcl` to point to your module. |
| 71 | + - Instantiate your module(s) in `verilog/rtl/user_project_wrapper.v`. |
| 72 | + - Harden the user_project_wrapper with your module(s): |
| 73 | + |
| 74 | + ```bash |
| 75 | + make user_project_wrapper |
| 76 | + ``` |
| 77 | + |
| 78 | +5. Run cocotb simulation on your design: |
| 79 | + |
| 80 | + - Update `rtl/gl/gl+sdf` files in `verilog/includes/includes.<rtl/gl/gl+sdf>.caravel_user_project`. |
| 81 | + - Run `gen_gpio_defaults.py` script to generate `caravel_core.v`. |
| 82 | + - Run RTL tests: |
| 83 | + |
| 84 | + ```bash |
| 85 | + make cocotb-verify-all-rtl |
| 86 | + ``` |
| 87 | + |
| 88 | + - For GL simulation: |
| 89 | + |
| 90 | + ```bash |
| 91 | + make cocotb-verify-all-gl |
| 92 | + ``` |
| 93 | + |
| 94 | + - To add cocotb tests, refer to [Adding cocotb test](https://caravel-sim-infrastructure.readthedocs.io/en/latest/usage.html#adding-a-test). |
| 95 | + |
| 96 | +6. Run opensta on your design: |
| 97 | + |
| 98 | + - Extract parasitics for `user_project_wrapper` and its macros: |
| 99 | + |
| 100 | + ```bash |
| 101 | + make extract-parasitics |
| 102 | + ``` |
| 103 | + |
| 104 | + - Create a spef mapping file: |
| 105 | + |
| 106 | + ```bash |
| 107 | + make create-spef-mapping |
| 108 | + ``` |
| 109 | + |
| 110 | + - Run opensta: |
| 111 | + |
| 112 | + ```bash |
| 113 | + make caravel-sta |
| 114 | + ``` |
| 115 | + |
| 116 | + > [!NOTE] |
| 117 | + > To update timing scripts, run `make setup-timing-scripts`. |
| 118 | + |
| 119 | +7. Run the precheck locally: |
| 120 | + |
| 121 | + ```bash |
| 122 | + make precheck |
| 123 | + make run-precheck |
| 124 | + ``` |
| 125 | + |
| 126 | +8. You're done! Submit your project at [Efabless Open Shuttle Program](https://efabless.com/open_shuttle_program/). |
| 127 | +
|
| 128 | +### GPIO Configuration |
| 129 | +
|
| 130 | +Specify the power-on default configuration for each GPIO in Caravel in `verilog/rtl/user_defines.v`. GPIO[5] to GPIO[37] require configuration, while GPIO[0] to GPIO[4] are preset and cannot be changed. |
| 131 | +
|
| 132 | +### Layout Integration |
| 133 | +
|
| 134 | +The Caravel layout includes an empty golden wrapper in the user space. Provide a valid `user_project_wrapper` GDS file. Your hardened `user_project_wrapper` will be integrated into the Caravel layout during tapeout. |
| 135 | +
|
| 136 | + |
| 137 | +
|
| 138 | +Ensure your hardened `user_project_wrapper` meets the requirements in [User Project Wrapper Requirements](#user-project-wrapper-requirements). |
| 139 | +
|
| 140 | +### Running Full Chip Simulation |
| 141 | +
|
| 142 | +Refer to [ReadTheDocs](https://caravel-sim-infrastructure.readthedocs.io/en/latest/index.html) for adding cocotb tests. |
| 143 | +
|
| 144 | +1. Install the simulation environment: |
| 145 | +
|
| 146 | + ```bash |
| 147 | + make setup-cocotb |
| 148 | + ``` |
| 149 | +
|
| 150 | +2. Run RTL simulation: |
| 151 | +
|
| 152 | + ```bash |
| 153 | + make cocotb-verify-<test_name>-rtl |
| 154 | + ``` |
| 155 | +
|
| 156 | +3. After physical implementation, run full gate-level simulations to verify your design. |
| 157 | +
|
| 158 | + ```bash |
| 159 | + make cocotb-verify-<test_name>-gl |
| 160 | + ``` |
| 161 | +
|
| 162 | +## User Project Wrapper Requirements |
| 163 | +
|
| 164 | +Your hardened `user_project_wrapper` must match the [golden user_project_wrapper](https://github.com/efabless/caravel/blob/master/gds/user_project_wrapper_empty.gds.gz) in: |
| 165 | +
|
| 166 | +- Area (2.920um x 3.520um) |
| 167 | +- Top module name "user_project_wrapper" |
| 168 | +- Pin Placement |
| 169 | +- Pin Sizes |
| 170 | +- Core Rings Width and Offset |
| 171 | +- PDN Vertical and Horizontal Straps Width |
| 172 | +
|
| 173 | + |
| 174 | +
|
| 175 | +You can change the PDN Vertical and Horizontal Pitch & Offset. |
| 176 | +
|
| 177 | + |
| 178 | +
|
| 179 | +We run an XOR check between your hardened `user_project_wrapper` GDS and the golden wrapper GDS as part of the [mpw-precheck](https://github.com/efabless/mpw_precheck) tool. |
| 180 | +
|
| 181 | +## Hardening the User Project using OpenLane |
| 182 | +
|
| 183 | +### OpenLane Installation |
| 184 | +
|
| 185 | +Install OpenLane with: |
| 186 | +
|
| 187 | +```bash |
| 188 | +make openlane |
| 189 | +``` |
| 190 | +
|
| 191 | +For more detailed instructions, refer to the [ReadTheDocs](https://openlane.readthedocs.io/en/latest/getting_started/index.html). |
| 192 | +
|
| 193 | +### Hardening Options |
| 194 | +
|
| 195 | +There are three options for hardening the user project macro using OpenLane: |
| 196 | +
|
| 197 | +1. **Option 1**: Harden the user macro(s) first, then insert it into the user project wrapper with no standard cells at the top level. |
| 198 | +
|
| 199 | +  |
| 200 | +
|
| 201 | + Example: [caravel_user_project](https://github.com/efabless/caravel_user_project) |
| 202 | +
|
| 203 | +2. **Option 2**: Flatten the user macro(s) with the user_project_wrapper. |
| 204 | +
|
| 205 | +  |
| 206 | +
|
| 207 | +3. **Option 3**: Place multiple macros in the wrapper along with standard cells at the top level. |
| 208 | +
|
| 209 | +  |
| 210 | +
|
| 211 | + Example: [clear](https://github.com/efabless/clear) |
| 212 | +
|
| 213 | +For more details, refer to the [Knowledgebase article](https://info.efabless.com/knowledge-base/top-level-integration-and-power-management). |
| 214 | +
|
| 215 | +### Running OpenLane |
| 216 | +
|
| 217 | +For this project, we chose the first option: harden the user macro first, then insert it into the user project wrapper without standard cells at the top level. |
| 218 | +
|
| 219 | + |
| 220 | +
|
| 221 | +To reproduce this process, run: |
| 222 | +
|
| 223 | +```bash |
| 224 | +# DO NOT cd into openlane |
| 225 | +
|
| 226 | +# Harden user_proj_example |
| 227 | +make user_proj_example |
| 228 | +
|
| 229 | +# Harden user_project_wrapper |
| 230 | +make user_project_wrapper |
| 231 | +``` |
| 232 | +
|
| 233 | +For more information, refer to the [OpenLane Documentation](https://openlane.readthedocs.io/en/latest/index.html). |
| 234 | +
|
| 235 | +## Running Transistor Level LVS |
| 236 | +
|
| 237 | +To pass precheck, a custom LVS configuration file (`lvs_config.json`) is needed for your design. The configuration file should include: |
| 238 | +
|
| 239 | +Required variables: |
| 240 | +
|
| 241 | +- **TOP_SOURCE**: Top source cell name. |
| 242 | +- **TOP_LAYOUT**: Top layout cell name. |
| 243 | +- **LAYOUT_FILE**: Layout GDS data file. |
| 244 | +- **LVS_SPICE_FILES**: List of spice files. |
| 245 | +- **LVS_VERILOG_FILES**: List of Verilog files (child modules should be listed before parent modules). |
| 246 | +
|
| 247 | +Optional variables: |
| 248 | +
|
| 249 | +- **INCLUDE_CONFIGS**: List of configuration files to read recursively. |
| 250 | +- **EXTRACT_FLATGLOB**: List of cell names to flatten before extraction. |
| 251 | +- **EXTRACT_ABSTRACT**: List of cells to extract as abstract devices. |
| 252 | +- **LVS_FLATTEN**: List of cells to flatten before comparing. |
| 253 | +- **LVS_NOFLATTEN**: List of cells not to flatten in case of a mismatch. |
| 254 | +- **LVS_IGNORE**: List of cells to ignore during LVS. |
| 255 | +
|
| 256 | +> [!NOTE] |
| 257 | +> Missing files and undefined variables result in fatal errors. |
| 258 | +
|
| 259 | +## Running MPW Precheck Locally |
| 260 | +
|
| 261 | +Install the [mpw-precheck](https://github.com/efabless/mpw_precheck) by running: |
| 262 | +
|
| 263 | +```bash |
| 264 | +make precheck |
| 265 | +``` |
| 266 | +
|
| 267 | +Run the precheck with: |
| 268 | +
|
| 269 | +```bash |
| 270 | +make run-precheck |
| 271 | +``` |
| 272 | +
|
| 273 | +To disable LVS/Soft/ERC connection checks: |
| 274 | +
|
| 275 | +```bash |
| 276 | +DISABLE_LVS=1 make run-precheck |
| 277 | +``` |
| 278 | +
|
| 279 | +## Running Timing Analysis on Existing Projects |
| 280 | +
|
| 281 | +Update the Makefile for your project: |
| 282 | +
|
| 283 | +```bash |
| 284 | +make setup-timing-scripts |
| 285 | +``` |
| 286 | +
|
| 287 | +Run timing analysis: |
| 288 | +
|
| 289 | +```bash |
| 290 | +make extract-parasitics |
| 291 | +
|
| 292 | +make create-spef-mapping |
| 293 | +
|
| 294 | +make caravel-sta |
| 295 | +``` |
| 296 | +
|
| 297 | +A summary of timing results is provided at the end. |
| 298 | +
|
| 299 | +## Checklist for Shuttle Submission |
| 300 | +
|
| 301 | +- ✔️ The project repo follows the directory structure in this repo. |
| 302 | +- ✔️ Top level macro is named `user_project_wrapper`. |
| 303 | +- ✔️ Full Chip Simulation passes for RTL and GL. |
| 304 | +- ✔️ Hardened Macros are LVS and DRC clean. |
| 305 | +- ✔️ Contains a gate-level netlist for `user_project_wrapper` at `verilog/gl/user_project_wrapper.v`. |
| 306 | +- ✔️ Hardened `user_project_wrapper` matches the [pin order](https://github.com/efabless/caravel/blob/master/openlane/user_project_wrapper_empty/pin_order.cfg). |
| 307 | +- ✔️ Matches the [fixed wrapper configuration](https://github.com/efabless/caravel/blob/master/openlane/user_project_wrapper_empty/fixed_wrapper_cfgs.tcl). |
| 308 | +- ✔️ Design passes the [mpw-precheck](https://github.com/efabless/mpw_precheck). |
0 commit comments