blob: 1766277ede9b87cfc1ee4fee1776ab3e7c3b73c6 [file] [log] [blame] [view]
lowRISC Contributors802543a2019-08-31 12:12:56 +01001# Design Methodology within OpenTitan
2
3The design methodology within OpenTitan combines the challenges of industry-strength design methodologies with open source ambitions.
4When in conflict, quality must win, and thus we aim to create a final design product that is equal to the quality required from a full production silicon chip tapeout.
5
6## Language and Tool Selection
7
8Starting with the language, the strategy is to use the SystemVerilog language, restricted to a feature set described by our
9[Verilog Style Guide](https://github.com/lowRISC/style-guides/blob/master/VerilogCodingStyle.md).
10All IP should be developed and delivered under the feature set described by this style guide.
11Inconsistencies or lack of clarity within the style guide should be solved by filing and helping close an issue on the style guide in the
12[lowrisc/style-guides GitHub repo](https://github.com/lowRISC/style-guides).
13
14For professional tooling, the team has chosen several industry-grade tools for its design signoff process.
15Wherever possible we attempt to remain tool-agnostic, but we must choose a selection of tools as our ground truth for our own confidence of signoff-level assurances.
16As a project we promote other open source methodologies and work towards a future where these are signoff-grade.
17The discussions on how the design tools are used and which ones are chosen are given below in separate sections.
18
19## Comportability and the Importance of Architectural Conformity
20
21The OpenTitan program is adopting a design methodology aimed at unifying as much as possible the interfaces between individual designs and the rest of the SOC.
22These are detailed in the [Comportability Specification](../rm/comportability_specification.md).
23This document details how peripheral IP interconnects with the embedded processor, the chip IO, other designs, and the security infrastructure within the SOC.
24Not all of the details are complete at this time, but will be tracked and finalized within that specification.
25
26TODO: briefly discuss key architectural decisions, and how we came to the conclusion, with pointers to more thorough documentation. List?
27* Processor/RISC-V strategy
28* Bus strategy
29* Reset strategy
30
31## Defining Design Complete: milestones and tracking
32
33Designs within the OpenTitan project come in a variety of completion status levels.
34Some designs are tapeout ready while others are still a work in progress.
35Understanding the status of a design is important to gauge the confidence in its advertised feature set.
36To that end, weve designated a spectrum of design milestones in the *OpenTitan IP project tracking* <Coming Soon&rt; document.
37This document defines the design milestones and references where one can find the current status of each of the designs in the repository.
38
39## Documentation
40
41Documentation is a critical part of any design methodology.
42Within the OpenTitan project there are two important tooling components to efficient and effective documentation.
43The first is the [docgen](../../util/docgen/README.md) tool, which converts an annotated markdown file into a rendered HTML file (including this document).
44See the linked docgen specification for information about the annotations and how to use it to create enhanced auto-generated additions to standard Markdown files.
45The second is the [reggen](../rm/register_tool.md) register tool that helps define the methodology and description language for specifying hardware registers.
46These descriptions are fed into docgen through annotations and ensure that the technical specifications for the IP are accurate and up to date with the hardware being built.
47
48Underlying and critical to this tooling is the human-written content that goes into the source markdown and register descriptions.
49Clarity and consistency is key, and we will add guidelines for technical specification documentation flow. (TODO).
50
51## Usage of Register Tool
52
53One design element that is prime for consistent definitions and usages is in the area of register definitions.
54Registers are critical, being at the intersection of hardware and software, where uniformity can reduce confusion and increase reusability.
55The [register tool](../rm/register_tool.md) used within OpenTitan is custom for the projects needs, but flexible to add new features as they arise.
56It attempts to stay lightweight yet solve most of the needs in this space.
57The description language (using HJSON format) described within that specification also details other features described in the
58[Comportability Specification](../rm/comportability_specification.md).
59See those two specifications as well as the [Markdown Style Guide](../rm/markdown_usage_style.md) for details on the tool and the description language.
60
61## Linting Methodology
62
63Linting is a productivity tool for designers to quickly find typos and bugs at the time when the RTL is written.
64Capturing fast and efficient feedback on syntactic and semantic (as well as style) content early in the process proves to be useful for high quality as well as consistent usage of the language.
65Running lint is especially useful with SystemVerilog, a weakly-typed language, unlike more modern hardware description languages.
66Running lint is faster than running a simulation.
67
68The tool [AscentLint](https://www.realintent.com/rtl-linting-ascent-lint) from the company Real Intent was chosen for this project.
69It has the benefit of fast execution times, and provides a list of concise lint errors and warnings.
70It is understandable that not all partner members will have access to this tool.
71The project will use AscentLint as its linting sign-off tool, and results will be shared in some form through continuous integration build results, published tool outputs, pre-submit checks, and/or linting summaries of tool output (final decision TBD).
72For partners without access to this tool, the recommendation is to run their code through whatever linting tool they have available at their disposal before creating a design Pull Request, then work with the maintainers of the linting sign-off methodology to close linting errors.
73(TODO: decide on available pre-submit linting options).
74Linting errors and warnings can be closed by fixing the code in question (preferred), or waiving the error.
75
76Due to the proprietary nature of this particular linting tool, content towards running the tool can not be checked in in an open source repository.
77In the current state of the project, all lint scripts, policy files, and waivers are **not** provided, but are being kept privately until we can suggest a workable open source solution.
78When this methodology is finalized the details will be given here. (TODO)
79See the [Linting README](../../hw/lint/README.md) for details on how the tool is being run internally.
80This shows the methodology that we are aiming to release in a fully open manner, but for now is being run, with results shared among partner members.
81
82Goals for linting closure per design milestone are given in the *OpenTitan IP project tracking* <Coming Soon> document.
83
84## Assertion Methodology
85
86The creation and maintenance of assertions within RTL design code is an essential way to get feedback if a design is being used improperly.
87Common examples include asserting that a full FIFO should never be written to, a state machine doesnt receive an input while in a particular state, or two signals should remain mutually exclusive.
88Usually these will eventually result in a downstream error (incorrect data, bus collisions, etc) but early feedback at the first point of inconsistency gives designers and verifiers alike fast access to easier debug.
89
90Within OpenTitan we attempt to maintain uniformity in assertion style and syntax using SystemVerilog Assertions and a list of common macros.
91An overview of the included macros and how to use them is given in this
92[Design Assertion README file](../../hw/formal/README.md).
93This document also describes how to formally verify assertions using
94[JasperGold](https://www.cadence.com/content/cadence-www/global/en_US/home/tools/system-design-and-verification/formal-and-static-verification/jasper-gold-verification-platform/formal-property-verification-app.html)
95from the company Cadence.
96
97## CDC Methodology
98
99Logic designs that have signals that cross from one clock domain to another unrelated clock domain are notorious for introducing hard to debug problems.
100The reason is that design verification, with its constant and unrealistic timing relationships on signals, does not represent the variability and uncertainty of real world systems.
101For this reason, maintaining a robust Clock Domain Crossing verification strategy ("CDC methodology") is critical to the success of any mutli-clock design.
102
103Our general strategy is threefold:
104maintain a list of proven domain crossing submodules;
105enforce the usage of these submodules;
106use a production-worthy tool to check all signals within the design conform to correct crossing rules.
107This *CDC Methodology document* <Coming Soon> gives details on the submodules, discusses the tool chosen and how to run it, and explains more rationale for the designs chosen.
108
109The tool chosen for this program is
110[Meridian]([https://www.realintent.com/clock-domain-crossing-meridian-cdc](https://www.realintent.com/clock-domain-crossing-meridian-cdc))
111from RealIntent.
112It is a sign-off-grade CDC checking tool that provides the features needed for CDC assurance.
113It is understandable that not all partner members will have access to this tool.
114The project will use it as its sign-off tool, and results will be shared in some form (final decision TBD).
115CDC checking errors can be closed by fixing the code in question (preferred), or waiving the error.
116All CDC waivers will be reviewed as part of the Pull Request review process.
117See the *CDC README* <Coming Soon> for details on how to run the tool if you have a Meridian license.
118
119Similar to the linting tool, due to the proprietary nature of the CDC tool, some content towards running the tool can not be checked in in an open source repository.
120For those items, the tool provider will be giving us a method to check in encrypted content that still allows for full functionality without exposing their tools feature set.
121When this methodology is finalized the details will be given here. (TODO)
122
123## DFT
124
125Design For Testability is another critical part of any design methodology.
126It is the preparation of a design for a successful manufacturing test regime.
127This includes, but is not limited to, the ability to use scan chains for testing digital logic;
128the optimization of design logic to allow maximum access of test logic for fault coverage;
129the ability to observe and control memory cells and other storage macros;
130the control of analog designs and other items that are often outside the reach of test logic;
131built in self test (BIST) insertion for logic and memories.
132In this context, our primary concern at this stage is what impact does this have on the RTL that makes up the IP in our library.
133
134DFT in OpenTitan is particularly interesting for two primary reasons:
135the RTL in the OpenTitan repository is targeted towards an FPGA implementation, but must be prepared for a silicon implementation
136(see the FPGA vs Silicon discussion in the [OpenTitan Product](../../doc/product.md) document);
137the whole purpose of a DFT methodology is full and efficient access to all logic and storage content,
138while the whole purpose of a security microcontroller is restricting access to private secured information.
139In light of the latter dilemma, special care must be taken in a security design to ensure DFT has access at only the appropriate times, but not while in use in production.
140
141At this time the DFT methodology for OpenTitan is not finalized.
142The expectation is that the RTL collateral will undergo a DFT introduction -
143likely with the propagation of such signals as `testmode`, `scanmode`, `bistmode`, etc -
144at a stage before final project completion.
145At this point there are a few references to such signals but they are not yet built into a coherent whole.
146At that future time the DFT considerations will be fully documented and carried out throughout all IP.
147
148## Generated Code
149
150The OpenTitan project contains a lot of generated code through a variety of methods.
151Most modern SystemVerilog-based projects work around the weaknesses in the language in such a way.
152But our first goal is to take full advantage of the language as much as possible, and only resort to generated code where necessary.
153
154At the moment, all generated code is checked in with the source files.
155The pros and cons of this decision are still being discussed, and the decision may be reversed, to be replaced with a master build-all script to prepare a final design as source files changed.
156Until that time, all generated files (see for example the output files from the
157[register generation tool](../rm/register_tool.md))
158are checked in.
159There is a master build file in the repository under `hw/Makefile` that builds all of the `regtool` content.
160This is used by an Azure Pipelines presubmit check script to ensure that the source files produce a generated file that is identical to the one being submitted.
161
162## Getting Started with a Design
163
164The process for getting started with a design involves many steps, including getting clarity on its purpose, its feature set, ownership assignments, documentation, etc.
165These are discussed in the *Getting Started with a Design* <Coming Soon> document that is still being developed.