Esempio n. 1
0
void router::behavior() {

    for (uint32_t i = 0; i < _num_inputs; i++) {
        for (uint32_t j = 0; j < _num_vcs; j++) {
            _vc[i][j].advance_time();
        }
    }

#ifndef _NO_SYSTEMC_
    //receive data
    _receive_flits();
    _receive_credits();
#endif
    _route();

    _wait_for_routing(); //wait until routing finishes

    //virtual channel allocation
    _vc_alloc();
    //switch allocation
    _sw_alloc();

#ifndef _NO_SYSTEMC_
    //send data
    _send_flits();
    _send_credits();
#endif
}
Esempio n. 2
0
    int Flat<Obj>::search_map(int location, Box<int> &route, int sum) {
      // save route
      route(sum) = location;

      // if end
      if (location == stop) {
        route(sum + 1) = MAXINT;  // end identifier

        if ( callback ) {
          stop_search = !callback(route, sum + 1, callback_data);  // found callback
        }

        return 1;
      }

      int count = 0; // all routes

      Box<int> box(8);
      int box_size = get_next_points(location, box);

      for (int i = 0; i < box_size; i++) {
        int point = box(i);
        int px = HIGH_X(point), py = LOW_Y(point);

        if ( (*flat_map)(px, py) > 0 && route.find(point, sum) < 0 ) {
          Box<int> _route(route);

          count += search_map(point, _route, sum + 1);

          if ( stop_search ) { return count; }
        }
      }

      return count;
    }