diff options
| author | Julian Blake Kongslie | 2022-10-15 15:01:25 -0700 |
|---|---|---|
| committer | Julian Blake Kongslie | 2022-10-15 15:01:25 -0700 |
| commit | bcf2314f15d68d7a0b94445f99962342b9d4130d (patch) | |
| tree | 89302b2669e6141ebfc86afc4bd9e19eac0c80bf /infra/sim.h | |
| parent | Stop cycle after accepting restart in fetch. (diff) | |
| download | procmodel-main.tar.xz | |
Diffstat (limited to '')
| -rw-r--r-- | infra/sim.h | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/infra/sim.h b/infra/sim.h deleted file mode 100644 index 185916a..0000000 --- a/infra/sim.h +++ /dev/null | |||
| @@ -1,38 +0,0 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | #include <cstdint> | ||
| 4 | #include <string> | ||
| 5 | #include <vector> | ||
| 6 | |||
| 7 | #include "infra/pipetrace.h" | ||
| 8 | |||
| 9 | namespace infra { | ||
| 10 | struct sim { | ||
| 11 | virtual void clock() {} | ||
| 12 | virtual void unclock() {} | ||
| 13 | |||
| 14 | static std::vector<sim *> sims; | ||
| 15 | |||
| 16 | static std::uint64_t now; | ||
| 17 | |||
| 18 | sim() { | ||
| 19 | sims.emplace_back(this); | ||
| 20 | } | ||
| 21 | |||
| 22 | virtual ~sim() { | ||
| 23 | std::erase(sims, this); | ||
| 24 | } | ||
| 25 | |||
| 26 | static void advance() { | ||
| 27 | for (auto &s : sims) | ||
| 28 | s->clock(); | ||
| 29 | for (auto &s : sims) | ||
| 30 | s->unclock(); | ||
| 31 | ++now; | ||
| 32 | } | ||
| 33 | |||
| 34 | void pte(const transaction &t, const char *event, const std::string &data) { | ||
| 35 | pt::event(t, event, now, data); | ||
| 36 | } | ||
| 37 | }; | ||
| 38 | } | ||
