fix aluipc
This commit is contained in:
@@ -94,7 +94,7 @@ int main(int argc, char** argv){
|
|||||||
}
|
}
|
||||||
|
|
||||||
tinyriscv_hart hart;
|
tinyriscv_hart hart;
|
||||||
hart.mem = malloc(hart.mem_size = mem_size);
|
hart.mem = calloc(hart.mem_size = mem_size, 1);
|
||||||
|
|
||||||
//file handling
|
//file handling
|
||||||
FILE* file = fopen(file_path, "rb");
|
FILE* file = fopen(file_path, "rb");
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ void tinyriscv_step(tinyriscv_hart* hart){
|
|||||||
|
|
||||||
switch(opcode){
|
switch(opcode){
|
||||||
case /*LUI*/ 0x37: hart->x[rd] = inst & 0xfffff000; break;
|
case /*LUI*/ 0x37: hart->x[rd] = inst & 0xfffff000; break;
|
||||||
case /*AUIPC*/ 0x17: hart->x[rd] = hart->pc + (inst & 0xfffff000); break;
|
case /*AUIPC*/ 0x17: hart->x[rd] = hart->pc - 4 + (inst & 0xfffff000); break;
|
||||||
case /*JAL*/ 0x6f: hart->x[rd] = hart->pc; hart->pc += imm_j - 4; break;
|
case /*JAL*/ 0x6f: hart->x[rd] = hart->pc; hart->pc += imm_j - 4; break;
|
||||||
case /*JALR*/ 0x67:
|
case /*JALR*/ 0x67:
|
||||||
const u32 last_pc = hart->pc;
|
const u32 last_pc = hart->pc;
|
||||||
|
|||||||
BIN
tests/test.bin
BIN
tests/test.bin
Binary file not shown.
Reference in New Issue
Block a user