do processorReset() when changing cache configuration variables
MODIFY
src/cachesim/cachesim.cpp
src/cachesim/cachesim.cpp
@@ -513,15 +513,30 @@ void CacheSim::processorReset() {
void CacheSim::setBlocks(unsigned blocks) {
m_blocks = blocks;
- updateConfiguration();
+ processorReset();
}
void CacheSim::setLines(unsigned lines) {
m_lines = lines;
- updateConfiguration();
+ processorReset();
}
void CacheSim::setWays(unsigned ways) {
m_ways = ways;
- updateConfiguration();
+ processorReset();
+}
+
+void CacheSim::setWritePolicy(WritePolicy policy) {
+ m_wrPolicy = policy;
+ processorReset();
+}
+
+void CacheSim::setWriteAllocatePolicy(WriteAllocPolicy policy) {
+ m_wrAllocPolicy = policy;
+ processorReset();
+}
+
+void CacheSim::setReplacementPolicy(ReplPolicy policy) {
+ m_replPolicy = policy;
+ processorReset();
}
void CacheSim::setPreset(const CachePreset& preset) {

MODIFY
src/cachesim/cachesim.h
src/cachesim/cachesim.h
@@ -94,21 +94,9 @@ public:
CacheSim(QObject* parent);
void setType(CacheType type);
-
- void setWritePolicy(WritePolicy policy) {
- m_wrPolicy = policy;
- updateConfiguration();
- }
-
- void setWriteAllocatePolicy(WriteAllocPolicy policy) {
- m_wrAllocPolicy = policy;
- updateConfiguration();
- }
-
- void setReplacementPolicy(ReplPolicy policy) {
- m_replPolicy = policy;
- updateConfiguration();
- }
+ void setWritePolicy(WritePolicy policy);
+ void setWriteAllocatePolicy(WriteAllocPolicy policy);
+ void setReplacementPolicy(ReplPolicy policy);
void access(uint32_t address, AccessType type);
void undo();

do processorReset() when changing cache configuration variables