From ff66523bb076a246c2fc159f0f76947bd6f84fc1 Mon Sep 17 00:00:00 2001 From: Julian Blake Kongslie Date: Sat, 29 Oct 2022 12:55:08 -0700 Subject: Control register values should not be "unsigned int" --- io/event.h | 7 ++++--- io/model.cpp | 2 +- io/model.h | 5 ++++- 3 files changed, 9 insertions(+), 5 deletions(-) (limited to 'io') diff --git a/io/event.h b/io/event.h index 02f3fab..2da3323 100644 --- a/io/event.h +++ b/io/event.h @@ -1,14 +1,15 @@ #pragma once +#include #include #include "isa/isa.h" struct event { ctlreg reg; - unsigned int mask; - unsigned int value; - event(ctlreg reg, unsigned int value, unsigned int mask=~0) + std::uint_fast32_t mask; + std::uint_fast32_t value; + event(ctlreg reg, std::uint_fast32_t value, std::uint_fast32_t mask=~0) : reg(reg) , mask(mask) , 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 @@ #include "io/model.h" #include "isa/isa.h" -bool iomodel::interact(std::array &ctlregs) { +bool iomodel::interact(std::array &ctlregs) { auto [ebegin, eend] = log.equal_range(time); for (auto e = ebegin; e != eend; ++e) { auto &r = ctlregs[e->second.reg]; diff --git a/io/model.h b/io/model.h index c7199ea..8758a43 100644 --- a/io/model.h +++ b/io/model.h @@ -2,6 +2,7 @@ #include #include +#include #include "io/event.h" #include "isa/isa.h" @@ -11,5 +12,7 @@ struct iomodel { event_log log; std::uint64_t time = 0; - bool interact(std::array &ctlregs); + bool interact(std::array &ctlregs); + + void load_evt(std::istream &fh); }; -- cgit v1.2.3