summaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
authorJulian Blake Kongslie2022-09-23 09:02:59 -0700
committerJulian Blake Kongslie2022-09-23 09:02:59 -0700
commitba263efb92ffba13212cf4ee6fd15b4339349fb3 (patch)
tree7c0329f52fe924ad8faac2859693e88a7f8d4abe /backend
parentAdd a trivial indirect jump predictor and matching test (diff)
downloadprocmodel-ba263efb92ffba13212cf4ee6fd15b4339349fb3.tar.xz
Basic IPC stats support
Diffstat (limited to 'backend')
-rw-r--r--backend/regfile.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/backend/regfile.h b/backend/regfile.h
index 4cf328a..4ea2f31 100644
--- a/backend/regfile.h
+++ b/backend/regfile.h
@@ -4,6 +4,7 @@
4 4
5#include "frontend/decode.h" 5#include "frontend/decode.h"
6#include "infra/port.h" 6#include "infra/port.h"
7#include "infra/stat.h"
7#include "inst.h" 8#include "inst.h"
8#include "memory/dram.h" 9#include "memory/dram.h"
9 10
@@ -16,6 +17,8 @@ namespace backend {
16 infra::port<inst> writebackp; 17 infra::port<inst> writebackp;
17 infra::port<memory::dram::command> *storep = nullptr; 18 infra::port<memory::dram::command> *storep = nullptr;
18 19
20 infra::stat ipc{"ipc"};
21
19 unsigned int generation_up = 0; 22 unsigned int generation_up = 0;
20 unsigned int generation_down = 0; 23 unsigned int generation_down = 0;
21 24
@@ -33,6 +36,7 @@ namespace backend {
33 auto i = writebackp.read(); 36 auto i = writebackp.read();
34 if (i.generation == generation_down) { 37 if (i.generation == generation_down) {
35 pte(i.transaction, "W", fmt::format("writeback gen={} pc={:x}", generation_down, pc)); 38 pte(i.transaction, "W", fmt::format("writeback gen={} pc={:x}", generation_down, pc));
39 ++ipc;
36 assert(pc == i.init_pc); 40 assert(pc == i.init_pc);
37 auto old_pc = pc; 41 auto old_pc = pc;
38 pc = i.linear_next_pc; 42 pc = i.linear_next_pc;