using ramulator dram simulator

This commit is contained in:
Blaise Tine
2021-12-06 01:22:45 -05:00
parent 59232642c4
commit b741807f8c
33 changed files with 1473 additions and 1344 deletions

View File

@@ -5,8 +5,6 @@ CXXFLAGS += -std=c++11 -O2 -DNDEBUG -Wall -Wextra -pedantic -Wfatal-errors
CXXFLAGS += -I../include -I../common -I../../hw -I$(RTLSIM_DIR) -I$(RTLSIM_DIR)/../common
LDFLAGS += $(RTLSIM_DIR)/librtlsim.a
# Position independent code
CXXFLAGS += -fPIC
@@ -17,6 +15,7 @@ CXXFLAGS += $(CONFIGS)
CXXFLAGS += -DDUMP_PERF_STATS
LDFLAGS += -shared -pthread
LDFLAGS += -L. -lrtlsim
SRCS = vortex.cpp ../common/vx_utils.cpp
@@ -30,9 +29,9 @@ PROJECT = libvortex.so
all: $(PROJECT)
$(PROJECT): $(SRCS)
$(MAKE) -C $(RTLSIM_DIR) static
DESTDIR=../../driver/rtlsim $(MAKE) -C $(RTLSIM_DIR) ../../driver/rtlsim/librtlsim.so
$(CXX) $(CXXFLAGS) $(SRCS) $(LDFLAGS) -o $(PROJECT)
clean:
$(MAKE) -C $(RTLSIM_DIR) clean-static
DESTDIR=../../driver/rtlsim $(MAKE) -C $(RTLSIM_DIR) clean
rm -rf $(PROJECT) *.o

View File

@@ -4,6 +4,7 @@
#include <assert.h>
#include <iostream>
#include <future>
#include <list>
#include <chrono>
#include <vortex.h>
@@ -11,7 +12,7 @@
#include <VX_config.h>
#include <mem.h>
#include <util.h>
#include <simulator.h>
#include <processor.h>
#define RAM_PAGE_SIZE 4096
@@ -60,7 +61,9 @@ public:
vx_device()
: ram_(RAM_PAGE_SIZE)
, mem_allocation_(ALLOC_BASE_ADDR)
{}
{
processor_.attach_ram(&ram_);
}
~vx_device() {
if (future_.valid()) {
@@ -121,12 +124,9 @@ public:
future_.wait();
}
// start new run
simulator_.attach_ram(&ram_);
future_ = std::async(std::launch::async, [&]{
simulator_.reset();
while (simulator_.is_busy()) {
simulator_.step();
}
processor_.reset();
processor_.run();
});
return 0;
}
@@ -149,7 +149,7 @@ public:
private:
RAM ram_;
Simulator simulator_;
Processor processor_;
uint64_t mem_allocation_;
std::future<void> future_;
};