diff options
| author | Julian Blake Kongslie | 2022-10-29 12:55:08 -0700 |
|---|---|---|
| committer | Julian Blake Kongslie | 2022-10-29 13:14:13 -0700 |
| commit | ff66523bb076a246c2fc159f0f76947bd6f84fc1 (patch) | |
| tree | 63dbffc8be3c41eb5ec2f74dd7919f5f34a25a53 /io | |
| parent | Add untested interrupt-based echo program with input buffer (diff) | |
| download | biggolf-ff66523bb076a246c2fc159f0f76947bd6f84fc1.tar.xz | |
Control register values should not be "unsigned int"
Diffstat (limited to 'io')
| -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 | }; |
