summaryrefslogtreecommitdiff
path: root/io/model.h
blob: 16e7ca79006d90de7c3023098eec73ed9a8d4bf1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#pragma once

#include <array>
#include <cstdint>
#include <istream>
#include <ostream>

#include "io/event.h"
#include "isa/isa.h"

struct iomodel {
    static constexpr unsigned int TT_OUTPUT_DELAY = 10;

    event_log log;
    bool interact(std::uint64_t icount, std::array<std::uint_fast32_t, NUM_CTLREGS> &ctlregs, bool replay=false);
    bool done(std::uint64_t icount) {
        return log.lower_bound(icount) == log.end();
    }

    std::uint64_t load_icount = 0;
    void load_evt(std::istream &fh);

    std::ostream & write_evt(std::ostream &fh);
};