diff options
Diffstat (limited to '')
| -rw-r--r-- | io/event.h | 7 | ||||
| -rw-r--r-- | io/model.cpp | 2 | ||||
| -rw-r--r-- | io/model.h | 5 |
3 files changed, 9 insertions, 5 deletions
| @@ -1,14 +1,15 @@ | |||
| 1 | #pragma once | 1 | #pragma once |
| 2 | 2 | ||
| 3 | #include <cstdint> | ||
| 3 | #include <map> | 4 | #include <map> |
| 4 | 5 | ||
| 5 | #include "isa/isa.h" | 6 | #include "isa/isa.h" |
| 6 | 7 | ||
| 7 | struct event { | 8 | struct event { |
| 8 | ctlreg reg; | 9 | ctlreg reg; |
| 9 | unsigned int mask; | 10 | std::uint_fast32_t mask; |
| 10 | unsigned int value; | 11 | std::uint_fast32_t value; |
| 11 | event(ctlreg reg, unsigned int value, unsigned int mask=~0) | 12 | event(ctlreg reg, std::uint_fast32_t value, std::uint_fast32_t mask=~0) |
| 12 | : reg(reg) | 13 | : reg(reg) |
| 13 | , mask(mask) | 14 | , mask(mask) |
| 14 | , value(value) | 15 | , value(value) |
diff --git a/io/model.cpp b/io/model.cpp index d6e36f9..4b37be4 100644 --- a/io/model.cpp +++ b/io/model.cpp | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | #include "io/model.h" | 6 | #include "io/model.h" |
| 7 | #include "isa/isa.h" | 7 | #include "isa/isa.h" |
| 8 | 8 | ||
| 9 | bool iomodel::interact(std::array<unsigned int, NUM_CTLREGS> &ctlregs) { | 9 | bool iomodel::interact(std::array<std::uint_fast32_t, NUM_CTLREGS> &ctlregs) { |
| 10 | auto [ebegin, eend] = log.equal_range(time); | 10 | auto [ebegin, eend] = log.equal_range(time); |
| 11 | for (auto e = ebegin; e != eend; ++e) { | 11 | for (auto e = ebegin; e != eend; ++e) { |
| 12 | auto &r = ctlregs[e->second.reg]; | 12 | auto &r = ctlregs[e->second.reg]; |
| @@ -2,6 +2,7 @@ | |||
| 2 | 2 | ||
| 3 | #include <array> | 3 | #include <array> |
| 4 | #include <cstdint> | 4 | #include <cstdint> |
| 5 | #include <istream> | ||
| 5 | 6 | ||
| 6 | #include "io/event.h" | 7 | #include "io/event.h" |
| 7 | #include "isa/isa.h" | 8 | #include "isa/isa.h" |
| @@ -11,5 +12,7 @@ struct iomodel { | |||
| 11 | 12 | ||
| 12 | event_log log; | 13 | event_log log; |
| 13 | std::uint64_t time = 0; | 14 | std::uint64_t time = 0; |
| 14 | bool interact(std::array<unsigned int, NUM_CTLREGS> &ctlregs); | 15 | bool interact(std::array<std::uint_fast32_t, NUM_CTLREGS> &ctlregs); |
| 16 | |||
| 17 | void load_evt(std::istream &fh); | ||
| 15 | }; | 18 | }; |
