INT instruction only works with internal interrupts

Issue #20 new
Lucas Parzych created an issue

The INT instruction does not work with external interrupts.

If you look in miniat_decode.c and miniat_interrupts.c at the case statements for the M_INT operation, you'll see the following:

minitat_decode.c:

if(!m_hazards_check(m, rC, true)) {
    if((D >= M_INT_RESET && D <= M_INT_OVERFLOW) || (D >= M_XINT0 && D <= M_XINT15)) {
        m_pipeline_stalls_clear(m, m_pipeline_stage_decode);
    }
    else {
        m_hazards_add(m, M_CSR_INT_FLAG_LOW, false);
        int_tripped =  M_INT_ILLEGAL_ADDRESS;
    }
}

miniat_writeback.c

m_memory_read(m, M_CSR_INT_FLAG_LOW , &ifr_tmp);
ifr_tmp |= 1 << D;
m_memory_write(m, M_CSR_INT_FLAG_LOW , ifr_tmp);
m_hazards_remove(m, M_CSR_INT_FLAG_LOW, false);

Do we know why this design decision was made? Do we still want this to be the behavior?

Comments (2)

  1. William Roberts

    This looks like a bug to me. Considering that we check in decode stage that its within the range of ints and xints, but only write to the low register on writeback. Also, we never seem to add M_CSR_INT_FLAG_LOW to the hazard queue on proper INT instructions...

  2. Log in to comment