aboutsummaryrefslogtreecommitdiff
path: root/qtmips_machine/machineconfig.cpp
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2018-01-15 13:13:56 +0100
committerKarel Kočí <cynerd@email.cz>2018-01-15 13:13:56 +0100
commit5241e1d9733ea69a91d3f497bc794ce881ad49fd (patch)
treeed941cd505a82f81f9b39004a70087c5b900dc06 /qtmips_machine/machineconfig.cpp
parent4dc4726c80bab8192abfb2d881a69ef9f490754f (diff)
downloadqtmips-5241e1d9733ea69a91d3f497bc794ce881ad49fd.tar.gz
qtmips-5241e1d9733ea69a91d3f497bc794ce881ad49fd.tar.bz2
qtmips-5241e1d9733ea69a91d3f497bc794ce881ad49fd.zip
Change how we configure cache and configure hazard unit
Diffstat (limited to 'qtmips_machine/machineconfig.cpp')
-rw-r--r--qtmips_machine/machineconfig.cpp71
1 files changed, 60 insertions, 11 deletions
diff --git a/qtmips_machine/machineconfig.cpp b/qtmips_machine/machineconfig.cpp
index cf8629c..e479d66 100644
--- a/qtmips_machine/machineconfig.cpp
+++ b/qtmips_machine/machineconfig.cpp
@@ -2,18 +2,36 @@
using namespace machine;
+MachineConfigCache::MachineConfigCache() {
+ // TODO
+}
+
+MachineConfigCache::MachineConfigCache(const MachineConfigCache *cc) {
+ // TODO
+}
+
+bool MachineConfigCache::operator==(const MachineConfigCache &c) const {
+ // TODO
+ return true;
+}
+
+bool MachineConfigCache::operator!=(const MachineConfigCache &c) const {
+ return !operator==(c);
+}
+
MachineConfig::MachineConfig() {
pipeline = false;
delayslot = true;
- cache_type = CCT_NONE;
- elf_path = QString("");
+ hunit = HU_STALL_FORWARD;
}
MachineConfig::MachineConfig(const MachineConfig *cc) {
pipeline = cc->pipelined();
delayslot = cc->delay_slot();
- cache_type = cc->cache();
elf_path = cc->elf();
+ cch_program = cc->cache_program();
+ cch_data = cc->cache_data();
+ hunit = cc->hazard_unit();
}
void MachineConfig::set_pipelined(bool v) {
@@ -26,14 +44,22 @@ void MachineConfig::set_delay_slot(bool v) {
pipeline = false;
}
-void MachineConfig::set_cache(enum CacheType cc) {
- cache_type = cc;
-}
-
void MachineConfig::set_elf(QString path) {
elf_path = path;
}
+void MachineConfig::set_cache_program(const MachineConfigCache &c) {
+ cch_program = c;
+}
+
+void MachineConfig::set_cache_data(const MachineConfigCache &c) {
+ cch_data = c;
+}
+
+void MachineConfig::set_hazard_unit(enum MachineConfig::HazardUnit hu) {
+ hunit = hu;
+}
+
bool MachineConfig::pipelined() const {
return pipeline;
}
@@ -42,10 +68,33 @@ bool MachineConfig::delay_slot() const {
return delayslot;
}
-enum MachineConfig::CacheType MachineConfig::cache() const {
- return cache_type;
-}
-
QString MachineConfig::elf() const {
return elf_path;
}
+
+MachineConfigCache MachineConfig::cache_program() const {
+ return cch_program;
+}
+
+MachineConfigCache MachineConfig::cache_data() const {
+ return cch_data;
+}
+
+enum MachineConfig::HazardUnit MachineConfig::hazard_unit() const {
+ return hunit;
+}
+
+bool MachineConfig::operator==(const MachineConfig &c) const {
+#define CMP(GETTER) (GETTER)() == (c.GETTER)()
+ return CMP(pipelined) && \
+ CMP(delay_slot) && \
+ CMP(elf) && \
+ CMP(cache_program) && \
+ CMP(cache_data) && \
+ CMP(hazard_unit);
+#undef CMP
+}
+
+bool MachineConfig::operator!=(const MachineConfig &c) const {
+ return !operator==(c);
+}