Closed maltevonehren closed 2 years ago
Hello, I have noticed that a memory access placed inside of an if statement does not generate code for actually reading the memory.
A small example: This behavior describtion generates the following code:
behavior: { if ((signed<32>)MEM[0] > 0) X[1] = 1; }
partInit.code() += "cpu->instructionPointer = " + std::to_string(ic.current_address_ + 4U) + ";\n"; partInit.code() += "if ((etiss_int32)(mem_val_0) > 0U) {\n"; partInit.code() += "*((RV32IMACFD*)cpu)->X[" + std::to_string(1U) + "] = 1U;\n"; partInit.code() += "}\n";
Where I would have expected it to generate the code below or throw an error.
partInit.code() += "cpu->instructionPointer = " + std::to_string(ic.current_address_ + 4U) + ";\n"; partInit.code() += "etiss_uint32 mem_val_0;\n"; partInit.code() += "exception |= (*(system->dread))(system->handle, cpu, " + std::to_string(0U) + ", (etiss_uint8*)&mem_val_0, 4);\n"; partInit.code() += "if ((etiss_int32)(mem_val_0) > 0U) {\n"; partInit.code() += "*((RV32IMACFD*)cpu)->X[" + std::to_string(1U) + "] = 1U;\n"; partInit.code() += "}\n";
Thanks
Should be fixed in https://github.com/tum-ei-eda/M2-ISA-R/commit/7d6cdf8ce624504f40923e9e1532e1afa61273c6, please test and verify.
Works fine now. Thanks!
Hello, I have noticed that a memory access placed inside of an if statement does not generate code for actually reading the memory.
A small example: This behavior describtion generates the following code:
Where I would have expected it to generate the code below or throw an error.
Thanks