macsim/macsim-seq.c
// Simulate one instruction
// return the number of cycles that it takes
//
// FIXME: Should node->cycle be also incremented if node was stopped?
//        Save stop time in seperate variable?
Simulate one instruction
return the number of cycles that it takes

Should node->cycle be also incremented if node was stopped.
Simulate one instruction return the number of cycles that it takes Should node - > cycle be also incremented if node was stopped .
void simulate_one_instruction(node_t *node)
{
    uint_fast32_t cs = node->state;
    if (cs>CS_RUNNING) {        
        node->cycle++;
        node->state = cs-1;
        if (cs==CS_RUNNING+1) node->pc = node->nextpc;
    } else if (CS_READY(cs)) {
        instruction_class_t ic = node->one_cycle(node);
        if (ic>0) {
            if (ic==1) node->pc = node->nextpc;
            node->cycle++;
            node->state = CS_RUNNING-1+ic; 
        } else if (ic==IC_BLOCKED) {
            node->cycle++;
        } else if (ic==IC_STOP) {
            reason_for_stop(node);
        } else fatal("Unknown instruction class %d.", ic);
    }
}
void simulate_one_instruction ( node_t * node ) { uint_fast32_t cs = node -> state ; if ( cs > CS_RUNNING ) { node -> cycle ++ ; node -> state = cs - 1 ; if ( cs == CS_RUNNING + 1 ) node -> pc = node -> nextpc ; } else if ( CS_READY ( cs ) ) { instruction_class_t ic = node -> one_cycle ( node ) ; if ( ic > 0 ) { if ( ic == 1 ) node -> pc = node -> nextpc ; node -> cycle ++ ; node -> state = CS_RUNNING - 1 + ic ; } else if ( ic == IC_BLOCKED ) { node -> cycle ++ ; } else if ( ic == IC_STOP ) { reason_for_stop ( node ) ; } else fatal ( " " , ic ) ; } }
Simulate one instruction
return the number of cycles that it takes
Simulate one instruction return the number of cycles that it takes
// multicycle instruction // Timing // store multiple cycles in state // If send or receive blocks, don't increase the PC. // Thereby the instruction is executed again and again, until // the blocking is over.