CDC and RDC
CDC and RDC check a design’s domain crossings: CDC each signal that crosses from one clock domain to another, and RDC each path from a flop of one reset to a flop of another. A checker reads the design’s RTL, as the syn target of its FuseSoC core describes it, and its timing constraints, which say what the clocks are. It then checks every crossing against its rules, and reports each violation that no waiver matches. By default, a violation that needs looking at fails the design.
The two are separate flows, cdc and rdc, with a config file and a job each. They share everything but the checker and RDC’s reset scenarios, so this page covers both.
| Flow | Checker | Program | Checks |
|---|---|---|---|
cdc | meridiancdc | mcdc | Clock domain crossings: synchronizers, reconvergence, glitches. Commercial, Real Intent |
rdc | meridianrdc | mrdc | Reset domain crossings, in each reset scenario. Commercial, Real Intent |
doris plan cdc chip_earlgrey_asic # the job's steps as a tree
doris plan -v rdc chip_earlgrey_asic # the steps and exact commands
doris run cdc # every design with a CDC config
doris run rdc chip_earlgrey_asic --until script # only write the run script, to read it
doris report cdc # write the report pages again
The steps
flowchart LR
filelist --> flatten --> check["cdc or rdc"]
filelist --> check
script --> check
| Step | In this flow | Produces |
|---|---|---|
filelist | Asks FuseSoC for the syn target of the design’s core | A copy of every source |
flatten | Rebases the target’s .scr filelist | filelist.f |
script | Writes the checker’s run script from the config. Not there with script set | script/run.tcl |
cdc or rdc | Runs the checker on the script. The result | The checker’s reports, and the findings parsed from them |
There is one job per design, context and checker: cdc/<design>@meridiancdc, in scratch/doris/cdc/<design>@meridiancdc/, and cdc/<top>/<design>@meridiancdc for a design in a top’s context, as lint’s contexts are. Every step is cached. The run script is an output of its own step, so changing a waiver runs the check again without writing the script again, and changing an option of the script writes it again.
What the config files control
The flow checks the core of the design’s design.hjson, elaborated as its top: a design needs both. The flow reads cdc.hjson (schema dv/cdc/1) or rdc.hjson (schema dv/rdc/1) next to or below the design file. Paths are relative to the config file.
| Key | Used by | Effect |
|---|---|---|
tool.checker | all | The checker: meridiancdc for CDC, meridianrdc for RDC. If unset, the project file’s tool.cdc.checker or tool.rdc.checker |
target | filelist | The core’s target that describes the design as it is built. Default syn. Its tool must write one flat filelist, as icarus does |
mappings | filelist | More FuseSoC mappings, after the top’s and the design’s |
defines | script | Macros defined when the design is read, such as AST_BYPASS_CLK |
parameters | script | Values for parameters of the top module, by name |
variables | script | Tcl variables set before anything is read, by name: switches the constraints read, such as OpenTitan’s IS_CDC_RUN, and the checker’s ri_ settings |
constraints | script | SDC files: the clocks and what is asynchronous. A check without them knows no clocks |
env_lines | script | Lines of an environment file of the run’s own, read after the constraints |
env_files | script | Environment files: intent beyond the constraints, such as constants and extra resets |
config_scripts | script | Tcl sourced once the intent is analysed |
black_boxes | script | Modules elaborated as black boxes, such as a clock gate whose technology cell is not in the RTL |
synchronizers | script | Modules that synchronise a signal into a clock domain, such as a two-flop synchronizer |
reset_synchronizers | script | Modules that synchronise a reset |
reset_scenarios | script | RDC only. Tcl that sets the reset scenarios to check. Without it, the scenarios the checker works out |
waves | script | RDC only. Write a waveform of each violation |
waivers | script | Tcl that waives findings, sourced after the check |
reads | check | Other files the scripts read, such as the files a waiver script sources. Part of the check’s key, so a change to one runs it again |
script | check | The project’s own run script, in place of the checker’s. See A project’s own script |
fail_on | check | The levels that fail the design, of error, warning, review and info. Default error, warning, review. Empty, a check reports and fails nothing |
timeout | check | Wall-clock limit for the check, such as "12h". No limit if unset |
resources.<step> | That step | What the step holds while it runs. A chip-level check needs a lot of memory |
tags | Selection | Labels for the design’s jobs of the flow |
tools.meridiancdc.check.args, tools.meridianrdc.check.args | check | Extra arguments for the program |
tools.<checker>.report | check | The report to parse, relative to the check step’s directory, for a project script that writes it elsewhere |
tools.<checker>.ignored_warnings | check | Numbers of log warnings that are not findings. Default OpenTitan’s: unused signals and ports, constants, and a few others |
A config for a chip:
{
schema: dv/cdc/1
tool: {
checker: meridiancdc
}
constraints: [
../syn/chip.sdc
]
synchronizers: [
prim_flop_2sync
]
reset_synchronizers: [
prim_rst_sync
]
black_boxes: [
prim_clock_gating
]
waivers: [
cdc_waivers.tcl
]
timeout: "12h"
resources: {
cdc: {
memory: "64G"
}
}
}
Every file the check reads is part of its key: the constraints, environment files, scripts, waivers, reset scenarios and reads. A file one of them sources is not seen unless reads names it.
The run script
The script step writes script/run.tcl, which tells the checker what to do. Its stages are those of OpenTitan’s run-cdc.tcl and run-rdc.tcl, with what those scripts hard-code taken from the config:
- Set
<KIND>_WAIVER_DIRto the first waiver’s directory, as OpenTitan’s scripts do, then the config’svariables. analyze -sverilogthe filelist, with thedefines, andelaboratethe top, with theparametersandblack_boxes.- Name the synchronizers:
set_user_cntl_synchronizerandset_user_reset_synchronizerfor CDC, andset_rdc_user_defined_sync_cellfor RDC. read_sdcthe constraints into an environment file, thenread_envit, theenv_linesand theenv_files, andanalyze_intent. Source theconfig_scripts.- CDC: report the setup checks and
verify_cdc. RDC: write the scenarios the checker works out toreports/reset_scenarios.tcl, source the config’sreset_scenariosor those, andverify_rdc. - Source the
waivers, andreport_policy -compattheALL,NEWandWAIVEDpolicies toreports/<kind>.<policy>.rpt. CDC also reports its clock domains.
Paths in the script are relative to the check step’s directory, where the checker runs, so the script, and its key, are the same in every checkout. doris run cdc DESIGN --until script writes it without running the checker.
A project’s own script
With script set, there is no script step: the checker runs the project’s script. It is given what OpenTitan’s scripts read from the environment: SV_FLIST, BUILD_DIR, DUT, PARAMS (NAME=VALUE words), CONSTRAINT (the files, as words), ENV_FILE, CDC_WAIVER_FILE or RDC_WAIVER_FILE, USER_CONFIG_FILE (CDC), RESET_SCENARIO_FILE and WAVES (RDC), and FOUNDRY_ROOT and FOUNDRY_CONSTRAINT, empty. Each of the environment, waiver and configuration files can be only one. The script runs in the check step’s directory, and its NEW report must be at reports/<kind>.new.rpt, or where tools.<checker>.report says.
The result
result.json has rules, from the summary of the ALL report, which is the only one with the rules every violation of which was waived: each rule’s name, category (such as cdc, rdc, setup or sdc), level, and total, new and waived counts. messages are the findings: what the log says, with the category flow, then each violation no waiver matched, from the NEW report, with its rule and text. A violation is one RuleDataId of its rule: the report gives one row for each thing it involves, such as each flop a reset reaches, and the first row’s columns are its text. counts counts the messages by level, and fail_on says which levels fail. checked is false if the check step did not complete, and reported is false if the checker wrote no report: the counts then say nothing.
What passed means
| Check | If it fails |
|---|---|
| The checker was not killed by a signal, and finished within the timeout | step error |
| Its log has no licensing error | step error |
It wrote its report, and the report has the summary of the NEW policy | step error |
| It did not exit non-zero without a finding that fails it | step error |
No finding of a level in fail_on | failed |
The checker’s exit code is not taken to say what it found: its report decides. A finding is a violation in the report, or an error or warning in the log: a line that starts Error: , ERROR, ERR, Warning: or WARN, with the indented : ... lines under it that say what it is. A log warning whose number is in ignored_warnings is not one, and the log’s infos, one for each file read, are not findings.
Checking a run by hand
-
Read the run script.
script/run.tclis what the checker was told: the files it read, the synchronizers, the black boxes and the waivers. -
Does the parse agree with the report? Each rule’s
newcount inresult.jsonshould be the number of its violations inmessages. If it is not, the report’s details have a violation on more than one line, or none, and the counts are wrong. This is the first thing to check on a new release of the checker.jq -r '.rules[] as $r | "\($r.name)\t\($r.new)\t\([.messages[] | select(.rule == $r.name)] | length)"' result.json -
Read the reports.
cdc/reports/orrdc/reports/has each policy’s report, which has every violation in full.
Limits
- A synchronizer must be in the design. Meridian stops on a
synchronizersorreset_synchronizersmodule the design does not have, and the step is a step error naming it. - Only Meridian. The capabilities, a CDC checker and an RDC checker, are tool-neutral, but Meridian is the only checker.
- Raw output is licensed. Real Intent’s licence restricts sharing a checker’s raw output, and the result file holds its findings.
The roadmap covers what is planned.