Skip to content

[RFC] add pre-run simulation hook for cli.main #586

Closed as not planned
Closed as not planned
@github-4o

Description

@github-4o

as far as i can tell, current simulation cli-based workflow for a module is the following:
module.py:

main(m, ...)

which gives control to cli.py:
https://github.com/nmigen/nmigen/blob/746886ca8ac3b9a8941b540a347452805acbbcf2/nmigen/cli.py#L68-L73
which sets up the simulation environment
this (again as far as could see) implies that one needs to have a separate python module that is to be invoked for simulation of module.py.
codegen for a module.py is invoked as module.py generate ..., while
sim for module.py is invoked as some_module.py simulate ...

suggested solution: pre-run simulation hook defined in module.py, invoked by simulate option in cli.main

  • pros: unified cli interface for both simulation and codegenration via the module.py cli arguments
  • cons: module code bloating as a module will have both hdl-relaed code and testbench-related code in a single file. this may be a problem as testbench code tends to be times larger then uut

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions