floating point support fixes

This commit is contained in:
Blaise Tine
2020-07-27 16:01:56 -04:00
parent ff12393998
commit e0a9089647
23 changed files with 408 additions and 330 deletions

View File

@@ -237,7 +237,7 @@ void Simulator::flush_caches(uint32_t mem_addr, uint32_t size) {
#endif
}
bool Simulator::run() {
void Simulator::run() {
#ifndef NDEBUG
std::cout << timestamp << ": [sim] run()" << std::endl;
#endif
@@ -252,20 +252,18 @@ bool Simulator::run() {
}
// wait 5 cycles to flush the pipeline
this->wait(5);
this->wait(5);
}
int Simulator::get_status(int reg) {
// check riscv-tests PASSED/FAILED status
#if (NUM_CLUSTERS == 1 && NUM_CORES == 1)
int status = (int)vortex_->Vortex->genblk1__DOT__cluster->genblk1__BRA__0__KET____DOT__core->pipeline->commit->writeback->last_data_wb & 0xf;
#else
#if (NUM_CLUSTERS == 1)
int status = (int)vortex_->Vortex->genblk1__DOT__cluster->genblk1__BRA__0__KET____DOT__core->pipeline->commit->writeback->last_data_wb & 0xf;
#else
int status = (int)vortex_->Vortex->genblk2__DOT__genblk1__BRA__0__KET____DOT__cluster->genblk1__BRA__0__KET____DOT__core->pipeline->commit->writeback->last_data_wb & 0xf;
#endif
#endif
return (status == 1);
#if (NUM_CLUSTERS == 1 && NUM_CORES == 1)
return (int)vortex_->Vortex->genblk1__DOT__cluster->genblk1__BRA__0__KET____DOT__core->pipeline->commit->writeback->last_data_wb[reg];
#elif (NUM_CLUSTERS == 1)
return (int)vortex_->Vortex->genblk1__DOT__cluster->genblk1__BRA__0__KET____DOT__core->pipeline->commit->writeback->last_data_wb[reg];
#else
return (int)vortex_->Vortex->genblk2__DOT__genblk1__BRA__0__KET____DOT__cluster->genblk1__BRA__0__KET____DOT__core->pipeline->commit->writeback->last_data_wb[reg];
#endif
}
void Simulator::load_bin(const char* program_file) {

View File

@@ -43,7 +43,8 @@ public:
void attach_ram(RAM* ram);
bool run();
void run();
int get_status(int reg);
void print_stats(std::ostream& out);
private:

View File

@@ -9,9 +9,8 @@ int main(int argc, char **argv)
#ifdef ALL_TESTS
bool passed = true;
std::string tests[] = {
"../../../benchmarks/riscv_tests/rv32uf-p-fadd.hex",
/*"../../../benchmarks/riscv_tests/rv32ui-p-add.hex",
std::string tests[] = {/*
"../../../benchmarks/riscv_tests/rv32ui-p-add.hex",
"../../../benchmarks/riscv_tests/rv32ui-p-addi.hex",
"../../../benchmarks/riscv_tests/rv32ui-p-and.hex",
"../../../benchmarks/riscv_tests/rv32ui-p-andi.hex",
@@ -58,20 +57,23 @@ int main(int argc, char **argv)
"../../../benchmarks/riscv_tests/rv32um-p-mulhu.hex",
"../../../benchmarks/riscv_tests/rv32um-p-rem.hex",
"../../../benchmarks/riscv_tests/rv32um-p-remu.hex",
#endif
#endif*/
};
std::string tests_fp[] = {
#ifdef EXT_F_ENABLE
"../../../benchmarks/riscv_tests/rv32uf-p-fadd.hex",
"../../../benchmarks/riscv_tests/rv32uf-p-fdiv.hex",
"../../../benchmarks/riscv_tests/rv32uf-p-fmadd.hex"
"../../../benchmarks/riscv_tests/rv32uf-p-fmin.hex",
"../../../benchmarks/riscv_tests/rv32uf-p-fcmp.hex",
//"../../../benchmarks/riscv_tests/rv32uf-p-fadd.hex",
//"../../../benchmarks/riscv_tests/rv32uf-p-fdiv.hex",
//"../../../benchmarks/riscv_tests/rv32uf-p-fmadd.hex",
//"../../../benchmarks/riscv_tests/rv32uf-p-fmin.hex",
//"../../../benchmarks/riscv_tests/rv32uf-p-fcmp.hex",
"../../../benchmarks/riscv_tests/rv32uf-p-fclass.hex",
"../../../benchmarks/riscv_tests/rv32uf-p-ldst.hex",
"../../../benchmarks/riscv_tests/rv32uf-p-fcvt.hex",
"../../../benchmarks/riscv_tests/rv32uf-p-fcvt_w.hex",
"../../../benchmarks/riscv_tests/rv32uf-p-move.hex",
"../../../benchmarks/riscv_tests/rv32uf-p-recoding.hex",
#endif*/
#endif
};
for (std::string test : tests) {
@@ -83,7 +85,30 @@ int main(int argc, char **argv)
Simulator simulator;
simulator.attach_ram(&ram);
simulator.load_ihex(test.c_str());
bool status = simulator.run();
simulator.run();
bool status = (1 == simulator.get_status(28));
if (status) std::cerr << GREEN << "Test Passed: " << test << std::endl;
if (!status) std::cerr << RED << "Test Failed: " << test << std::endl;
std::cerr << DEFAULT;
passed = passed && status;
if (!passed)
break;
}
for (std::string test : tests_fp) {
std::cerr << DEFAULT << "\n---------------------------------------\n";
std::cerr << test << std::endl;
RAM ram;
Simulator simulator;
simulator.attach_ram(&ram);
simulator.load_ihex(test.c_str());
simulator.run();
bool status = (1 == simulator.get_status(3));
if (status) std::cerr << GREEN << "Test Passed: " << test << std::endl;
if (!status) std::cerr << RED << "Test Failed: " << test << std::endl;
@@ -113,7 +138,9 @@ int main(int argc, char **argv)
Simulator simulator;
simulator.attach_ram(&ram);
simulator.load_ihex(test);
bool status = simulator.run();
simulator.run();
bool status = (1 == simulator.get_status(28));
if (status) std::cerr << GREEN << "Test Passed: " << test << std::endl;
if (!status) std::cerr << RED << "Test Failed: " << test << std::endl;