-
Notifications
You must be signed in to change notification settings - Fork 314
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Arc][Sim] Lower Sim DPI func to func.func and support dpi call in Arc #7386
Conversation
df12340
to
928d398
Compare
I think in the future. We may require the ClockGen intrinsic for triggering clock and reset. This is the only Verilog simulation blackbox that t1 use in the Verilator/VCS. It should be lowered to both Verilog and ArcOp. |
928d398
to
3f09368
Compare
b6a8560
to
718cfa2
Compare
718cfa2
to
2e949e2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Really cool that arcilator can deal with DPI calls now! 🎉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really really cool! Thanks for also adding an integration test with Arcilator's JIT to actually give this a practical check 🙇 🙌 🥳
hw.module @adder(in %clock : i1, in %a : i32, in %b : i32, out c : i32) { | ||
%seq_clk = seq.to_clock %clock | ||
|
||
%0 = sim.func.dpi.call @dpi(%a, %b) clock %seq_clk : (i32, i32) -> i32 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just out of curiosity: since the sim.func.dpi.call
function seems like it accepts both sim.func.dpi
and func.func
callables, would this code also work with a second sim.func.dpi.call
that calls the @adder_func
directly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Directly calling @adder_func
doesn't work since it's output value is passed by reference in argument. If @adder_func
was a normal dataflow-ish func.func such as func.func @adder_func_ok(%arg0: i32, %arg1: i32) -> i32
, we can call it directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ooooh you're right, sorry, I overlooked that difference in the operand layout. Makes sense!
This PR implements initial support for lowering Sim DPI operations to Arc.
sim.dpi.func
tofunc.func
that respects C-level ABI.sim.dpi.call
op.In the follow-up I'll rename
sim.dpi.call
tosim.func.call
since nowsim.dpi.call
accepts bothsim.dpi.func
andfunc.func
.