-
Notifications
You must be signed in to change notification settings - Fork 181
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
Add cocotb framework #1057
Add cocotb framework #1057
Conversation
I'm curious if you took a look at the existing
|
e289186
to
5f57387
Compare
@proppy Do you have something specific in mind? We moved the cocotb integration almost entirely to Bazel HDL rules so that we don't have to add (too much) code to XLS. |
I was wondering if it would make sense to expose a similar functionality to drive cocotb from the XLS simulator interface xls/xls/simulation/verilog_simulator.h Line 40 in 835f742
and the C++ test framework integration
but that would be challenging as I'm not sure cocotb expose any external facing API (and that would be redundant with the cocotb testbench itself). I'm also curious however if the IR interpreter/JIT could fit with the https://docs.cocotb.org/en/stable/library_reference_c.html?highlight=GPI interface, so that you could drive DSLX/IR testbenches from cocotb. |
f9fb8a4
to
0e11332
Compare
Cocotb is designed to interact directly with the RTL simulators and because of that, it relies on concepts like clock cycles which are not available in the XLS. I wonder whether this kind of integration is possible for DSLX/IR and if it would be beneficial. |
0e11332
to
23afd2a
Compare
#724 mentioned the ability to produce a schedule proto independently of running codegen, with that information it might be possible to run multiple concurrent IR JIT execution for each pipeline stage and produce a clock-aware and timing accurate simulation? |
d91fe6b
to
70467e8
Compare
Converted to draft while waiting for hdl/bazel_rules_hdl#175. If I manage to merge that PR I will update the git SHA of Bazel HDL Rules in this PR and mark it as "ready for review". |
@proppy Can you take another look? I have changed the link to Bazel HDL Rules to a forked repository, but I will update the PR with a proper link once the corresponding PR in Bazel HDL Rules is merged. |
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.
added more comments, sorry for the late review.
can we remove the draft label if it's ready for review? |
073c5ad
to
6493f0f
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.
Looks very good!
Just some remaining comment about the pytest integration and it should be good to merge.
@rw1nkler did you have a chance to take a look at my last round of comments? |
Internal-tag: [#46586] Signed-off-by: Robert Winkler's avatarRobert Winkler <rwinkler@antmicro.com>
The library contains XLSChannel, XLSChannelDriver and XLSChannelMonitor classes. * XLSChannel - provides a mechanism for wrapping all signals related to XLS channels into one object. * XLSChannelDriver - may be used to send data to XLS channel * XLSChannelMonitor - may be used to monitor transaction taking place in XLS Channel Internal-tag: [#46586] Signed-off-by: Robert Winkler <rwinkler@antmicro.com>
…ation This commit adds a simple DSLX module that sends back the information received on the input channel. The example contains tests written in DSLX to verify the IR, as well as tests that use Cocotb framework to validate behavior of the generated Verilog sources. Internal-tag: [#46586] Signed-off-by: Robert Winkler <rwinkler@antmicro.com>
3ac7491
to
10b0a1c
Compare
I looked at your comments and applied them to this PR. Also, I asked the Cocotb maintainers for more details regarding the Cocotb-pytest integration. |
do you have a pointer to the conversation? |
Sure, here is the link: Unfortunately, it turned out that the release didn't include my changes to cocotb. They will probably be added to the next release |
Was there a new release including those change? If not, maybe showing that integration in a separate repo similar to https://github.com/antmicro/xls-cosimulation-demonstrator would be easier? wdyt? |
The integration already worked on the previous version of the Bazel environment, which allowed reusing the non-hermetic clang toolchain for building cocotb. To make things right in a hermetic environment, we have to either wait for the official release, build our version separately and expose it as an artifact, or provide rules for building the cocotb package inside the Bazel workspace. |
This PR adds a simple proc that forwards the received information from an input channel to an output channel. We found this particular proc surprisingly useful when testing various tools within the toolchain or when reporting bugs. We used it in: * #1415 * #1410 * #1392 * #1057 COPYBARA_INTEGRATE_REVIEW=#1416 from antmicro:passthrough 907a62b PiperOrigin-RevId: 636954688
Should we close this in favor of #1616? |
A more detailed answer has been provided in #1616 (comment) |
Closing in favor of #1616, as requested in #1616 (comment) |
This PR adds the Cocotb framework and simple driver and monitor classes to handle XLS channels in the cocotb simulation. A simple example is also given to verify the added functionality.
CC @proppy