Skip to content
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

pysv for python testcases #31

Open
mpriestleyidex opened this issue Jul 20, 2024 · 2 comments
Open

pysv for python testcases #31

mpriestleyidex opened this issue Jul 20, 2024 · 2 comments

Comments

@mpriestleyidex
Copy link

It's a fairly well trodden path to write testcases in C. The simulator calls the C testcase, which in turn interacts with the simulation via various DPI export callbacks. A trivial example is https://www.edaplayground.com/x/4D3t

But of course we'd like to do that in Python, and hide all the C away. pysv looks like it could make this happen, but:

  • How do I make a DPI import a context import?
  • How do I call my DPI exports from python?
    • Does pysv help with that, or is it sufficiently easy to use ctypes or pybind11 directly?
    • Either way, an example in the docs would be very helpful.

FWIW I've already achieved this using CFFI, but there's a lot of boilerplate and it wasn't easy to work out what to do.

@Kuree
Copy link
Owner

Kuree commented Jul 21, 2024

How do I make a DPI import a context import?

Currently all import statements are hardcoded to non-context import, since I don't have plan to expose svScope to the python land. That being said, I will add a context keyword to enable context keyword code generation.

How do I call my DPI exports from python?

This is not supported in the library yet. I'm working on that branch right now. Will let you know once I'm done with the implementation.

@mpriestleyidex
Copy link
Author

I think svScope manipulation would also be necessary. Not all exports would be in the same scope as the context import.

Maybe there's a distinction here between calling exports created by your code generation, and calling pre-existing exports?

Anyway, do what you're planning to do with exports, and we'll go from there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants