Skip to content

Commit

Permalink
Fixed statistics for single-cycle core, fixed BHR UI not disabling pr…
Browse files Browse the repository at this point in the history
…operly
  • Loading branch information
jiristefan authored and ppisa committed Aug 26, 2024
1 parent edf5156 commit ab6692e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
7 changes: 6 additions & 1 deletion src/gui/windows/predictor/predictor_info_dock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ DockPredictorInfo::DockPredictorInfo(QWidget *parent) : Super(parent) {

// Stats
label_stats_total_text->setText("Jump/Branch count:");
label_stats_miss_text->setText("Flush count:");
label_stats_miss_text->setText("Misprediction count:");
label_stats_accuracy_text->setText("Total accuracy:");
clear_stats();

Expand Down Expand Up @@ -223,6 +223,11 @@ void DockPredictorInfo::setup(
value_bhr->setEnabled(false);
}

if (number_of_bhr_bits == 0) {
label_bhr->setEnabled(false);
value_bhr->setEnabled(false);
}

clear_bhr();
}

Expand Down
11 changes: 6 additions & 5 deletions src/machine/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,11 @@ MemoryState Core::memory(const ExecuteInterstage &dt) {
}
}

// Predictor statistics update
if (computed_next_inst_addr != dt.predicted_next_inst_addr) {
predictor->increment_mispredictions();
}

return { MemoryInternalState {
.mem_read_val = towrite_val,
.mem_write_val = dt.val_rt,
Expand Down Expand Up @@ -721,11 +726,7 @@ void CorePipelined::handle_stall(const FetchInterstage &saved_if_id) {
}

bool CorePipelined::detect_mispredicted_jump() const {
bool misprediction = mem_wb.computed_next_inst_addr != mem_wb.predicted_next_inst_addr;
if (misprediction) {
predictor->increment_mispredictions();
}
return misprediction;
return mem_wb.computed_next_inst_addr != mem_wb.predicted_next_inst_addr;
}

bool CorePipelined::is_stall_requested() const {
Expand Down

0 comments on commit ab6692e

Please sign in to comment.