blob: 913b13d9c96be7596ab6a8353a564a40f8cee767 [file] [log] [blame] [view]
manarabdelatyf2b6ea22021-04-20 19:07:40 +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
20[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) [![UPRJ_CI](https://github.com/efabless/caravel_project_example/actions/workflows/user_project_ci.yml/badge.svg)](https://github.com/efabless/caravel_project_example/actions/workflows/user_project_ci.yml) [![Caravel Build](https://github.com/efabless/caravel_project_example/actions/workflows/caravel_build.yml/badge.svg)](https://github.com/efabless/caravel_project_example/actions/workflows/caravel_build.yml)
21
22# Table of contents
23- [Overview](#overview)
24- [Install Caravel](#install-caravel)
25- [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
32# Overview
33
34This 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.
35
36# Install Caravel
37
38To setup caravel, run the following:
39
40```bash
41# By default, CARAVEL_ROOT is set to $(pwd)/caravel
42# 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"
44
45make 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
59By default [caravel-lite](https://github.com/efabless/caravel-lite.git) is installed. To install the full version of caravel, run this prior to calling make install.
60```bash
61export CARAVEL_LITE=0
62```
63
64# Caravel Integration
65
66## Repo Integration
67
68Caravel 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:
69
70- [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.
72
73- [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.
74
75The symbolic links are automatically set when you run `make install`.
76
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
83- The IO ports for displaying the count register values on the IO pads.
84
85- The LA probes for supplying an optional reset and clock signals and for setting an initial value for the count register.
86
87- The wishbeone port for reading/writing the count value through the management SoC.
88
89Refer to [user_project_wrapper](verilog/rtl/user_project_wrapper.v) for more information.
90
91<p align=”center”>
92<img src="docs/source/_static/counter_32.png" width="50%" height="10%">
93</p>
94
95# Running Full Chip Simulation
96
97First, you will need to install the simulation environment, by
98
99```bash
100make simenv
101```
102
103This will pull a docker image with the needed tools installed.
104
105Then, you will need to build the pdk to obtain the verilog views.
106
107```bash
108export PDK_ROOT=<pdk-installation-path>
Manarf5524b12021-04-20 21:57:02 +0200109# specify skywater-pdk and open-pdks commit used for this project
110export SKYWATER_COMMIT=db2e06709dc3d876aa6b74a5f3893fa5f1bc2a6e
111export OPEN_PDKS_COMMIT=b9ffc1fd1cfc26cbca85a61c287ac799721f6e6a
manarabdelatyf2b6ea22021-04-20 19:07:40 +0200112make pdk
113```
114
115Then, run the RTL and GL simulation by
116
117```bash
118export PDK_ROOT=<pdk-installation-path>
119export CARAVEL_ROOT=$(pwd)/caravel
120# specify simulation mode: RTL/GL
121export SIM=RTL
122# Run IO ports testbench, make verify-io_ports
123make verify-<dv-pattern>
124```
125
126The 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).
127
128# Hardening the User Project Macro using Openlane
129
130First, you will need to install the pdk by
131
132```bash
133export PDK_ROOT=<pdk-installation-path>
Manarf5524b12021-04-20 21:57:02 +0200134# specify skywater-pdk and open-pdks commit used for this project
135export SKYWATER_COMMIT=db2e06709dc3d876aa6b74a5f3893fa5f1bc2a6e
136export OPEN_PDKS_COMMIT=b9ffc1fd1cfc26cbca85a61c287ac799721f6e6a
manarabdelatyf2b6ea22021-04-20 19:07:40 +0200137make pdk
138```
139
140Then, you will need to install openlane by
141
142```bash
143export OPENLANE_ROOT=<openlane-installation-path>
144export OPENLANE_TAG=v0.12
145make openlane
146```
147
148For detailed instructions on how to install openlane and the pdk refer to [README](https://github.com/efabless/openlane/blob/master/README.md).
149
150
151There are two options for hardening the user project macro using openlane:
152
1531. Hardening the user macro, then embedding it in the wrapper
1542. Flattening the user macro with the wrapper.
155
Matt Vennd4860ee2021-04-20 21:32:16 +0200156For more details on this, refer to this [README](https://github.com/efabless/caravel/blob/master/openlane/README.rst).
manarabdelatyf2b6ea22021-04-20 19:07:40 +0200157
158For 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.
159
160<p align=”center”>
161<img src="docs/source/_static/wrapper.png" width="30%" height="5%">
162</p>
163
164To reproduce hardening this project, run the following:
165
166```bash
167export OPENLANE_TAG=v0.12
168# Run openlane to harden user_proj_example
169make user_proj_example
170# Run openlane to harden user_project_wrapper
171make user_project_wrapper
172```
173
174# Checklist for Open-MPW Submission
175
176- [x] The project repo adheres to the same directory structure in this repo.
177- [x] The project repo contain info.yaml at the project root.
178- [x] Top level macro is named `user_project_wrapper`.
179- [x] Full Chip Simulation passes for RTL and GL (gate-level)
180- [x] The hardened Macros are LVS and DRC clean
181- [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)
182- [x] XOR check passes with zero total difference.
183- [x] Openlane summary reports are retained under ./signoff/<macro-name>