Forum Discussion

andy25's avatar
andy25
Icon for Occasional Contributor rankOccasional Contributor
2 years ago

Nios V exception code

I have a Nios V and an "Avalon FIFO Memory Intel FPGA IP" fifo I'm trying to read in C.

I can read the status and length just fine:

// works
int len = altera_avalon_fifo_read_level(IPMB_FIFO_IN_CSR_BASE);
// works
if(!altera_avalon_fifo_read_status(IPMB_FIFO_IN_CSR_BASE, ALTERA_AVALON_FIFO_STATUS_E_MSK))
{
   // dies
   int sample = IORD_ALTERA_AVALON_FIFO_DATA(IPMB_FIFO_OUT_BASE);

in gdb, I can see IORD causes an exception_code 4:

Program received signal SIGTRAP, Trace/breakpoint trap.
handle_trap (cause=4, epc=1512, tval=134414729) at HAL/src/alt_irq_handler.c:106
106	            NIOSV_EBREAK();
(gdb) p exception_code 
$4 = 4
(gdb) p is_irq
$5 = 0

Whats an exception code 4? Is there a list someplace?

Is *_FIFO_OUT_BASE the right thing to pass to IORD_ALTERA_AVALON_FIFO_DATA?

Thanks for your time,

-Andy

6 Replies