diff options
Diffstat (limited to 'uarch/core.h')
| -rw-r--r-- | uarch/core.h | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/uarch/core.h b/uarch/core.h index 0f9be74..a6772f3 100644 --- a/uarch/core.h +++ b/uarch/core.h | |||
| @@ -2,11 +2,14 @@ | |||
| 2 | 2 | ||
| 3 | #include <array> | 3 | #include <array> |
| 4 | 4 | ||
| 5 | #include "infra/arbiter.h" | ||
| 5 | #include "infra/pipetrace.h" | 6 | #include "infra/pipetrace.h" |
| 6 | #include "infra/port.h" | 7 | #include "infra/port.h" |
| 7 | #include "io/model.h" | 8 | #include "io/model.h" |
| 8 | #include "isa/checker.h" | 9 | #include "isa/checker.h" |
| 9 | #include "isa/isa.h" | 10 | #include "isa/isa.h" |
| 11 | #include "memory/cache.h" | ||
| 12 | #include "memory/dram.h" | ||
| 10 | 13 | ||
| 11 | struct core; | 14 | struct core; |
| 12 | 15 | ||
| @@ -14,7 +17,7 @@ struct fetch_bundle { | |||
| 14 | infra::transaction tr; | 17 | infra::transaction tr; |
| 15 | unsigned int gen; | 18 | unsigned int gen; |
| 16 | unsigned int pc; | 19 | unsigned int pc; |
| 17 | unsigned int word; | 20 | memory::line data; |
| 18 | }; | 21 | }; |
| 19 | 22 | ||
| 20 | struct fetch_restart { | 23 | struct fetch_restart { |
| @@ -26,9 +29,12 @@ struct fetch_restart { | |||
| 26 | struct fetch_stage : public infra::sim { | 29 | struct fetch_stage : public infra::sim { |
| 27 | core &c; | 30 | core &c; |
| 28 | 31 | ||
| 32 | memory::inline_cache<8, 2> cache; | ||
| 33 | |||
| 29 | unsigned int gen = 0; | 34 | unsigned int gen = 0; |
| 30 | unsigned int pc; | 35 | unsigned int pc; |
| 31 | bool didrestart = false; | 36 | bool didrestart = false; |
| 37 | bool outstandingfill = false; | ||
| 32 | 38 | ||
| 33 | fetch_stage(core &c); | 39 | fetch_stage(core &c); |
| 34 | 40 | ||
| @@ -49,6 +55,7 @@ struct decode_stage : public infra::sim { | |||
| 49 | std::array<uint_fast32_t, NUM_CTLREGS> ctlregs; | 55 | std::array<uint_fast32_t, NUM_CTLREGS> ctlregs; |
| 50 | std::uint64_t icount; | 56 | std::uint64_t icount; |
| 51 | instruction_context inst; | 57 | instruction_context inst; |
| 58 | bool outstandingfill = false; | ||
| 52 | 59 | ||
| 53 | decode_stage(core &c); | 60 | decode_stage(core &c); |
| 54 | 61 | ||
| @@ -58,11 +65,20 @@ struct decode_stage : public infra::sim { | |||
| 58 | struct core { | 65 | struct core { |
| 59 | iomodel &system; | 66 | iomodel &system; |
| 60 | funcchecker checker; | 67 | funcchecker checker; |
| 61 | funcmem mem; | ||
| 62 | 68 | ||
| 69 | memory::dram mem{12}; | ||
| 70 | infra::port<memory::dram::command> mem_commandp; | ||
| 71 | |||
| 72 | infra::priority_arbiter<memory::dram::command, 2> mem_command_arb; | ||
| 73 | |||
| 74 | infra::port<memory::dram::command> fetch_mem_commandp; | ||
| 75 | infra::port<memory::dram::response> fetch_mem_responsep; | ||
| 63 | infra::port<fetch_bundle> fetch_bundlep; | 76 | infra::port<fetch_bundle> fetch_bundlep; |
| 64 | std::optional<fetch_restart> fetch_restarto; | 77 | std::optional<fetch_restart> fetch_restarto; |
| 65 | 78 | ||
| 79 | infra::port<memory::dram::command> decode_mem_commandp; | ||
| 80 | infra::port<memory::dram::response> decode_mem_responsep; | ||
| 81 | |||
| 66 | // Construction order is execution order within a cycle, so this list should be back-to-front (for zero-cycle restarts) | 82 | // Construction order is execution order within a cycle, so this list should be back-to-front (for zero-cycle restarts) |
| 67 | decode_stage decode{*this}; | 83 | decode_stage decode{*this}; |
| 68 | fetch_stage fetch{*this}; | 84 | fetch_stage fetch{*this}; |
| @@ -70,5 +86,10 @@ struct core { | |||
| 70 | core(iomodel &model) | 86 | core(iomodel &model) |
| 71 | : system(model) | 87 | : system(model) |
| 72 | , checker(model) | 88 | , checker(model) |
| 73 | { } | 89 | { |
| 90 | mem.commandp = &mem_commandp; | ||
| 91 | mem_command_arb.outp = &mem_commandp; | ||
| 92 | mem_command_arb.peerp[0] = &decode_mem_commandp; | ||
| 93 | mem_command_arb.peerp[1] = &fetch_mem_commandp; | ||
| 94 | } | ||
| 74 | }; | 95 | }; |
