blob: f250b321c0fe0795b2c48ea1d62d0531030a3f8e [file] [log] [blame] [view]
Manarc7bcaf92021-04-16 18:21:23 +02001<!---
2# SPDX-FileCopyrightText: 2020 Efabless Corporation
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16# SPDX-License-Identifier: Apache-2.0
17-->
18
19# Caravel User Project
Manarde451642021-04-16 22:43:39 +020020[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) [![CI](https://github.com/efabless/caravel_project_example/actions/workflows/caravel_example_ci.yml/badge.svg)](https://github.com/efabless/caravel_project_example/actions/workflows/caravel_example_ci.yml)
Manarc7bcaf92021-04-16 18:21:23 +020021
Manar10d52772021-04-17 03:07:07 +020022# Table of contents
23- [Overview](#overview)
Manar2d350282021-04-19 23:51:16 +020024- [Install Caravel](#install-caravel)
Manar10d52772021-04-17 03:07:07 +020025- [Caravel Integration](#caravel-integration)
26 - [Repo Integration](#repo-integration)
27 - [Verilog Integration](#verilog-integration)
28- [Running Full Chip Simulation](#running-full-chip-simulation)
29- [Hardening the User Project Macro using Openlane](#hardening-the-user-project-macro-using-openlane)
30- [Checklist for Open-MPW Submission](#checklist-for-open-mpw-submission)
31
Manarc7bcaf92021-04-16 18:21:23 +020032# Overview
33
Manarde451642021-04-16 22:43:39 +020034This repo contains a sample user project that utilizes the [caravel](https://github.com/efabless/caravel.git) chip user space. The user project is a simple counter that showcases how to make use of [caravel's](https://github.com/efabless/caravel.git) user space utilities like IO pads, logic analyzer probes, and wishbone port. The repo also demonstrates the recommended structure for the open-mpw shuttle projects.
Manarc7bcaf92021-04-16 18:21:23 +020035
Manar2d350282021-04-19 23:51:16 +020036# Install Caravel
37
Manar2d350282021-04-19 23:51:16 +020038To setup caravel, run the following:
39
40```bash
Jeff DiCorpo9f275ff2021-04-19 18:16:34 -070041# By default, CARAVEL_ROOT is set to $(pwd)/caravel
Manar2d350282021-04-19 23:51:16 +020042# If you want to install caravel at a different location, run "export CARAVEL_ROOT=<caravel-path>"
43# Disable submodule installation if needed by, run "export SUBMODULE=0"
Jeff DiCorpo49b66152021-04-19 18:18:53 -070044
Manar2d350282021-04-19 23:51:16 +020045make install
46```
47
48To update the installed caravel to the latest, run:
49
50```bash
51 make update_caravel
52```
53
54To remove caravel, run
55```bash
56make uninstall
57```
58
Jeff DiCorpo9f275ff2021-04-19 18:16:34 -070059By default [caravel-lite]() is installed. To install the full version of caravel, run this prior to calling make install.
60```bash
61export CARAVEL_LITE=0
62```
63
Manarc7bcaf92021-04-16 18:21:23 +020064# Caravel Integration
65
Manar10d52772021-04-17 03:07:07 +020066## Repo Integration
Manarc7bcaf92021-04-16 18:21:23 +020067
Manar2d350282021-04-19 23:51:16 +020068Caravel files are kept separate from the user project by having caravel as submodule. The submodule commit should point to the latest of caravel/caravel-lite master. The following files should have a symbolic link to [caravel's](https://github.com/efabless/caravel.git) corresponding files:
Manarc7bcaf92021-04-16 18:21:23 +020069
Manar13f59da2021-04-19 23:55:59 +020070- [Openlane Makefile](openlane/Makefile): This provides an easier way for running openlane to harden your macros. Refer to
71[Hardening the User Project Macro using Openlane](#hardening-the-user-project-macro-using-openlane). Also, the makefile retains the openlane summary reports under the signoff directory.
Manarc7bcaf92021-04-16 18:21:23 +020072
Manarde451642021-04-16 22:43:39 +020073- [Pin order](openlane/user_project_wrapper/pin_order.cfg) file for the user wrapper: The hardened user project wrapper macro must have the same pin order specified in caravel's repo. Failing to adhere to the same order will fail the gds integration of the macro with caravel's back-end.
Manarc7bcaf92021-04-16 18:21:23 +020074
Manar13f59da2021-04-19 23:55:59 +020075The symbolic links are automatically set when you run `make install`.
Manarc7bcaf92021-04-16 18:21:23 +020076
77## Verilog Integration
78
79You need to create a wrapper around your macro that adheres to the template at [user_project_wrapper](caravel/verilog/rtl/__user_project_wrapper.v). The wrapper top module must be named `user_project_wrapper` and must have the same input and output ports. The wrapper gives access to the user space utilities provided by caravel like IO ports, logic analyzer probes, and wishbone bus connection to the management SoC.
80
81For this sample project, the user macro makes use of:
82
Manarde451642021-04-16 22:43:39 +020083- The IO ports for displaying the count register values on the IO pads.
Manarc7bcaf92021-04-16 18:21:23 +020084
Manarde451642021-04-16 22:43:39 +020085- The LA probes for supplying an optional reset and clock signals and for setting an initial value for the count register.
Manarc7bcaf92021-04-16 18:21:23 +020086
Manarde451642021-04-16 22:43:39 +020087- The wishbeone port for reading/writing the count value through the management SoC.
Manarc7bcaf92021-04-16 18:21:23 +020088
89Refer to [user_project_wrapper](verilog/rtl/user_project_wrapper.v) for more information.
90
91<p align=”center”>
Mohamed Kasseme0abf522021-04-19 09:52:50 -070092<img src="docs/source/_static/counter_32.png" width="50%" height="10%">
Manarc7bcaf92021-04-16 18:21:23 +020093</p>
94
95# Running Full Chip Simulation
96
Manar13f59da2021-04-19 23:55:59 +020097The verilog test-benches are under this directory [verilog/dv](verilog/dv). For more information on setting up the simulation environment and the available testbenches for this sample project, refer to [README](verilog/dv/README.md).
Manarc7bcaf92021-04-16 18:21:23 +020098
99# Hardening the User Project Macro using Openlane
100
Manarde451642021-04-16 22:43:39 +0200101For instructions on how to install openlane and the pdk refer to [README](https://github.com/efabless/openlane/blob/master/README.md).
Manarc7bcaf92021-04-16 18:21:23 +0200102
103There are two options for hardening the user project macro using openlane:
104
1051. Hardening the user macro, then embedding it in the wrapper
1062. Flattening the user macro with the wrapper.
107
Manarde451642021-04-16 22:43:39 +0200108For more details on this, refer to this [README](caravel/blob/master/openlane/README.rst).
Manarc7bcaf92021-04-16 18:21:23 +0200109
Manarde451642021-04-16 22:43:39 +0200110For this sample project, we went for the first option where the user macro is hardened first, then it is inserted in the user project wrapper.
Manarc7bcaf92021-04-16 18:21:23 +0200111
112<p align=”center”>
Mohamed Kassem9cec2d32021-04-19 09:52:21 -0700113<img src="docs/source/_static/wrapper.png" width="30%" height="5%">
Manarc7bcaf92021-04-16 18:21:23 +0200114</p>
115
116To reproduce hardening this project, run the following:
117
118```bash
119export OPENLANE_TAG=v0.12
120cd openlane
Manar84e4f8e2021-04-18 21:29:47 +0200121# Run openlane to harden user_proj_example
Manarc7bcaf92021-04-16 18:21:23 +0200122make user_proj_example
Manar84e4f8e2021-04-18 21:29:47 +0200123# Run openlane to harden user_project_wrapper
Manarc7bcaf92021-04-16 18:21:23 +0200124make user_project_wrapper
125```
126
127# Checklist for Open-MPW Submission
128
129- [x] The project repo adheres to the same directory structure in this repo.
130- [x] The project repo contain info.yaml at the project root.
131- [x] Top level macro is named `user_project_wrapper`.
132- [x] Full Chip Simulation passes for RTL and GL (gate-level)
Manarde451642021-04-16 22:43:39 +0200133- [x] The hardened Macros are LVS and DRC clean
134- [x] The hardened `user_project_wrapper` adheres to the same pin order specified at [pin_order](https://github.com/efabless/caravel/blob/master/openlane/user_project_wrapper_empty/pin_order.cfg)
Manarc7bcaf92021-04-16 18:21:23 +0200135- [x] XOR check passes with zero total difference.
Manarde451642021-04-16 22:43:39 +0200136- [x] Openlane summary reports are retained under ./signoff/<macro-name>