multicore fix

This commit is contained in:
Blaise Tine
2020-05-10 08:30:04 -04:00
parent 359601cfd3
commit cc84e0691c
40 changed files with 27930 additions and 28148 deletions

View File

@@ -8,8 +8,8 @@ double sc_time_stamp() {
return time_stamp;
}
Simulator::Simulator(RAM *ram) {
ram_ = ram;
Simulator::Simulator() {
ram_ = nullptr;
vortex_ = new VVortex_Socket();
#ifdef VCD_OUTPUT
@@ -27,12 +27,20 @@ Simulator::~Simulator() {
delete vortex_;
}
void Simulator::attach_ram(RAM* ram) {
ram_ = ram;
dram_rsp_vec_.clear();
}
void Simulator::print_stats(std::ostream& out) {
out << std::left;
out << std::setw(24) << "# of total cycles:" << std::dec << time_stamp/2 << std::endl;
}
void Simulator::dbus_driver() {
if (ram_ == nullptr)
return;
// handle DRAM response cycle
int dequeue_index = -1;
for (int i = 0; i < dram_rsp_vec_.size(); i++) {
@@ -149,9 +157,6 @@ bool Simulator::is_busy() {
}
void Simulator::flush_caches(uint32_t mem_addr, uint32_t size) {
// send snoop requests to the caches
printf("[sim] total cycles: %ld\n", time_stamp/2);
// align address to LLC block boundaries
auto aligned_addr_start = mem_addr / GLOBAL_BLOCK_SIZE;
auto aligned_addr_end = (mem_addr + size + GLOBAL_BLOCK_SIZE - 1) / GLOBAL_BLOCK_SIZE;

View File

@@ -29,7 +29,7 @@ typedef struct {
class Simulator {
public:
Simulator(RAM *ram);
Simulator();
virtual ~Simulator();
bool is_busy();
@@ -37,6 +37,9 @@ public:
void step();
void wait(uint32_t cycles);
void flush_caches(uint32_t mem_addr, uint32_t size);
void attach_ram(RAM* ram);
bool run();
void print_stats(std::ostream& out);

View File

@@ -71,7 +71,8 @@ int main(int argc, char **argv)
RAM ram;
loadHexImpl(s.c_str(), &ram);
Simulator simulator(&ram);
Simulator simulator;
simulator.attach_ram(&ram);
bool curr = simulator.run();
if (curr) std::cerr << GREEN << "Test Passed: " << s << std::endl;
@@ -106,7 +107,8 @@ int main(int argc, char **argv)
RAM ram;
loadHexImpl(testing, &ram);
Simulator simulator(&ram);
Simulator simulator;
simulator.attach_ram(&ram);
bool curr = simulator.run();
if (curr) std::cerr << GREEN << "Test Passed: " << testing << std::endl;