Skip to content

Commit

Permalink
FIX: removing excess prints
Browse files Browse the repository at this point in the history
  • Loading branch information
iansseijelly committed Oct 2, 2024
1 parent b3d8471 commit ca7b2b7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 14 deletions.
1 change: 0 additions & 1 deletion riscv/execute.cc
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ static inline reg_t execute_insn_logged(processor_t* p, reg_t pc, insn_fetch_t f
npc = fetch.func(p, fetch.insn, pc);

if (p->get_trace_enabled()) {
printf("[execute.cc] trace enabled\n");
hart_to_encoder_ingress_t packet {
.i_type = _get_insn_type(&fetch.insn, npc != p->get_state()->pc + insn_length(fetch.insn.bits())),
.exc_cause = 0,
Expand Down
18 changes: 6 additions & 12 deletions riscv/trace_encoder_n.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,15 @@ void trace_encoder_n::reset() {

void trace_encoder_n::set_enable(bool enabled) {
bool was_enabled = this->enabled;
printf("[trace_encoder_n] QAQ setting enable to %d\n", enabled);
this->enabled = enabled;
if (!was_enabled && enabled) {
this->state = TRACE_ENCODER_N_IDLE;
}
}

void trace_encoder_n::trace_encoder_push_commit(hart_to_encoder_ingress_t packet) {
printf("[trace_encoder_n] pushed commit packet at i_addr: %lx\n", packet.i_addr);
this->packet_1 = this->packet_0;
this->packet_0 = packet;
printf("[trace_encoder_n] new packet tcode: %lx\n", _get_packet_0()->i_type);
if (this->enabled) {
fprintf(this->debug_reference, "%lx\n", packet.i_addr);
if (this->state == TRACE_ENCODER_N_IDLE) {
Expand All @@ -31,7 +28,6 @@ void trace_encoder_n::trace_encoder_push_commit(hart_to_encoder_ingress_t packet
this->icnt += _get_packet_0()->ilastsize;
} else if (this->state == TRACE_ENCODER_N_DATA) {
this->icnt += _get_packet_0()->ilastsize;
printf("[trace_encoder_n] icnt: %lx\n", this->icnt);
if (_get_packet_1()->i_type == I_BRANCH_TAKEN) {
trace_encoder_generate_packet(TCODE_DBR);
this->icnt = _get_packet_0()->ilastsize;
Expand Down Expand Up @@ -66,24 +62,24 @@ void trace_encoder_n::trace_encoder_generate_packet(tcode_t tcode) {
switch (tcode) {
case TCODE_PROG_TRACE_SYNC:
_set_program_trace_sync_packet(&packet);
print_packet(&packet);
// print_packet(&packet);
num_bytes = packet_to_buffer(&packet);
fwrite(this->buffer, 1, num_bytes, this->trace_sink);
print_encoded_packet(this->buffer, num_bytes);
// print_encoded_packet(this->buffer, num_bytes);
break;
case TCODE_DBR:
_set_direct_branch_packet(&packet);
print_packet(&packet);
// print_packet(&packet);
num_bytes = packet_to_buffer(&packet);
fwrite(this->buffer, 1, num_bytes, this->trace_sink);
print_encoded_packet(this->buffer, num_bytes);
// print_encoded_packet(this->buffer, num_bytes);
break;
case TCODE_IBR:
_set_indirect_branch_packet(&packet);
print_packet(&packet);
// print_packet(&packet);
num_bytes = packet_to_buffer(&packet);
fwrite(this->buffer, 1, num_bytes, this->trace_sink);
print_encoded_packet(this->buffer, num_bytes);
// print_encoded_packet(this->buffer, num_bytes);
break;
default:
break;
Expand All @@ -109,7 +105,6 @@ void trace_encoder_n::_set_indirect_branch_packet(trace_encoder_n_packet_t* pack
packet->tcode = TCODE_IBR;
packet->src = this->src;
packet->b_type = B_INDIRECT;
printf("[trace_encoder_n] _set_indirect_branch_packet: this->icnt: %lx, _get_packet_0()->ilastsize: %lx\n", this->icnt, _get_packet_0()->ilastsize);
packet->icnt = this->icnt - _get_packet_0()->ilastsize;
uint64_t e_addr = _get_packet_0()->i_addr >> 1;
packet->u_addr = e_addr ^ this->prev_addr;
Expand Down Expand Up @@ -186,7 +181,6 @@ int trace_encoder_n::_packet_to_buffer_indirect_branch_packet(trace_encoder_n_pa
int u_addr_start = 2 + icnt_num_bytes;
int u_addr_msb = find_msb(packet->u_addr);
int u_addr_num_bytes = ceil_div(u_addr_msb, 6);
printf("[trace_encoder_n] _packet_to_buffer_indirect_branch_packet: u_addr_start: %d, u_addr_msb: %d, u_addr_num_bytes: %d\n", u_addr_start, u_addr_msb, u_addr_num_bytes);
for (int iter = 0; iter < u_addr_num_bytes; iter++) {
this->buffer[u_addr_start + iter] = ((packet->u_addr & 0x3F) << MDO_OFFSET) | MSEO_IDLE;
packet->u_addr >>= 6;
Expand Down
1 change: 0 additions & 1 deletion riscv/trace_encoder_n.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ class trace_encoder_n {
public:

trace_encoder_n() {
printf("[trace_encoder_n] trace_encoder_n() constructor evaluated\n");
this->trace_sink= fopen("trace_n.bin", "wb");
this->debug_reference = fopen("trace_n_ref_debug.log", "wb");
this->active = true;
Expand Down

0 comments on commit ca7b2b7

Please sign in to comment.