Skip to content

Commit

Permalink
FIX: fully correctly decode
Browse files Browse the repository at this point in the history
  • Loading branch information
iansseijelly committed Oct 2, 2024
1 parent 369dd65 commit 62fc95b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
13 changes: 4 additions & 9 deletions riscv/trace_encoder_n.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ trace_encoder_n::trace_encoder_n() {
this->src = 0;
this->state = TRACE_ENCODER_N_IDLE;
this->icnt = 0;
this->updesc = false;
this->packet_0 = (hart_to_encoder_ingress_t*) malloc(sizeof(hart_to_encoder_ingress_t)); // create empty packet
this->packet_1 = (hart_to_encoder_ingress_t*) malloc(sizeof(hart_to_encoder_ingress_t)); // create empty packet
}
Expand Down Expand Up @@ -37,16 +36,12 @@ void trace_encoder_n::trace_encoder_push_commit(hart_to_encoder_ingress_t* packe
} else if (this->state == TRACE_ENCODER_N_DATA) {
this->icnt += this->packet_0->ilastsize;
printf("[trace_encoder_n] icnt: %lx\n", this->icnt);
if (this->packet_0->i_type == I_BRANCH_TAKEN) {
if (this->packet_1->i_type == I_BRANCH_TAKEN) {
trace_encoder_generate_packet(TCODE_DBR);
this->icnt = 0;
} else if (this->packet_0->i_type == I_JUMP_INFERABLE || this->packet_0->i_type == I_JUMP_UNINFERABLE) {
this->updesc = true;
} else if (this->updesc) {
this->icnt = this->packet_0->ilastsize;
} else if (this->packet_1->i_type == I_JUMP_INFERABLE || this->packet_1->i_type == I_JUMP_UNINFERABLE) {
trace_encoder_generate_packet(TCODE_IBR);
this->icnt = this->packet_0->ilastsize;
printf("[trace_encoder_n] icnt: %lx\n", this->icnt);
this->updesc = false;
}
this->state = this->icnt >= MAX_ICNT ? TRACE_ENCODER_N_FULL : TRACE_ENCODER_N_DATA;
} else if (this->state == TRACE_ENCODER_N_FULL) {
Expand Down Expand Up @@ -111,7 +106,7 @@ void trace_encoder_n::_set_program_trace_sync_packet(trace_encoder_n_packet_t* p
void trace_encoder_n::_set_direct_branch_packet(trace_encoder_n_packet_t* packet){
packet->tcode = TCODE_DBR;
packet->src = this->src;
packet->icnt = this->icnt;
packet->icnt = this->icnt - this->packet_0->ilastsize;
}

void trace_encoder_n::_set_indirect_branch_packet(trace_encoder_n_packet_t* packet){
Expand Down
2 changes: 0 additions & 2 deletions riscv/trace_encoder_n.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,6 @@ class trace_encoder_n {
FILE* trace_sink;
FILE* debug_reference;

bool updesc;

hart_to_encoder_ingress_t* packet_0; // the newer packet
hart_to_encoder_ingress_t* packet_1; // the older packet

Expand Down

0 comments on commit 62fc95b

Please sign in to comment.