1533 int side_cw_incoming_wire_count, side_ccw_incoming_wire_count,
1534 opp_incoming_wire_count;
1535 int to_side, side, side_cw, side_ccw, side_opp, itrack;
1536 int Fs_per_side, chan, seg, chan_len, sb_seg;
1537 boolean is_core_sblock, is_corner_sblock, x_edge, y_edge;
1538 int *incoming_wire_label[4];
1539 int *wire_mux_on_track[4];
1540 int num_incoming_wires[4];
1541 int num_ending_wires[4];
1542 int num_wire_muxes[4];
1543 boolean skip, vert, pos_dir;
1548 Fs_per_side = Fs / 3;
1598 x_edge = (
boolean)((i < 1) || (i >=
nx));
1599 y_edge = (
boolean)((j < 1) || (j >=
ny));
1601 is_corner_sblock = (
boolean)(x_edge && y_edge);
1602 is_core_sblock = (
boolean)(!x_edge && !y_edge);
1605 for (side = 0; side < 4; ++side) {
1607 wire_mux_on_track[side] = NULL;
1608 incoming_wire_label[side] = NULL;
1609 num_incoming_wires[side] = 0;
1610 num_ending_wires[side] = 0;
1611 num_wire_muxes[side] = 0;
1646 chan = (vert ? i : j);
1647 sb_seg = (vert ? j : i);
1648 seg = (pos_dir ? (sb_seg + 1) : sb_seg);
1649 chan_len = (vert ?
ny :
nx);
1655 seg_details, chan_len, dir, nodes_per_chan,
1656 &num_incoming_wires[side], &num_ending_wires[side]);
1661 chan_len, dir, nodes_per_chan, &num_wire_muxes[side]);
1664 for (to_side = 0; to_side < 4; to_side++) {
1666 if (0 == num_wire_muxes[to_side]) {
1672 side_cw = (to_side + 1) % 4;
1673 side_opp = (to_side + 2) % 4;
1674 side_ccw = (to_side + 3) % 4;
1687 side_cw_incoming_wire_count = 0;
1688 if (incoming_wire_label[side_cw]) {
1689 for (itrack = 0; itrack < nodes_per_chan; itrack++) {
1691 if (incoming_wire_label[side_cw][itrack] !=
UN_SET) {
1693 if ((is_corner_sblock || is_core_sblock)
1694 && (incoming_wire_label[side_cw][itrack]
1695 < num_ending_wires[side_cw])) {
1701 num_ending_wires[side_cw] == num_wire_muxes[to_side]);
1702 sblock_pattern[i][j][side_cw][to_side][itrack] =
1704 incoming_wire_label[side_cw][itrack],
1706 num_wire_muxes[to_side]);
1712 sblock_pattern[i][j][side_cw][to_side][itrack] =
1713 (side_cw_incoming_wire_count * Fs_per_side)
1714 % num_wire_muxes[to_side];
1715 side_cw_incoming_wire_count++;
1721 side_ccw_incoming_wire_count = 0;
1722 for (itrack = 0; itrack < nodes_per_chan; itrack++) {
1725 if (incoming_wire_label[side_ccw] == NULL)
1729 if (incoming_wire_label[side_ccw][itrack] !=
UN_SET) {
1731 if ((is_corner_sblock || is_core_sblock)
1732 && (incoming_wire_label[side_ccw][itrack]
1733 < num_ending_wires[side_ccw])) {
1737 incoming_wire_label[side_ccw] [itrack] < num_wire_muxes[to_side]);
1738 sblock_pattern[i][j][side_ccw][to_side][itrack] =
1740 incoming_wire_label[side_ccw][itrack],
1741 switch_block_type, num_wire_muxes[to_side]);
1746 sblock_pattern[i][j][side_ccw][to_side][itrack] =
1747 ((side_ccw_incoming_wire_count
1748 + side_cw_incoming_wire_count) * Fs_per_side)
1749 % num_wire_muxes[to_side];
1750 side_ccw_incoming_wire_count++;
1755 opp_incoming_wire_count = 0;
1756 if (incoming_wire_label[side_opp]) {
1757 for (itrack = 0; itrack < nodes_per_chan; itrack++) {
1759 if (incoming_wire_label[side_opp][itrack] !=
UN_SET) {
1762 if (is_core_sblock) {
1763 if (incoming_wire_label[side_opp][itrack]
1764 < num_ending_wires[side_opp]) {
1769 sblock_pattern[i][j][side_opp][to_side][itrack] =
1771 wire_mux_on_track[to_side],
1772 num_wire_muxes[to_side], itrack);
1775 sblock_pattern[i][j][side_opp][to_side][itrack] =
1776 ((side_ccw_incoming_wire_count
1777 + side_cw_incoming_wire_count)
1779 + opp_incoming_wire_count
1780 * (Fs_per_side - 1))
1781 % num_wire_muxes[to_side];
1782 opp_incoming_wire_count++;
1785 if (incoming_wire_label[side_opp][itrack]
1786 < num_ending_wires[side_opp]) {
1787 sblock_pattern[i][j][side_opp][to_side][itrack] =
1789 wire_mux_on_track[to_side],
1790 num_wire_muxes[to_side], itrack);
1793 sblock_pattern[i][j][side_opp][to_side][itrack] =
1794 ((side_ccw_incoming_wire_count
1795 + side_cw_incoming_wire_count)
1797 + opp_incoming_wire_count
1798 * (Fs_per_side - 1))
1799 % num_wire_muxes[to_side];
1800 opp_incoming_wire_count++;
1808 for (side = 0; side < 4; ++side) {
1809 if (incoming_wire_label[side]) {
1810 free(incoming_wire_label[side]);
1812 if (wire_mux_on_track[side]) {
1813 free(wire_mux_on_track[side]);
int get_simple_switch_block_track(INP enum e_side from_side, INP enum e_side to_side, INP int from_track, INP enum e_switch_block_type switch_block_type, INP int nodes_per_chan)
static int find_label_of_track(int *wire_mux_on_track, int num_wire_muxes, int from_track)
static int * label_incoming_wires(INP int chan_num, INP int seg_num, INP int sb_seg, INP t_seg_details *seg_details, INP int max_len, INP enum e_direction dir, INP int nodes_per_chan, OUTP int *num_incoming_wires, OUTP int *num_ending_wires)
static int * label_wire_muxes(INP int chan_num, INP int seg_num, INP t_seg_details *seg_details, INP int max_len, INP enum e_direction dir, INP int nodes_per_chan, OUTP int *num_wire_muxes)