-
Notifications
You must be signed in to change notification settings - Fork 857
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: a basic BTM N-trace spec compliant trace encoder model #1824
base: master
Are you sure you want to change the base?
Conversation
@YenHaoChen can you review this one? |
Hi, thanks for the review. I have fixed (I think) the memory leak regarding |
riscv/trace_encoder_n.cc
Outdated
#include "trace_encoder_n.h" | ||
|
||
trace_encoder_n::trace_encoder_n() { | ||
this->trace_sink= fopen("trace_n.bin", "wb"); |
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.
This file name should be different for each hartId .. a simple way to avoid clobbering the same file in a multi-core with-trace simulation.
.i_type = _get_insn_type(&fetch.insn, npc != p->get_state()->pc + insn_length(fetch.insn.bits())), | ||
.exc_cause = 0, | ||
.tval = 0, | ||
.priv = P_M, // TODO: check for processor privilege level |
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.
This priv
should be fixed.
Should this trace_encoder_push_commit
also be added to the take_trap
and take_interrupt
methods?
public: | ||
|
||
trace_encoder_n() { | ||
this->trace_sink= fopen("trace_n.bin", "wb"); |
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.
Perhaps the constructor should include hartId
as a parameter, and then trace_n.bin
can be hart<id>_trace_n.bin
here?
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.
You should implement a destructor for this class that fcloses
the file.
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.
Feels like multi-core needs to be handled more carefully. According to the spec there needs to be a spec funnel, and the decoder also needs to spawn multiple workers and discern sources. Maybe we should add the multi-core support later.
This PR adds a trace encoder model to spike, making it capable of dumping encoded n-trace packets in the slow path, which a separate decoder can later decode. It is enabled by a trace controller device (see: ucb-bar/spike-devices#8) and implements the basic trace encoding mechanisms. Adding this to spike will make the software development of the decoder easier, and a reference for RTL encoders to check upon.