diff options
| -rw-r--r-- | io/model.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/io/model.cpp b/io/model.cpp index a05c719..d332908 100644 --- a/io/model.cpp +++ b/io/model.cpp | |||
| @@ -8,20 +8,20 @@ | |||
| 8 | #include "io/model.h" | 8 | #include "io/model.h" |
| 9 | #include "isa/isa.h" | 9 | #include "isa/isa.h" |
| 10 | 10 | ||
| 11 | bool iomodel::interact(std::array<std::uint_fast32_t, NUM_CTLREGS> &ctlregs) { | 11 | bool iomodel::interact(std::uint64_t icount, std::array<std::uint_fast32_t, NUM_CTLREGS> &ctlregs, bool replay) { |
| 12 | auto [ebegin, eend] = log.equal_range(time); | 12 | auto [ebegin, eend] = log.equal_range(icount); |
| 13 | for (auto e = ebegin; e != eend; ++e) { | 13 | for (auto e = ebegin; e != eend; ++e) { |
| 14 | auto &r = ctlregs[e->second.reg]; | 14 | auto &r = ctlregs[e->second.reg]; |
| 15 | r &= ~e->second.mask; | 15 | r &= ~e->second.mask; |
| 16 | r |= e->second.value; | 16 | r |= e->second.value; |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | ++time; | ||
| 20 | |||
| 21 | if (ctlregs[TT_BITS] & TTO_TX) { | 19 | if (ctlregs[TT_BITS] & TTO_TX) { |
| 22 | std::cout << (char)(((ctlregs[TT_BITS] & TTO_DATA) >> TTO_DATA_SHIFT) & 0x7f) << std::flush; | 20 | if (!replay) { |
| 21 | std::cout << (char)(((ctlregs[TT_BITS] & TTO_DATA) >> TTO_DATA_SHIFT) & 0x7f) << std::flush; | ||
| 22 | log.emplace(icount + TT_OUTPUT_DELAY + 1, event(TT_BITS, TTO_FLAG, 0)); | ||
| 23 | } | ||
| 23 | ctlregs[TT_BITS] &= ~TTO_TX & ~TTO_DATA; | 24 | ctlregs[TT_BITS] &= ~TTO_TX & ~TTO_DATA; |
| 24 | log.emplace(time + TT_OUTPUT_DELAY, event(TT_BITS, TTO_FLAG, 0)); | ||
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | bool interrupt = false; | 27 | bool interrupt = false; |
