aboutsummaryrefslogtreecommitdiff
path: root/qtmips_machine/machineconfig.h
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2018-01-17 14:47:18 +0100
committerKarel Kočí <cynerd@email.cz>2018-01-17 14:47:18 +0100
commit5feb16d0738f57d220e5f2e6ba85e072c22135ee (patch)
tree73d136af8dba31e004a281c2072521b63a97ae19 /qtmips_machine/machineconfig.h
parentd7d9860051a9a9eb2c6f11684535ac65cce38eb8 (diff)
downloadqtmips-5feb16d0738f57d220e5f2e6ba85e072c22135ee.tar.gz
qtmips-5feb16d0738f57d220e5f2e6ba85e072c22135ee.tar.bz2
qtmips-5feb16d0738f57d220e5f2e6ba85e072c22135ee.zip
Update how configuration is handled in newdialog
In previous implementation were dependencies described on two places. In NewDialog and in MachineConfig. Now NewDialog sets options in MachineConfig and configuration is then applied to NewDialog.
Diffstat (limited to 'qtmips_machine/machineconfig.h')
-rw-r--r--qtmips_machine/machineconfig.h50
1 files changed, 43 insertions, 7 deletions
diff --git a/qtmips_machine/machineconfig.h b/qtmips_machine/machineconfig.h
index 10b8458..90c9b75 100644
--- a/qtmips_machine/machineconfig.h
+++ b/qtmips_machine/machineconfig.h
@@ -2,20 +2,35 @@
#define MACHINECONFIG_H
#include <QString>
+#include <QSettings>
namespace machine {
+enum ConfigPresets {
+ CP_SINGLE,
+ CP_PIPE_WITH_CACHE
+};
+
class MachineConfigCache {
public:
MachineConfigCache();
MachineConfigCache(const MachineConfigCache *cc);
+ MachineConfigCache(const QSettings*, const QString &prefix = "");
- // TODO
+ void store(QSettings*, const QString &prefix = "");
+
+ void preset(enum ConfigPresets);
+
+ // If cache should be used or not
+ void set_enabled(bool);
+
+ bool enabled() const;
bool operator ==(const MachineConfigCache &c) const;
bool operator !=(const MachineConfigCache &c) const;
private:
+ bool en;
// TODO
};
@@ -23,6 +38,11 @@ class MachineConfig {
public:
MachineConfig();
MachineConfig(const MachineConfig *cc);
+ MachineConfig(const QSettings*, const QString &prefix = "");
+
+ void store(QSettings*, const QString &prefix = "");
+
+ void preset(enum ConfigPresets);
enum HazardUnit {
HU_NONE,
@@ -36,29 +56,45 @@ public:
// Configure if cpu should simulate delay slot in non-pipelined core
// In default enabled. When disabled it also automatically disables pipelining.
void set_delay_slot(bool);
+ // Hazard unit
+ void set_hazard_unit(enum HazardUnit);
+ // Protect data memory from execution. Only program sections can be executed.
+ void set_memory_execute_protection(bool);
+ // Protect program memory from accidental writes.
+ void set_memory_write_protection(bool);
+ // Set memory access times. Passed value is in cycles.
+ void set_memory_access_time_read(unsigned);
+ void set_memory_access_time_write(unsigned);
// Set path to source elf file. This has to be set before core is initialized.
void set_elf(QString path);
// Configure cache
void set_cache_program(const MachineConfigCache&);
void set_cache_data(const MachineConfigCache&);
- // Hazard unit
- void set_hazard_unit(enum HazardUnit);
bool pipelined() const;
bool delay_slot() const;
- QString elf() const;
- MachineConfigCache cache_program() const;
- MachineConfigCache cache_data() const;
enum HazardUnit hazard_unit() const;
+ bool memory_execute_protection() const;
+ bool memory_write_protection() const;
+ unsigned memory_access_time_read() const;
+ unsigned memory_access_time_write() const;
+ QString elf() const;
+ const MachineConfigCache &cache_program() const;
+ const MachineConfigCache &cache_data() const;
+
+ MachineConfigCache *access_cache_program();
+ MachineConfigCache *access_cache_data();
bool operator ==(const MachineConfig &c) const;
bool operator !=(const MachineConfig &c) const;
private:
bool pipeline, delayslot;
+ enum HazardUnit hunit;
+ bool exec_protect, write_protect;
+ unsigned mem_acc_read, mem_acc_write;
QString elf_path;
MachineConfigCache cch_program, cch_data;
- enum HazardUnit hunit;
};
}