add: add moduletype support for memdomain and membackend of verilator#7
add: add moduletype support for memdomain and membackend of verilator#7Mikemy666 wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
Adds --moduletype support to the Verilator “verilog” workflow (intended for memdomain/membackend) alongside the existing --balltype/--config flow.
Changes:
- Update
bbdevCLI help text forverilator --verilogto mention--moduletype. - Extend the verilog event step to choose different
mill ... runMainentrypoints based onmoduletype. - Extend the verilog API step to accept
moduletypeand rejectballtype+moduletypetogether.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
bbdev |
Updates CLI help string to advertise --moduletype for Verilator verilog generation. |
api/steps/verilator/02_verilog_event.step.py |
Adds branching to build the mill command based on moduletype (memdomain vs other). |
api/steps/verilator/02_verilog_api.step.py |
Adds moduletype passthrough and mutual-exclusion check with balltype. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "verilator": { | ||
| "clean": True, | ||
| "verilog": 'Generate verilog files. Args: "[--balltype <type>] [--job <num>] [--batch]"', | ||
| "verilog": 'Generate verilog files. Args: "[--balltype <type>] [--moduletype <memdomain|membackend>] --config <full.config.ClassName> [--output_dir <dir>]"', |
There was a problem hiding this comment.
The help text for verilator --verilog suggests --balltype and --moduletype can both be provided (both are shown as independent optional args). However the API rejects requests that specify both as mutually exclusive. Please update this help string to clearly indicate they are mutually exclusive (e.g., (--balltype <type> | --moduletype <memdomain|membackend>)).
| "verilog": 'Generate verilog files. Args: "[--balltype <type>] [--moduletype <memdomain|membackend>] --config <full.config.ClassName> [--output_dir <dir>]"', | |
| "verilog": 'Generate verilog files. Args: "[--balltype <type> | --moduletype <memdomain|membackend>] --config <full.config.ClassName> [--output_dir <dir>]"', |
| elif input_data.get("moduletype"): | ||
| if input_data.get("moduletype").lower() == "memdomain": | ||
| command = "mill -i __.test.runMain sims.verify.MemDomainTopMain " |
There was a problem hiding this comment.
input_data.get('moduletype').lower() will raise at runtime if moduletype is not a string (e.g., bbdev sub-arg parsing sets flags without values to True). Consider normalizing/validating moduletype (ensure it’s a non-empty string) before calling .lower(), and return a clear validation error when it’s invalid.
| elif input_data.get("moduletype"): | ||
| if input_data.get("moduletype").lower() == "memdomain": | ||
| command = "mill -i __.test.runMain sims.verify.MemDomainTopMain " | ||
| else: | ||
| command = ( | ||
| f"mill -i __.test.runMain sims.verify.ModuleTopMain {input_data.get('moduletype')} " | ||
| ) |
There was a problem hiding this comment.
When moduletype is provided, --config is still required/validated above, but config_name is never used to build the mill ... runMain command in this branch. This makes the required --config effectively ignored for module-type elaboration. Either pass the config through to the appropriate runMain entrypoint(s), or relax the config requirement when using --moduletype and update the user-facing help/error messages accordingly.
| if body.get("balltype") and body.get("moduletype"): | ||
| return ApiResponse( | ||
| status=400, | ||
| body={ | ||
| "status": "error", | ||
| "message": "--balltype and --moduletype are mutually exclusive. Please specify only one.", | ||
| "example": 'bbdev verilator --verilog "--moduletype memdomain --config sims.verilator.BuckyballToyVerilatorConfig"', | ||
| }, | ||
| ) |
There was a problem hiding this comment.
The API currently accepts any truthy moduletype value and forwards it to the queue. Because bbdev can produce moduletype: True when --moduletype is provided without a value, this can later crash the event handler (it calls .lower() on the value). Please validate that moduletype (when present) is a non-empty string (and optionally validate allowed values like memdomain/membackend) and return a 400 with a clear message when invalid.
No description provided.