-
Notifications
You must be signed in to change notification settings - Fork 16
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
Hardware Logging #595
Hardware Logging #595
Conversation
Looks pretty cool - this makes another software development comfort available in hardware.. |
An idea - maybe the log entries should also contain some sort of subsystem identifiers? This way, a given subsystem might make log entries at different log levels, and it would be possible to filter both on log levels and subsystems. |
the log messages. Adapted from https://stackoverflow.com/a/56944256/3638629 | ||
""" | ||
|
||
magenta = "\033[0;35m" |
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.
Aren't there any python library to print text in color?
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.
I don't want to add another dependency for such a simple functionality.
scripts/run_benchmarks.py
Outdated
def run_benchmarks_with_pysim( | ||
benchmarks: list[str], | ||
traces: bool, | ||
) -> bool: |
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.
Why this is multiline now, when there is less arguments?
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.
Fixed.
Waiting on branch conflicts. |
Inspired by recent PR with assertions, I made a draft of a small utility for logging various events. The usage would be simple - call
log.debug(m, trigger, "message with formats, e.g. {:08x}", pc)
somewhere in the circuit and then during the simulation, a log message would be printed whenevertrigger
is high with the signals provided.I think this could also supersede assertions - a specific level of logging (could be
error
) could basically raise an assertion whenever a trigger is high.As an example, I added one log to the jumpbranch unit and this is an excerpt from the output of the test:
It integrates with cocotb nicely:
TODO:
To test it you can run either: