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

Mmio record #930

Merged
merged 7 commits into from
Jan 9, 2025
Merged

Mmio record #930

merged 7 commits into from
Jan 9, 2025

Conversation

FanShupei
Copy link
Contributor

In simcrtl device, we allocate two WO regs, all writes to them are blindly recorded to mmio-event.jsonl. In the folling format:

{"cycle": 123, event: "uart-write", "value": 1}
{"cycle": 456, event: "profile", "value": 2}

Post-process scripts can rebuilt program outputs and profile events from the event records.

@Avimitin Avimitin mentioned this pull request Jan 8, 2025
4 tasks
@Avimitin
Copy link
Contributor

Avimitin commented Jan 8, 2025

Guide to use the latest program instrument and print utilities

Program instrument

#include <emurt.h>

void test() {
    place_counter(1);
    // Place some expensive task here
    place_counter(2);
}

After online driver finish, there should be a mmio-event.jsonl file in current directory contains data like:

{"cycle": 192, "event": "profile", "value": 1}
{"cycle": 1299, "event": "profile", "value": 2}

print

#include <emurt.h>

void test() {
    print_s("Hello, World\n");
}

After online driver finish, there should be a mmio-event.jsonl file in current directory contains data like:

{"cycle": 330, "event": "uart-write", "value": 72}
{"cycle": 404, "event": "uart-write", "value": 101}
{"cycle": 478, "event": "uart-write", "value": 108}
{"cycle": 552, "event": "uart-write", "value": 108}
{"cycle": 626, "event": "uart-write", "value": 111}
{"cycle": 700, "event": "uart-write", "value": 44}
{"cycle": 774, "event": "uart-write", "value": 32}
{"cycle": 848, "event": "uart-write", "value": 87}
{"cycle": 919, "event": "uart-write", "value": 111}
{"cycle": 990, "event": "uart-write", "value": 114}
{"cycle": 1064, "event": "uart-write", "value": 108}
{"cycle": 1138, "event": "uart-write", "value": 100}
{"cycle": 1209, "event": "uart-write", "value": 10}

Those value can be encode to string using following bash script:

$ jq -r 'select(.event == "uart-write") | .value' mmio-event.jsonl | awk '{ printf "%c", $1}'
Hello, World

tests/emurt/emurt.c Outdated Show resolved Hide resolved
@FanShupei FanShupei marked this pull request as ready for review January 9, 2025 05:28
@Avimitin Avimitin force-pushed the mmio-record branch 2 times, most recently from ffb0bfa to 982185e Compare January 9, 2025 09:40
@Avimitin Avimitin merged commit 65ae0fa into master Jan 9, 2025
192 checks passed
@Avimitin Avimitin deleted the mmio-record branch January 9, 2025 14:59
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