blob: 49aad6569fe30927420fb525bbc721775337bbd8 [file] [log] [blame] [view]
agorararmard312a1cd2020-12-10 18:35:12 +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-->
agorararmarddc723a62020-11-26 20:00:29 +020018# Using OpenLANE to Harden Your Design:
19
20You can utilize the Makefile existing here in this directory to do that.
21
agorararmard0b3deac2020-11-30 23:57:45 +020022But, first you need to specify 2 things:
agorararmarddc723a62020-11-26 20:00:29 +020023```bash
agorararmarddc723a62020-11-26 20:00:29 +020024export PDK_ROOT=<The location where the pdk is installed>
agorararmard2e2971e2020-11-27 18:10:13 +020025export OPENLANE_ROOT=<the absolute path to the openlane directory cloned or to be cloned>
agorararmarddc723a62020-11-26 20:00:29 +020026```
27
agorararmard44658332020-12-15 00:01:36 +020028**NOTE:** caravel is still a WIP so expect to run into some issues when using it.
agorararmarde2bdaef2020-11-27 16:43:22 +020029
agorararmarde4ffba62020-12-14 23:30:00 +020030If you don't have openlane already, then you can get it from [here](https://github.com/efabless/openlane). Alternatively, you can clone and build openlane through:
agorararmard29e74e32020-11-26 22:43:46 +020031```bash
32 make openlane
33```
34
agorararmard9722aa22020-12-11 23:10:57 +020035**NOTE:** We are developing caravel using openlane:rc6 which is the current master branch.
agorararmard29e74e32020-11-26 22:43:46 +020036
agorararmarde4ffba62020-12-14 23:30:00 +020037**NOTE:** rc6 (current openlane master) and rc4 (previous openlane master) are using two different concepts of cell padding. rc4 is modifying the LEF, while rc6 is relying on openroad to handle the cell padding. Also, rc4 is using the standalone version of openDP while rc6 is using the one integrated in the openroad app. This affects the concept of PL_TARGET_DENSITY and while in rc4 it was preferred to have PL_TARGET_DENSITY=(FP_CORE_UTIL-(5\~10)/100). Now, in rc6 it is preferred to be PL_TARGET_DENSITY=(FP_CORE_UTIL+(1\~5)/100).
agorararmard9722aa22020-12-11 23:10:57 +020038FP_CORE_UTIL should be relaxed as well as it became more representative of the actual core utilization, which wasn't so much the case earlier. So, the perception of these two variables as well as CELL_PAD changed between rc4 and rc6 which necessitates a change in the configurations of almost every single design.
39CELL_PAD should be 4~6 for the skywater libraries in rc6 unlike rc4 which was 8.
agorararmard0d9c8462020-11-27 21:33:02 +020040
agorararmarddc723a62020-11-26 20:00:29 +020041Then, you have two options:
421. Create a macro for your design and harden it, then insert it into user_project_wrapper.
43
442. Flatten your design with the user_project_wrapper and harden them as one.
45
46
47**NOTE:** The OpenLANE documentation should cover everything you might need to create your design. You can find that [here](https://github.com/efabless/openlane/blob/master/README.md).
48
49## Option 1:
50
51This could be done by creating a directory for your design here in this directory, and adding a configuration file for it under the same directory. You can follow the instructions given [here](https://github.com/efabless/openlane#adding-a-design) to generate an initial configuration file for your design, or you can start with the following:
52
53```tcl
54set script_dir [file dirname [file normalize [info script]]]
55
56set ::env(DESIGN_NAME) <Your Design Name>
57
agorararmard29e74e32020-11-26 22:43:46 +020058set ::env(DESIGN_IS_CORE) 0
59set ::env(FP_PDN_CORE_RING) 0
agorararmarde2bdaef2020-11-27 16:43:22 +020060set ::env(GLB_RT_MAXLAYER) 5
agorararmard29e74e32020-11-26 22:43:46 +020061
agorararmarddc723a62020-11-26 20:00:29 +020062set ::env(VERILOG_FILES) "$script_dir/../../verilog/rtl/<Your RTL.v>"
63
64set ::env(CLOCK_PORT) <Clock port name if it exists>
65set ::env(CLOCK_PERIOD) <Desired clock period>
66```
67
68Then you can add them as you see fit to get the desired DRC/LVS clean outcome.
69
70After that, run the following command:
71```bash
72make <your design directory name>
73```
74
75Then, follow the instructions given in Option 2.
76
agorararmardda92aef2020-12-04 23:56:37 +020077**NOTE:** You might have other macros inside your design. In which case, you may need to have some special power configurations. This is covered [here](https://github.com/efabless/openlane/blob/master/doc/hardening_macros.md#power-grid-pdn).
agorararmarde2bdaef2020-11-27 16:43:22 +020078
agorararmarddc723a62020-11-26 20:00:29 +020079## Option 2:
80
811. Add your design to the RTL of the [user_project_wrapper](../verilog/rtl/user_project_wrapper.v).
82
832. Modify the configuration file [here](./user_project_wrapper/config.tcl) to include any extra files you may need. Make sure to change these accordingly:
84```tcl
85set ::env(CLOCK_NET) "mprj.clk"
86
agorararmarddc723a62020-11-26 20:00:29 +020087set ::env(VERILOG_FILES) "\
88 $script_dir/../../verilog/rtl/defines.v \
89 $script_dir/../../verilog/rtl/user_project_wrapper.v"
90
91set ::env(VERILOG_FILES_BLACKBOX) "\
92 $script_dir/../../verilog/rtl/defines.v \
93 $script_dir/../../verilog/rtl/user_proj_example.v"
94
95set ::env(EXTRA_LEFS) "\
96 $script_dir/../../lef/user_proj_example.lef"
97
98set ::env(EXTRA_GDS_FILES) "\
99 $script_dir/../../gds/user_proj_example.gds"
100```
101**NOTE:** Don't change the size or the pin order!
102
agorararmarde4ffba62020-12-14 23:30:00 +02001033. If your design has standard cells then you need to modify the configuration file [here](./user_project_wrapper/config.tcl) to remove or change these configs accordingly:
104```tcl
105# The following is because there are no std cells in the example wrapper project.
106set ::env(SYNTH_TOP_LEVEL) 1
107set ::env(PL_RANDOM_GLB_PLACEMENT) 1
108set ::env(PL_OPENPHYSYN_OPTIMIZATIONS) 0
109set ::env(DIODE_INSERTION_STRATEGY) 0
110set ::env(FILL_INSERTION) 0
111set ::env(TAP_DECAP_INSERTION) 0
112set ::env(CLOCK_TREE_SYNTH) 0
113```
agorararmarddc723a62020-11-26 20:00:29 +0200114
agorararmarde4ffba62020-12-14 23:30:00 +02001154. Remove this line `set ::env(MACRO_PLACEMENT_CFG) $script_dir/macro.cfg` from the configuration file [here](./user_project_wrapper/config.tcl) entirely if you have no macros. Alternatively, if you do have macros inside your design, then control their placement by modifying [this file](./user_project_wrapper/macro.cfg)
agorararmarddc723a62020-11-26 20:00:29 +0200116
agorararmarde4ffba62020-12-14 23:30:00 +02001175. Run your design through the flow: `make user_project_wrapper`
agorararmarddc723a62020-11-26 20:00:29 +0200118
agorararmarde4ffba62020-12-14 23:30:00 +02001196. You may want to take a look at the [Extra Pointers](#extra-pointers) to apply any necessary changes to the interactive script.
agorararmarddc723a62020-11-26 20:00:29 +0200120
agorararmarde4ffba62020-12-14 23:30:00 +02001217. Re-iterate until you have what you want.
agorararmarddc723a62020-11-26 20:00:29 +0200122
agorararmarde4ffba62020-12-14 23:30:00 +02001238. Go back to the main [README.md](../README.md) and continue the process of boarding the chip.
agorararmardda92aef2020-12-04 23:56:37 +0200124
125**NOTE:** In both cases you might have other macros inside your design. In which case, you may need to have some special power configurations. This is covered [here](https://github.com/efabless/openlane/blob/master/doc/hardening_macros.md#power-grid-pdn).
126
127## Extra Pointers
agorararmarddc723a62020-11-26 20:00:29 +0200128
129- The OpenLANE documentation should cover everything you might need to create your design. You can find that [here](https://github.com/efabless/openlane/blob/master/README.md).
130- The OpenLANE [FAQs](https://github.com/efabless/openlane/wiki) can guide through your troubles.
131- [Here](https://github.com/efabless/openlane/blob/master/configuration/README.md) you can find all the configurations and how to use them.
132- [Here](https://github.com/efabless/openlane/blob/master/doc/advanced_readme.md) you can learn how to write an interactive script.
133- [Here](https://github.com/efabless/openlane/blob/master/doc/OpenLANE_commands.md) you can find a full documentation for all OpenLANE commands.
134- [This documentation](https://github.com/efabless/openlane/blob/master/regression_results/README.md) describes how to use the exploration script to achieve an LVS/DRC clean design.
agorararmardda92aef2020-12-04 23:56:37 +0200135- [This documentation](https://github.com/efabless/openlane/blob/master/doc/hardening_macros.md) walks you through hardening a macro and all the decisions you should make.