diff options
author | Karel Kočí <cynerd@email.cz> | 2018-03-06 21:57:07 +0100 |
---|---|---|
committer | Karel Kočí <cynerd@email.cz> | 2018-03-06 21:57:07 +0100 |
commit | a56b25212865c57251719a1d4a5d9d6a79b339c5 (patch) | |
tree | 5e5412c14a407b19a7e3a245cc39cb4fc80b6ec4 /qtmips_machine/machineconfig.h | |
parent | c75024c81ba92efbcc70e80520599a27b4aff0d8 (diff) | |
download | qtmips-a56b25212865c57251719a1d4a5d9d6a79b339c5.tar.gz qtmips-a56b25212865c57251719a1d4a5d9d6a79b339c5.tar.bz2 qtmips-a56b25212865c57251719a1d4a5d9d6a79b339c5.zip |
Implement Cache configuration
This commit implements both cache configuration for machine and for gui.
Diffstat (limited to 'qtmips_machine/machineconfig.h')
-rw-r--r-- | qtmips_machine/machineconfig.h | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/qtmips_machine/machineconfig.h b/qtmips_machine/machineconfig.h index 90c9b75..a713a4c 100644 --- a/qtmips_machine/machineconfig.h +++ b/qtmips_machine/machineconfig.h @@ -7,8 +7,10 @@ namespace machine { enum ConfigPresets { - CP_SINGLE, - CP_PIPE_WITH_CACHE + CP_SINGLE, // No pipeline cpu without cache + CP_PIPE_NO_HAZARD, // Pipelined cpu without hazard unit + CP_PIPE_NO_CACHE, // Pipelined cpu without cache + CP_PIPE_CACHE // Full pipelined cpu }; class MachineConfigCache { @@ -21,17 +23,41 @@ public: void preset(enum ConfigPresets); + enum ReplacementPolicy { + RP_RAND, // Random + RP_LRU, // Least recently used + RP_LFU, // Least frequently used + RP_ARC // Adaptive replacement cache + }; + + enum WritePolicy { + WP_TROUGH, // Write trough + WP_BACK // Write back + }; + // If cache should be used or not void set_enabled(bool); + void set_sets(unsigned); // Number of sets bits used in cache + void set_blocks(unsigned); // Number of blocks + void set_associativity(unsigned); // Degree of associativity + void set_replacement_policy(enum ReplacementPolicy); + void set_write_policy(enum WritePolicy); bool enabled() const; + unsigned sets() const; + unsigned blocks() const; + unsigned associativity() const; + enum ReplacementPolicy replacement_policy() const; + enum WritePolicy write_policy() const; bool operator ==(const MachineConfigCache &c) const; bool operator !=(const MachineConfigCache &c) const; private: bool en; - // TODO + unsigned n_sets, n_blocks, d_associativity; + enum ReplacementPolicy replac_pol; + enum WritePolicy write_pol; }; class MachineConfig { |