summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--instruction.c7
-rw-r--r--instruction.h3
2 files changed, 5 insertions, 5 deletions
diff --git a/instruction.c b/instruction.c
index 4bd216b..133470d 100644
--- a/instruction.c
+++ b/instruction.c
@@ -34,7 +34,7 @@ static int unimplemented(struct nios2 *cpu, uint32_t code)
info("Unsupported instruction %s (%08x) @ PC %08x\n",
instruction_get_string(code), code, cpu->pc);
- return PC_INC_NORMAL;
+ return INSTR_UNIMPL;
}
/*
@@ -62,7 +62,6 @@ static int call(struct nios2 *cpu, uint32_t code)
cpu->gp_regs[ra] = cpu->pc + 4;
cpu->pc = (instr->imm26 * 4) | (cpu->pc & 0xF0000000);
- dbg("pc after call: %08x\n", cpu->pc);
return PC_INC_BY_INSTR;
}
@@ -858,7 +857,7 @@ static int handle_r_type_instr(struct nios2 *cpu, uint32_t code)
if (unlikely(opx >= R_TYPE_COUNT))
return INSTR_ERR;
- dbg(" R: %s (%08x)\n", r_type_instructions[opx].name, code);
+// dbg(" R: %s (%08x)\n", r_type_instructions[opx].name, code);
handle_instr = r_type_instructions[opx].handler;
if (unlikely(handle_instr == NULL))
return INSTR_ERR;
@@ -872,7 +871,7 @@ instruction_handler instruction_get_handler(uint32_t code)
if (unlikely(op >= I_TYPE_COUNT))
return NULL;
- dbg("I: %s (%08x)\n", i_type_instructions[op].name, code);
+// dbg("I: %s (%08x)\n", i_type_instructions[op].name, code);
return i_type_instructions[op].handler;
}
diff --git a/instruction.h b/instruction.h
index cf709dc..1992b6a 100644
--- a/instruction.h
+++ b/instruction.h
@@ -19,7 +19,7 @@
/* I-Type instruction */
struct i_type {
uint8_t op:6;
- uint16_t imm16;
+ uint16_t imm16:16;
uint8_t b:5;
uint8_t a:5;
} __packed;
@@ -194,6 +194,7 @@ enum {
/*
* Return values for instruction handlers
*/
+#define INSTR_UNIMPL -2 /* Unimplemented instruction */
#define INSTR_ERR -1 /* Error in instruction */
#define PC_INC_NORMAL 0 /* Normal PC increment after instruction */
#define PC_INC_BY_INSTR 1 /* PC got incremented by instruction */