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

Added get_dumps and get_sorted_sig_dump functions #8

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

morrowsend
Copy link

As discussed in an issue, I refactored the code to return the sorted list of signals and the corresponding values of all the signals in that same sorted order. You can still use the print_dumps tag to have vcdvcd automatically print to the console if needed. I modified the version number in setup.py but did not try to push as described in your release procedure.

You can use print_dumps tag as before to print automatically to the console OR you can return the results of a print_dump using get_dumps and get_sorted_sig_dump.  These are separate since the user might want just one or the other.
@cirosantilli
Copy link
Owner

Thanks for this pull request.

I thought a bit more about this, and felt that it would be better to not store the VCD data multiple times in the object by default. Sorry if this is not what we had discussed previously.

So I updated the API to expose a streaming/callback version of things, which should allow you to achieve what you want. Can you double check the examples at PrintDeltasStreamParserCallbacks and PrintDumpsStreamParserCallbacks?

class PrintDeltasStreamParserCallbacks(StreamParserCallbacks):

You can then just create your own class based on them to achieve your goals. Let me know if this solves your use case.

@morrowsend
Copy link
Author

morrowsend commented Sep 1, 2020 via email

@cirosantilli
Copy link
Owner

I understand, learning new technologies is hard for everyone.

Note that the new setup is very similar to the old one, just slightly cleaner.

If you copy either PrintDeltasStreamParserCallbacks or PrintDumpsStreamParserCallbacks on your own class, and print the fields they use more explicitly key=value, it should be easy to figure out what you need to add to a map created on the __init__ method of your class to achieve the exact data you want.

@morrowsend
Copy link
Author

Ok, great. I'll do that once I flesh out a more complete implementation of all my I/Os on the GUI and test for more complicated VCD files. I currently have a minimal implementation working enough to do some tests for the remaining I/Os at least. Since time is of the essence on certain features (only a couple of weeks before I need something working at this point) I really need to get them implemented, then I can integrate the PrintDumpsStreamParserCallbacks. When I was looking at the exampl.py I thought it printed only the times that signal changes occurred instead of the full table of signals all timestamped. Given shortness on time I didn't investigate too much.

I'm mostly used to C and Java and so it isn't all too different but certain syntax things have tripped me up. Once I realized dict is like a hashMap in Java the rest of the project fell into place after my last reply. Like I said it is far from ready for prime time, but at least I am twiddling switched and LEDs are flashing based on the VCD file at the moment. Once I get a bit further along with it, I'll make it public and you can see what a hack I am at python : )

@cirosantilli
Copy link
Owner

BTW, I changed the interface a bit on ba56abd (2.0.0 release), now you have to do vcd.data['signalname'].tv instead of vcd.data['signalname']['tv'] to allow nice random access to signals: https://github.com/cirosantilli/vcdvcd/#api-usage

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

Successfully merging this pull request may close these issues.

2 participants