[dvsim] Small tidy-ups in dvsim.py command line parsing

  - Arguments with action 'store_true' already get a default of False,
    so don't bother doing that explicitly.

  - Simplify how we take arguments in the FlowCfg constructor. Note
    that this wouldn't be equivalent code if we modified self.items,
    self.list_items or self.select_cfgs. But we don't.

  - Rename -select_cfgs to --select-cfgs (apparently this was the
    intended name, based on PR feedback). Default to None. This means
    that passing --select-cfgs with no arguments is now different from
    not passing it at all, which is probably the behaviour we want.

  - Tidy up the logic in prune_selected_cfgs to allow self.select_cfgs
    to be None. And write the filter as a 1-line list comprehension
    rather than using list's remove method.

  - Print an error if the user wrongly passed -select_cfgs for a
    non-master config (before this patch, we just ignored the argument).

  - Use None as a default reseed value rather than -1. I think it's
    probably better to get an error if we forget to set reseed
    somewhere than to get -1*reseed_multiplier iterations, then loop
    over range(-10) tests (which is the empty sequence) without any
    error.

  - Pull the FlowCfg factory logic into a separate factory function in
    dvsim.py called make_config().

  - Default to None for --tool and print an error if a simulation run
    has no tool on the command line or in a non-master-config config
    file. This previously failed rather mysteriously when it
    substituted the empty string for {tool} when constructing
    filenames.

  - Default to None for --profile. We have to default to a string (we
    pick something clearly bogus) in the SimCfg constructor so that
    interpolation works when --profile is not set. This should have no
    effect, because no config file should use {profile} except in a
    profile build_mode. But it's probably good to have something that
    makes it clear what's going on.

  - Use nargs=? for the --profile argument. Now "--profile" means
    "profile for time". If you want to explicitly specify how to
    profile, you can do that too ("--profile=time" or
    "--profile=mem").

  - Slightly change the semantics of --list. If not specified, it does
    nothing. If passed with no arguments (nargs is now *, not +), it
    lists targets for all categories. If passed with some
    categories (now checked against a list of valid options), it lists
    targets that match the categories.

  - Default to None for --branch; move comment into a docstring in the
    resolve_branch function.

  - Use choices=... to force sensible values when using --profile,
    --verbosity or --verbose.

Signed-off-by: Rupert Swarbrick <rswarbrick@lowrisc.org>
5 files changed
tree: be321d628c0a946dcf9001973c46d17406e1bdda
  1. .github/
  2. ci/
  3. doc/
  4. hw/
  5. site/
  6. sw/
  7. test/
  8. util/
  9. .clang-format
  10. .dockerignore
  11. .flake8
  12. .gitignore
  13. .style.yapf
  14. _index.md
  15. apt-requirements.txt
  16. azure-pipelines.yml
  17. check_tool_requirements.core
  18. CLA
  19. COMMITTERS
  20. CONTRIBUTING.md
  21. LICENSE
  22. meson.build
  23. meson_init.sh
  24. meson_options.txt
  25. python-requirements.txt
  26. README.md
  27. tool_requirements.py
  28. toolchain.txt
README.md

OpenTitan

OpenTitan logo

About the project

OpenTitan is an open source silicon Root of Trust (RoT) project. OpenTitan will make the silicon RoT design and implementation more transparent, trustworthy, and secure for enterprises, platform providers, and chip manufacturers. OpenTitan is administered by lowRISC CIC as a collaborative project to produce high quality, open IP for instantiation as a full-featured product. See the OpenTitan site and OpenTitan docs for more information about the project.

About this repository

This repository contains hardware, software and utilities written as part of the OpenTitan project. It is structured as monolithic repository, or “monorepo”, where all components live in one repository. It exists to enable collaboration across partners participating in the OpenTitan project.

Documentation

The project contains comprehensive documentation of all IPs and tools. You can access it online at docs.opentitan.org.

How to contribute

Have a look at CONTRIBUTING for guidelines on how to contribute code to this repository.

Licensing

Unless otherwise noted, everything in this repository is covered by the Apache License, Version 2.0 (see LICENSE for full text).