Skip to content

[Sim] Add output-stream support and introduce sim.get_file#10163

Merged
fzi-hielscher merged 1 commit into
llvm:mainfrom
nanjo712:feat/sim-get-file
Apr 10, 2026
Merged

[Sim] Add output-stream support and introduce sim.get_file#10163
fzi-hielscher merged 1 commit into
llvm:mainfrom
nanjo712:feat/sim-get-file

Conversation

@nanjo712

@nanjo712 nanjo712 commented Apr 9, 2026

Copy link
Copy Markdown
Contributor

This PR added sim.get_file operation, and extended the sim.print/sim.proc.print operations to support control over the output stream.

This PR was split from #10146 .

@nanjo712 nanjo712 changed the title [Sim] Add the sim.get_file operation [Sim] Add output-stream support and introduce sim.get_file Apr 9, 2026
@nanjo712 nanjo712 force-pushed the feat/sim-get-file branch 2 times, most recently from 758b090 to 28a5c5a Compare April 9, 2026 10:04
@nanjo712

nanjo712 commented Apr 9, 2026

Copy link
Copy Markdown
Contributor Author

Should we add an operation that directly represents stdout/stderr?

However, since the stream parameter is currently optional, it might be feasible to have sim.print default to stderr when no stream is specified.

If we need to do this, I think we might need to update the description of the print operation here to account for this detail.

@fzi-hielscher fzi-hielscher left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for breaking this out. I wasn't aware until now that FIRRTL allows dynamic filenames. That does make thinks a bit more complicated.

Should we add an operation that directly represents stdout/stderr?

However, since the stream parameter is currently optional, it might be feasible to have sim.print default to stderr when no stream is specified.

Yes, let's add them in a followup PR. The FIRRTL behavior of defaulting to stderr is kind of unusual and that should be stated explicitly in the IR. If no stream is specified we can just let the backend pick its default output stream.

Comment thread include/circt/Dialect/Sim/SimOps.td
Comment thread include/circt/Dialect/Sim/SimOps.td Outdated
Comment thread lib/Conversion/MooreToCore/MooreToCore.cpp Outdated
@nanjo712 nanjo712 force-pushed the feat/sim-get-file branch 2 times, most recently from b92478d to 55d131b Compare April 9, 2026 12:54
@nanjo712 nanjo712 requested a review from fzi-hielscher April 9, 2026 13:19
Comment thread lib/Dialect/Sim/Transforms/ProceduralizeSim.cpp Outdated
Comment thread lib/Dialect/Sim/Transforms/ProceduralizeSim.cpp Outdated
Comment thread include/circt/Dialect/Sim/SimOps.td Outdated
Comment thread lib/Dialect/Sim/Transforms/ProceduralizeSim.cpp Outdated
@fzi-hielscher fzi-hielscher added the Simulator Involving the Sim dialect or other simulation concerns label Apr 9, 2026
@nanjo712 nanjo712 force-pushed the feat/sim-get-file branch 2 times, most recently from 7678ccb to 148b47a Compare April 9, 2026 16:30
@nanjo712 nanjo712 requested a review from fzi-hielscher April 9, 2026 16:36

@uenoku uenoku left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for breaking up the PR, I really appreciate. Also thank you @fzi-hielscher for thorough reviews.

Comment thread lib/Dialect/Sim/Transforms/ProceduralizeSim.cpp
@nanjo712 nanjo712 force-pushed the feat/sim-get-file branch 5 times, most recently from e8ee155 to 6d33f8b Compare April 10, 2026 07:46

@fzi-hielscher fzi-hielscher left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, only a small nit left.

Comment thread lib/Dialect/Sim/Transforms/ProceduralizeSim.cpp Outdated
@nanjo712 nanjo712 force-pushed the feat/sim-get-file branch from 6d33f8b to 95bfc9e Compare April 10, 2026 13:10
…roc.print operations to support control over the output stream
@nanjo712 nanjo712 force-pushed the feat/sim-get-file branch from 95bfc9e to 46cb02d Compare April 10, 2026 13:14
@fzi-hielscher fzi-hielscher merged commit 55b1402 into llvm:main Apr 10, 2026
7 checks passed
@nanjo712 nanjo712 deleted the feat/sim-get-file branch April 10, 2026 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Simulator Involving the Sim dialect or other simulation concerns

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants