Repository navigation
refactor(sv): identify system tasks and functions by type - #1381
Merged
Merged
Conversation
System task and function calls were carried through the analyzer IR and the frontend as name strings and told apart from user subroutine calls by their `$` prefix. Each consumer matched names again, and the lists of data queries and the result types of the integral functions were repeated in several places, with entries that had drifted apart. The catalog now identifies each supported call as a `SystemFunction` or `SystemTask`. `ConstExpr::Function` and `Expr::Call` take a `Callee`, a user subroutine or a system function, and `Stmt::SystemTask` takes the task. Data queries, effectful calls and fixed result types are answered by the catalog, so the frontend dispatches on the enums instead of names.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Contributor
Merge Queue Status
This pull request spent 41 minutes 44 seconds in the queue, including 39 minutes 57 seconds running CI. Required conditions to merge
|
38 of 66 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
System task and function calls were carried through the SV analyzer IR and the frontend as name strings, told apart from user subroutine calls by their
$prefix. About 20 files matched names again. The list of data queries ($bits | $size | $left | ...) and the result types of the integral functions were repeated in 4–5 places, and some copies had drifted apart.This PR gives the calls types:
system_functions.rs): each supported entry carries aSystemFunction(withArrayQuery) or aSystemTask(withRadix,Severity,MemoryFormat). Properties that were spread across the code now live on the enum:is_data_query,is_effectful,result_type.check_callreturns the identified call (SystemCall), andcheck_function_callcovers expression position.ConstExpr::Function/Expr::Calltakecallee: Callee(Subroutine(String)|System(SystemFunction)), andStmt::SystemTasktakestask: SystemTask.typecheck::bit_vector_function_return_typeandsystem_functions::is_system_name.SystemTaskKind, readmem,$urandomhandling and the bit-vector lowering are driven by the types.called_system_function/called_system_taskinstead of comparing names.Behavior notes
This is meant to be a pure refactor, with these minor edge cases:
$readmemh/$readmembwith a destination that is neither an identifier nor a select now reports the readmem-specific error, where it used to report a generic "system task" error.$urandom(seed)in glue logic) now returnsNone(unsupported). Before, it fell into the$onehot0branch.$unsupported_mixed_function_*placeholder calls are now user-subroutine callees. They are no longer treated as system calls because of their$prefix.Validation
cargo clippy -p celox-sv-analyzer -p celox-frontend-sv -p celox --features celox/systemverilog --tests: cleancargo test -p celox-sv-analyzer -p celox-frontend-sv -p celox --features celox/systemverilog: 11603 passed, 0 failed