blob: 0f9be747a97db09f9b8eb22cac01bc9535a4cd07 (
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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
#pragma once
#include <array>
#include "infra/pipetrace.h"
#include "infra/port.h"
#include "io/model.h"
#include "isa/checker.h"
#include "isa/isa.h"
struct core;
struct fetch_bundle {
infra::transaction tr;
unsigned int gen;
unsigned int pc;
unsigned int word;
};
struct fetch_restart {
infra::transaction tr;
unsigned int new_gen;
unsigned int new_pc;
};
struct fetch_stage : public infra::sim {
core &c;
unsigned int gen = 0;
unsigned int pc;
bool didrestart = false;
fetch_stage(core &c);
void clock();
};
struct decode_stage : public infra::sim {
core &c;
unsigned int gen = 0;
bool interrupt = false;
unsigned int acc;
unsigned int link;
unsigned int mq;
unsigned int pc;
std::array<uint_fast32_t, NUM_CTLREGS> ctlregs;
std::uint64_t icount;
instruction_context inst;
decode_stage(core &c);
void clock();
};
struct core {
iomodel &system;
funcchecker checker;
funcmem mem;
infra::port<fetch_bundle> fetch_bundlep;
std::optional<fetch_restart> fetch_restarto;
// Construction order is execution order within a cycle, so this list should be back-to-front (for zero-cycle restarts)
decode_stage decode{*this};
fetch_stage fetch{*this};
core(iomodel &model)
: system(model)
, checker(model)
{ }
};
|