ibex/vendor/lowrisc_ip/dv/tools/ralgen
Marno van der Maas 2b1e3de746 Update lowrisc_ip to lowRISC/opentitan@0deeaa99e
Update code from upstream repository
https://github.com/lowRISC/opentitan to revision
0deeaa99e5760ee4f5c0a08e5fc1670509d22744

* [dv] Fix extension parsing in memutil (Gary Guo)
* [dv,vcs] add an option to override debug_region vcs flag (Sharon
  Topaz)
* [bazel,dvsim] fix airgapped cquery bug (Tim Trippel)
* [prim_present/dv] Only test relevant configs and improve coverage
  (Michael Schaffner)
* [prim_lfsr/dv] Add tests to improve coverage (Michael Schaffner)
* [gpio/dv] Add second build mode for CDC prims (Michael Schaffner)
* bugFix sim_cfg.hjson.tpl (skfwe wang)
* [verilator] Add optional argument for trace file path (Alexander
  Williams)
* [dv] Fix multibit bug in interrupt test register prediction (Michael
  Schaffner)
* [dvsim] update sim.mk to accomodate OTP images under hw/ (Tim
  Trippel)
* [doc] Remove defunct sectionContent macros (James Wainwright)
* [util/uvmdvgen] Fix links in HW checklist template (Andreas Kurth)
* [governance] Add `SEC_CM_SCOPED` to D1 Checklist (Andreas Kurth)
* [dv/otp_ctrl] Fix cdc issue (Cindy Chen)
* [dvsim] add custom wavefile option (Jaedon Kim)
* [kmac,dv] fix regression - kmac_err (Jaedon Kim)
* [dv/clk_rst_if] Avoid freeze due to rst undriven (Guillermo
  Maturana)
* [top-level,clk_rst] Create separate clk_rst_if for xbar mode
  (Guillermo Maturana)
* [chip,dv] update flash_wrtie mappping (Jaedon Kim)
* [chip_tb] Integrate usbdpi into chip tb (Adrian Lees)
* [dv/cdc] Enable CDC in four more IPs (Guillermo Maturana)
* [dv/prim_alert] Enable CDC instrumentation (Guillermo Maturana)
* [dv/prim] Enable CDC instrumentation for some prims (Guillermo
  Maturana)
* [prim/rtl] Define `WITHIN_MARGIN` macro (Andreas Kurth)
* Remove out-of-date "mode" in dvsim (Rupert Swarbrick)
* [dv] Define `ASSERT_AT_RESET_AND_FINAL` macro (Andreas Kurth)
* [dv] Define `ASSERT_AT_RESET` macro (Andreas Kurth)
* [usb_diff_rx] Model pull-up behavior (Michael Schaffner)
* [doc] Fix `that that` typo (Douglas Reis)
* [doc] Fix `the the` typo (Douglas Reis)
* [doc] Fixed broken file links (Hugo McNally)
* [doc] Fixed links between books (Hugo McNally)
* [doc] Fixed some broken links to external sites (Hugo McNally)
* [doc] fixed links into github repos (Hugo McNally)
* [doc] removed link to private repo (Hugo McNally)
* [doc] Add DVSim design doc and glossary (Miguel Osorio)
* [doc] Add new DVSim README (Miguel Osorio)
* [doc] Move dvsim test planner into dvsim/doc (Miguel Osorio)
* Add function called by dvsim publish to trigger a website rebuild
  (Harry Callahan)
* [hw,dv_utils] Fix macro substitution issue with Xcelium (Raviteja
  Chatta)
* [bazel,dvsim] enable passing `--data-perm` flag through dvsim/bazel
  (Timothy Trippel)
* [doc] Updated documentation to reference the new build script. (Hugo
  McNally)
* [doc] Update simulation results link (Raviteja Chatta)
* [flash_ctrl] update `IPoly` parameter in flash scrambler (Timothy
  Trippel)
* [dvsim] Removed depreciated Universal Newline flag (Hugo McNally)
* [doc] Replace wavejson shortcodes with code-blocks (Hugo McNally)
* [doc] Rewrite most frontmatters to Markdown titles (Hugo McNally)
* [doc] Manually changed remaining hugo links (Hugo McNally)
* [doc] Replaced Hugo links with standard markdown (Hugo McNally)
* [doc] Created two initial mdbooks for new layout (Hugo McNally)
* [doc mv] `util/` doc files moved for new layout. (Hugo McNally)
* [doc mv] `hw/` doc files moved for new layout. (Hugo McNally)
* [doc mv] hw/ip* doc files moved for new layout. (Hugo McNally)
* [dv/verilator] Get '-c' flag of Verilator simulator working (Raphael
  Isemann)
* [lint,prim_generic] Turn off unused Verilator lint in clock buf
  (Marno van der Maas)
* [dv/util/sungrid] Fix issue when running sungrid in parallel (Eitan
  Shapira)
* [dv/common] Fix xelium enum type issue (Cindy Chen)
* [dvsim] Disable automatic timeout in gui mode (Cindy Chen)
* [dvsim] Publish json results if available (Andreas Kurth)
* [dvsim] Write json report to file (Andreas Kurth)
* [dvsim] Generate json from run results (Andreas Kurth)
* [dvsim] Add method to convert unit of JobTime (Andreas Kurth)
* [dvsim] Add option to disable normalization of JobTime (Andreas
  Kurth)
* [dvsim] Store coverage summary also in dict (Andreas Kurth)
* [doc] Improve various titles (Marno van der Maas)
* [doc] Added missing title headers (Marno van der Maas)
* [doc] Add TODO to empty stubs (Marno van der Maas)
* Add missing dependencies (Wojciech Sipak)
* [dv] Add build options after file list (Sharon Topaz)
* [rtl/prim] Fix prim_alert_receiver SVA for CDC (Guillermo Maturana)
* [dv] Make prim_secded_* toggle coverage 100% (Weicai Yang)
* [dv] Exclude prim_secdec_* in coverage collection (Weicai Yang)
* [secded/fpv] Remove data input assumption (Michael Schaffner)
* [fpv/prim_count] Add expected failure hjson (Cindy Chen)
* [dv, rv_dm] Fix scoreboard (Srikrishna Iyer)
* [dv, dv_macros] Expand DV_CLOCK_CONSTRAINT range (Srikrishna Iyer)
* [dv, dv_base_reg] Add `get_mask_from_fields` function (Srikrishna
  Iyer)
* [dv/xprop] Enable per-IP xprop configuration file (Guillermo
  Maturana)
* [dv] Change alert_test to run with default build mode (Weicai Yang)
* [dv,dvsim] Add run timeout multiplier option (Guillermo Maturana)
* [dv/shadowed_reg] Reduce a env_cfg variable (Cindy Chen)
* [dvsim] do not print status if `--interactive` (Eli Kim)
* [dvsim] Add unlimited timeout (Eli Kim)
* Revert "[dvsim] Add descriptions to timeout" (Eli Kim)
* [dvsim] Fix flake8 lint error (Eli Kim)
* [dvsim] Launch subprocess interactively (Eli Kim)
* [dvsim] Add `--interactive` argument (Eli Kim)
* [dvsim] Better dashboard result for parameterized blocks (Weicai
  Yang)
* create the log in a correct way (Sharon Topaz)
* Sungrid input from command file instead of command line (Sharon
  Topaz)
* [chip dv] Fix compile time warnings - Xcelium (Srikrishna Iyer)
* [dv] Clean up TODOs in csr_utils (Weicai Yang)
* [dv] Clean TODOs in mem_bkdr_* (Weicai Yang)
* [chip dv] Fix compile warnings in RTL and DV (Srikrishna Iyer)
* [dv] Resolve/clean up more TODOs (Weicai Yang)
* [dvsim] Add descriptions to timeout (Eli Kim)
* [fpv] Clean up strong property in simulation (Cindy Chen)
* [dv/xprop] Change code to be more xprop-friendly (Guillermo
  Maturana)
* [dv] Clean up TODOs in dv_lib (Weicai Yang)
* [chip dv] Implement the E2E JTAG debug and inject tests (Srikrishna
  Iyer)
* [dv, util] Add read_vmem function (Srikrishna Iyer)
* [dv str_utils_pkg] Add more string util methods (Srikrishna Iyer)
* [dv] Move sw_symbol_get_addr_size to dv_utils_pkg (Srikrishna Iyer)
* [dv, sim.mk] Copy elf file without .bin suffix (Srikrishna Iyer)
* [dv] Resolve TODOs in cip_macros (Weicai Yang)
* [prim_sparse_fsm_flop] Make DV statement x-prop safe (Michael
  Schaffner)
* [dv/cov] Exclude coverage of dv-only code (Guillermo Maturana)
* [dv/chip] Disable alert ping scb default check (Cindy Chen)
* [dv] ensure RAM ELF file gets copied to the rundir (Timothy Trippel)
* [dv] Use build seed to regenerate LC encoding for each build
  (Michael Schaffner)
* [dv/coverage_cfg] Remove coverage of prim_onehot_check (Guillermo
  Maturana)
* [prim] Add sync_req_ack based async FIFO (Michael Schaffner)
* [prim] Add RZ protocol to prim_sync_reqack* (Michael Schaffner)
* [dvsim] Move empty pattern list to common (Eli Kim)
* [prim] Reset assertion improvement (Canberk Topal)
* [prim_mubi*_sync] Remove explicit mux prim to improve coverage
  (Michael Schaffner)
* [fpv] Support build_pass_pattern in OneShotCfg (Cindy Chen)
* [dv] Increase MAX_CYCLE to 30 in sec_cm SVA (Weicai Yang)
* [dv_macros] Kill live assertions when disabling in `DV_ASSERT_CTRL`
  (Andreas Kurth)
* [dv, csr_utils_pkg] Add user frontdoor mechanism on all CSR methods
  (Srikrishna Iyer)
* [dv/chip] Support exclude certain alert injections in all_escalation
  test (Cindy Chen)
* [dv, csr_utils_pkg] Fix csr_read for field accesses (Srikrishna
  Iyer)
* [prim-cdc-rand-delay] Fix bug due to dv macro (Srikrishna Iyer)
* [verilator] Simulate GPIOs with weak pull up/down. (Chris Frantz)
* [dv,bazel] only copy over an ELF file if one exists (Timothy
  Trippel)
* [chip,dv,i2c] en_monitor update for top_earlgrey (Jaedon Kim)

Signed-off-by: Marno van der Maas <mvdmaas+git@lowrisc.org>
2023-07-06 07:55:47 +00:00
..
ralgen.core Vendor in hw/dv/{data,tools} from OpenTitan 2020-11-28 12:12:27 +00:00
ralgen.py Update lowrisc_ip to lowRISC/opentitan@f9e667550 2022-08-05 18:00:25 +01:00
README.md Update lowrisc_ip to lowRISC/opentitan@0deeaa99e 2023-07-06 07:55:47 +00:00

ralgen: A FuseSoC generator for UVM RAL package

The ralgen.py script is implemented as a FuseSoC generator. which enables the automatic creation of the SystemVerilog UVM RAL package and its insertion into the dependency tree when compiling the DV testbench.

This approach is useful for DV simulation flows that use FuseSoC as the backend to generate the filelist for compilation. A separate RAL package generation step is no longer needed since it gets handled within FuseSoC.

Generator

The adjoining ralgen.core file registers the ralgen generator. The FuseSoC core file that 'calls' the generator adds it as a dependency. When calling the generator, the following parameters are set:

  • name (mandatory): Name of the RAL package (typically, same is the IP).
  • dv_base_names (optional): The base class names from which the register classes are derived. Set this option to derive the register classes not from the default dv_base_reg, but from user defined custom class definitions. This argument follows the following format: --dv-base-names block:type:entity-name block:type:entity-name .... block: can be any block names. type: can be block, reg, field, pkg, mem, or use all to override all types within the block. entity_name: the name of the base class / package. If the type is set to all, then this represents the prefix of the bass class / package. The suffixes _reg_block, _reg, _reg_field, _mem, _reg_pkg are applied to infer the actual base class / package names from which the generated DV classes will extend. Note that we assume the fusesoc core file naming convention follows the package name without the _pkg suffix.
  • ip_hjson: Path to the hjson specification written for an IP which includes the register descriptions. This needs to be a valid input for reggen.
  • top_hjson: Path to the hjson specification for a top level design. This needs to be a valid input for topgen.

Only one of the last two arguments is mandatory. If both are set, or if neither of them are, then the tool throws an error and exits.

The following snippet shows how it is called:

generate:
  ral:
    generator: ralgen
    parameters:
      name: <name>
      ip_hjson|top_hjson: <path-to-hjson-spec>
      [dv_base_names:
        - block_1:type:entity_name_1
        - block_2:type:entity_name_2]


targets:
  default:
    ...
    generate:
      - ral

Note that the path to hjson specification in the snippet above is relative to the core file in which the generator is called.

ralgen script

When FuseSoC processes the dependency list and encounters a generator, it passes a YAML file containing the above parameters to the generator tool (the ralgen.py) as a single input. It then parses the YAML input to extract those parameters.

ralgen.py really is just a wrapper around reggen and the util/topgen.py scripts, which are the ones that actually create the RAL package. Due to the way those scripts are implemented, RAL packages for the IP level testbenches are generated using reggen, and for the chip level testbench, util/topgen.py. Which one to choose is decided by whether the ip_hjson or top_hjson parameter is supplied.

In addition, the ralgen.py script also creates a FuseSoC core file. It uses the name parameter to derive the VLNV name for the generated core file.

The generated core file adds lowrisc:dv:dv_base_reg as a dependency for the generated RAL package. This is required because our DV register block, register and field models are derived from the DV library of classes. This ensures the right compilation order is maintained. If the dv_base_names argument is set, then it adds lowrisc:dv:my_base_reg as an extra dependency, where my_base is the value of the argument as shown in the example above. This core file and the associated sources are assumed to be available in the provided FuseSoC search paths.

Limitations

The script is not designed to be manually invoked, but in theory, it can be, if a YAML file that contains the right set of parameters is presented to it (compliant with FuseSoC).

If the user wishes to create the RAL package manually outside of the DV simulation flow, then the make command can be invoked in the hw/' area instead. It generates the RTL, DV and SW collaterals for all IPs, as well as the top level in a single step.