Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

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.

FlowCheckerProgramChecks
cdcmeridiancdcmcdcClock domain crossings: synchronizers, reconvergence, glitches. Commercial, Real Intent
rdcmeridianrdcmrdcReset 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
StepIn this flowProduces
filelistAsks FuseSoC for the syn target of the design’s coreA copy of every source
flattenRebases the target’s .scr filelistfilelist.f
scriptWrites the checker’s run script from the config. Not there with script setscript/run.tcl
cdc or rdcRuns the checker on the script. The resultThe 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.

KeyUsed byEffect
tool.checkerallThe checker: meridiancdc for CDC, meridianrdc for RDC. If unset, the project file’s tool.cdc.checker or tool.rdc.checker
targetfilelistThe core’s target that describes the design as it is built. Default syn. Its tool must write one flat filelist, as icarus does
mappingsfilelistMore FuseSoC mappings, after the top’s and the design’s
definesscriptMacros defined when the design is read, such as AST_BYPASS_CLK
parametersscriptValues for parameters of the top module, by name
variablesscriptTcl 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
constraintsscriptSDC files: the clocks and what is asynchronous. A check without them knows no clocks
env_linesscriptLines of an environment file of the run’s own, read after the constraints
env_filesscriptEnvironment files: intent beyond the constraints, such as constants and extra resets
config_scriptsscriptTcl sourced once the intent is analysed
black_boxesscriptModules elaborated as black boxes, such as a clock gate whose technology cell is not in the RTL
synchronizersscriptModules that synchronise a signal into a clock domain, such as a two-flop synchronizer
reset_synchronizersscriptModules that synchronise a reset
reset_scenariosscriptRDC only. Tcl that sets the reset scenarios to check. Without it, the scenarios the checker works out
wavesscriptRDC only. Write a waveform of each violation
waiversscriptTcl that waives findings, sourced after the check
readscheckOther 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
scriptcheckThe project’s own run script, in place of the checker’s. See A project’s own script
fail_oncheckThe levels that fail the design, of error, warning, review and info. Default error, warning, review. Empty, a check reports and fails nothing
timeoutcheckWall-clock limit for the check, such as "12h". No limit if unset
resources.<step>That stepWhat the step holds while it runs. A chip-level check needs a lot of memory
tagsSelectionLabels for the design’s jobs of the flow
tools.meridiancdc.check.args, tools.meridianrdc.check.argscheckExtra arguments for the program
tools.<checker>.reportcheckThe report to parse, relative to the check step’s directory, for a project script that writes it elsewhere
tools.<checker>.ignored_warningscheckNumbers 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:

  1. Set <KIND>_WAIVER_DIR to the first waiver’s directory, as OpenTitan’s scripts do, then the config’s variables.
  2. analyze -sverilog the filelist, with the defines, and elaborate the top, with the parameters and black_boxes.
  3. Name the synchronizers: set_user_cntl_synchronizer and set_user_reset_synchronizer for CDC, and set_rdc_user_defined_sync_cell for RDC.
  4. read_sdc the constraints into an environment file, then read_env it, the env_lines and the env_files, and analyze_intent. Source the config_scripts.
  5. CDC: report the setup checks and verify_cdc. RDC: write the scenarios the checker works out to reports/reset_scenarios.tcl, source the config’s reset_scenarios or those, and verify_rdc.
  6. Source the waivers, and report_policy -compat the ALL, NEW and WAIVED policies to reports/<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

CheckIf it fails
The checker was not killed by a signal, and finished within the timeoutstep error
Its log has no licensing errorstep error
It wrote its report, and the report has the summary of the NEW policystep error
It did not exit non-zero without a finding that fails itstep error
No finding of a level in fail_onfailed

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

  1. Read the run script. script/run.tcl is what the checker was told: the files it read, the synchronizers, the black boxes and the waivers.

  2. Does the parse agree with the report? Each rule’s new count in result.json should be the number of its violations in messages. 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
    
  3. Read the reports. cdc/reports/ or rdc/reports/ has each policy’s report, which has every violation in full.

Limits

  • A synchronizer must be in the design. Meridian stops on a synchronizers or reset_synchronizers module 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.