Skip to content

Commit

Permalink
fix machine_external_ints test
Browse files Browse the repository at this point in the history
  • Loading branch information
wsipak committed Nov 5, 2024
1 parent 3cc0637 commit 2963434
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
5 changes: 4 additions & 1 deletion testbench/asm/machine_external_ints.s
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#include "common.s"

machine_software_interrupt:
// put expected mcause in x4
la x4, 0x80000003
// put expected mscause in x5
li x5, 0x0
// enable software interrupt
li x2, 0x8
Expand All @@ -10,6 +12,7 @@ machine_software_interrupt:
li x2, TRIGGER_SOFT_INT
li x3, STDOUT
sw x2, 0(x3)
li x12, 0x8
j fail_if_not_serviced

machine_timer_interrupt:
Expand All @@ -27,4 +30,4 @@ machine_timer_interrupt:
main:
call machine_software_interrupt
call machine_timer_interrupt
j _finish
j _finish
23 changes: 17 additions & 6 deletions testbench/asm/tb.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
#define STDOUT 0xd0580000

#define TRIGGER_NMI 0x80
/* TODO remove this. It's not supported by the testbench mailbox logic */
#define LOAD_NMI_ADDR 0x81
#define TRIGGER_DBUS_FAULT 0x82
#define TRIGGER_IBUS_FAULT 0x83
#define TRIGGER_SOFT_INT 0x84
#define TRIGGER_TIMER_INT 0x85
#define TRIGGER_EXT_INT1 0x86
/* helper macros that define messages to be written to `STDOUT` to trigger and clear interrupts */

#define CLEAR 0x82
#define TRIGGER 0x83

#define NMI_INT (1<<8)
#define TIMER_INT (1<<9)
#define SOFT_INT (1<<10)

#define TRIGGER_NMI_INT (TRIGGER | NMI_INT)
#define TRIGGER_TIMER_INT (TRIGGER | TIMER_INT)
#define TRIGGER_SOFT_INT (TRIGGER | SOFT_INT)

#define CLEAR_NMI_INT (CLEAR | NMI_INT)
#define CLEAR_TIMER_INT (CLEAR | TIMER_INT)
#define CLEAR_SOFT_INT (CLEAR | SOFT_INT)

0 comments on commit 2963434

Please sign in to comment.