src/mem/ruby/network/garnet/SwitchAllocator.cc
/*
 * SA-I (or SA-i) loops through all input VCs at every input port,
 * and selects one in a round robin manner.
 *    - For HEAD/HEAD_TAIL flits only selects an input VC whose output port
 *     has at least one free output VC.
 *    - For BODY/TAIL flits, only selects an input VC that has credits
 *      in its output VC.
 * Places a request for the output port from this input VC.
 */
SA-I (or SA-i) loops through all input VCs at every input port,
and selects one in a round robin manner.
- For HEAD/HEAD_TAIL flits only selects an input VC whose output port
has at least one free output VC.
- For BODY/TAIL flits, only selects an input VC that has credits
in its output VC.
Places a request for the output port from this input VC.
SA - I ( or SA - i ) loops through all input VCs at every input port and selects one in a round robin manner . - For HEAD / HEAD_TAIL flits only selects an input VC whose output port has at least one free output VC . - For BODY / TAIL flits only selects an input VC that has credits in its output VC . Places a request for the output port from this input VC .
void
SwitchAllocator::arbitrate_inports()
{
    for (int inport = 0; inport < m_num_inports; inport++) {
        int invc = m_round_robin_invc[inport];
        for (int invc_iter = 0; invc_iter < m_num_vcs; invc_iter++) {
            auto input_unit = m_router->getInputUnit(inport);
            if (input_unit->need_stage(invc, SA_, curTick())) {
                int outport = input_unit->get_outport(invc);
                int outvc = input_unit->get_outvc(invc);
                bool make_request =
                    send_allowed(inport, invc, outport, outvc);
                if (make_request) {
                    m_input_arbiter_activity++;
                    m_port_requests[inport] = outport;
                    m_vc_winners[inport] = invc;
                    break; 
                }
            }
            invc++;
            if (invc >= m_num_vcs)
                invc = 0;
        }
    }
}
void SwitchAllocator :: arbitrate_inports ( ) { for ( int inport = 0 ; inport < m_num_inports ; inport ++ ) { int invc = m_round_robin_invc [ inport ] ; for ( int invc_iter = 0 ; invc_iter < m_num_vcs ; invc_iter ++ ) { auto input_unit = m_router -> getInputUnit ( inport ) ; if ( input_unit -> need_stage ( invc , SA_ , curTick ( ) ) ) { int outport = input_unit -> get_outport ( invc ) ; int outvc = input_unit -> get_outvc ( invc ) ; bool make_request = send_allowed ( inport , invc , outport , outvc ) ; if ( make_request ) { m_input_arbiter_activity ++ ; m_port_requests [ inport ] = outport ; m_vc_winners [ inport ] = invc ; break ; } } invc ++ ; if ( invc >= m_num_vcs ) invc = 0 ; } } }
SA-I (or SA-i) loops through all input VCs at every input port,
 and selects one in a round robin manner.
SA - I ( or SA - i ) loops through all input VCs at every input port and selects one in a round robin manner .
// Select a VC from each input in a round robin manner // Independent arbiter at each input port // This flit is in SA stage // check if the flit in this InputVC is allowed to be sent // send_allowed conditions described in that function. // got one vc winner for this port