|
|
|
@ -501,7 +501,7 @@ static void cpu_execute(rv32_cpu_t* cpu, instruction_t* instruction) |
|
|
|
|
case OPCODE_NOP: |
|
|
|
|
{ |
|
|
|
|
// TODO : Implement PAUSE, FENCE, FENCE.TSO
|
|
|
|
|
fprintf(stderr, "Warning: Unsupported NOP instruction\n"); |
|
|
|
|
// fprintf(stderr, "Warning: Unsupported NOP instruction\n");
|
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
case OPCODE_SYSTEM: |
|
|
|
@ -602,14 +602,14 @@ static void cpu_execute(rv32_cpu_t* cpu, instruction_t* instruction) |
|
|
|
|
// Load-Reserved Word
|
|
|
|
|
cpu->regs.x[instruction->rd] = mem_read32(address); |
|
|
|
|
// TODO register reservation set that subsumes the bytes in word
|
|
|
|
|
fprintf(stderr, "LR.W\n"); |
|
|
|
|
// fprintf(stderr, "LR.W\n");
|
|
|
|
|
break; |
|
|
|
|
case FUNC75_SCW: |
|
|
|
|
// Store-Conditional Word
|
|
|
|
|
// TODO succeed only if the reservation is still valid and the reservation set contains the bytes written
|
|
|
|
|
mem_write32(address, cpu->regs.x[instruction->rs2]); |
|
|
|
|
cpu->regs.x[instruction->rd] = 0; // TODO write 1 in rd on failure
|
|
|
|
|
fprintf(stderr, "SC.W\n"); |
|
|
|
|
// fprintf(stderr, "SC.W\n");
|
|
|
|
|
break; |
|
|
|
|
case FUNC75_AMOSWAPW: |
|
|
|
|
// Atomic Memory Operation SWAP Word
|
|
|
|
@ -681,7 +681,7 @@ static void cpu_execute(rv32_cpu_t* cpu, instruction_t* instruction) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void cpu_loop(rv32_cpu_t* cpu) |
|
|
|
|
__attribute__((noreturn)) void cpu_loop(rv32_cpu_t* cpu) |
|
|
|
|
{ |
|
|
|
|
while(1) |
|
|
|
|
{ |
|
|
|
|