Attention une mise à jour du serveur va être effectuée le lundi 17 mai entre 13h et 13h30. Cette mise à jour va générer une interruption du service de quelques minutes.

Commit d0953684 authored by ROKICKI Simon's avatar ROKICKI Simon

Clean out the memory interfaces

parent a449d6c4
......@@ -8,19 +8,19 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -std=c++11 -D__CATAPULT__ -O3 -DMEMOR
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ./bin)
add_executable(comet.sim
add_executable(comet.sim
./src/core.cpp
./src/elfFile.cpp
./src/main.cpp
./src/simpleMemory.cpp
./src/riscvISA.cpp
./src/basic_simulator.cpp)
./src/basic_simulator.cpp
./src/memoryInterface.cpp)
add_executable(atomicTests
./src/core.cpp
./src/atomicTest.cpp
./src/elfFile.cpp
./src/simpleMemory.cpp
./src/riscvISA.cpp)
./src/riscvISA.cpp
./src/memoryInterface.cpp)
#target_link_libraries( comet.sim LINK_PUBLIC ${Boost_LIBRARIES} )
......@@ -8,10 +8,9 @@
#ifndef INCLUDE_CACHEMEMORY_H_
#define INCLUDE_CACHEMEMORY_H_
#include "memory.h"
#include "memoryInterface.h"
#include <ac_int.h>
#include <incompleteMemory.h>
#include <memory.h>
#include <memoryInterface.h>
#define LINE_SIZE 16
#define LOG_LINE_SIZE 4
......
......@@ -6,9 +6,8 @@
// all the possible memories
#include <cacheMemory.h>
#include <incompleteMemory.h>
#include <memoryInterface.h>
#include <pipelineRegisters.h>
#include <simpleMemory.h>
#ifndef MEMORY_INTERFACE
#define MEMORY_INTERFACE SimpleMemory
......
#ifndef __INCOMPLETE_MEMORY_H__
#define __INCOMPLETE_MEMORY_H__
#include "memory.h"
#include "memoryInterface.h"
class IncompleteMemory : public MemoryInterface {
public:
ac_int<32, false>* data;
public:
IncompleteMemory(ac_int<32, false>* arg) { data = arg; }
void process(ac_int<32, false> addr, memMask mask, memOpType opType, ac_int<32, false> dataIn,
ac_int<32, false>& dataOut, bool& waitOut)
{
// no latency, wait is always set to false
waitOut = false;
if (opType == STORE) {
data[addr >> 2] = dataIn;
} else if (opType == LOAD) {
dataOut = data[addr >> 2];
}
}
};
#endif //__INCOMPLETE_MEMORY_H__
......@@ -16,4 +16,24 @@ public:
ac_int<32, false>& dataOut, bool& waitOut) = 0;
};
class IncompleteMemory : public MemoryInterface {
public:
ac_int<32, false>* data;
public:
IncompleteMemory(ac_int<32, false>* arg) { data = arg; }
void process(ac_int<32, false> addr, memMask mask, memOpType opType, ac_int<32, false> dataIn,
ac_int<32, false>& dataOut, bool& waitOut);
};
class SimpleMemory : public MemoryInterface {
public:
ac_int<32, false>* data;
SimpleMemory(ac_int<32, false>* arg) { data = arg; }
void process(ac_int<32, false> addr, memMask mask, memOpType opType, ac_int<32, false> dataIn,
ac_int<32, false>& dataOut, bool& waitOut);
};
#endif //__MEMORY_INTERFACE_H__
#ifndef __SIMPLE_MEMORY_H__
#define __SIMPLE_MEMORY_H__
#include "memory.h"
#include "memoryInterface.h"
class SimpleMemory : public MemoryInterface {
public:
ac_int<32, false>* data;
SimpleMemory(ac_int<32, false>* arg) { data = arg; }
void process(ac_int<32, false> addr, memMask mask, memOpType opType, ac_int<32, false> dataIn,
ac_int<32, false>& dataOut, bool& waitOut);
};
#endif //__SIMPLE_MEMORY_H__
#include "simpleMemory.h"
/*
void SimpleMemory::setByte(ac_int<32, false> addr, ac_int<8, false> data) {
data[addr>>2].set_slc(addr.slc<2>(0) << 3, data);
}
ac_int<8, false> SimpleMemory::getByte(ac_int<32, false> addr) {
return data[addr>>2].slc<8>(0);
}
#include <memoryInterface.h>
void SimpleMemory::setWord(ac_int<32, false> addr, ac_int<32, false> data) {
data[addr>>2] = data;
void IncompleteMemory::process(ac_int<32, false> addr, memMask mask, memOpType opType, ac_int<32, false> dataIn,
ac_int<32, false>& dataOut, bool& waitOut)
{
// no latency, wait is always set to false
waitOut = false;
if (opType == STORE) {
data[addr >> 2] = dataIn;
} else if (opType == LOAD) {
dataOut = data[addr >> 2];
}
}
ac_int<32, false> SimpleMemory::getWord(ac_int<32, false> addr) {
return data[addr>>2];
}
*/
void SimpleMemory::process(ac_int<32, false> addr, memMask mask, memOpType opType, ac_int<32, false> dataIn,
ac_int<32, false>& dataOut, bool& waitOut)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment