|
| 1 | +.. _custom_rr_graph: |
| 2 | + |
| 3 | +Custom RR Graph |
| 4 | +=============== |
| 5 | + |
| 6 | +For users who want more control over how connections are made in the routing resource graph, VPR provides a way to describe them through a Custom RR Graph (CRR) generator. |
| 7 | + |
| 8 | +Currently, the CRR Generator is only based on the tileable RR Graph. Support for the default VPR RR Graph Generator is in progress. To generate a CRR, the following files are required: |
| 9 | + |
| 10 | +* Switch block map file |
| 11 | +* Switch block template files |
| 12 | + |
| 13 | +Switch Block Map File |
| 14 | +~~~~~~~~~~~~~~~~~~~~~~ |
| 15 | + |
| 16 | +This is a YAML file that specifies which switch block template should be used for each tile. The mapping format supports the following patterns: |
| 17 | + |
| 18 | +* ``SB_1__1_: [sb_template.csv]`` - Tile at location (1, 1) uses switch block template ``sb_template.csv`` |
| 19 | +* ``SB_1__*_: [sb_template.csv]`` - All tiles with x coordinate 1 use switch block template ``sb_template.csv`` |
| 20 | +* ``SB_[7,20]__[2:32:3]_: [sb_template.csv]`` - Tiles with x equal to 7 or 20, and y coordinates from 2 to 32 (inclusive) with step 3 use switch block template ``sb_template.csv`` |
| 21 | + |
| 22 | +**Important:** The order in which patterns are defined matters, as the first matching pattern is used. |
| 23 | + |
| 24 | +Switch Block Template Files |
| 25 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 26 | + |
| 27 | +Terminology |
| 28 | +----------- |
| 29 | + |
| 30 | +Before describing the template files, let's define some key terminology: |
| 31 | + |
| 32 | +**Lane:** A group of wires with the same length. The starting points of consecutive wires in a lane are one switch block apart. |
| 33 | + |
| 34 | +**Tap:** A switch block location where a wire passes through and can have fan-out connections. |
| 35 | + |
| 36 | +See the figure below for an illustration: |
| 37 | + |
| 38 | +.. figure:: images/lane_and_tap.png |
| 39 | + :alt: Lane and Tap |
| 40 | + :width: 50% |
| 41 | + :align: center |
| 42 | + |
| 43 | + In the figure above, the taps for the red wire are shown, and the lanes are separated by dotted lines. Note that the figure is simplified for illustration purposes. |
| 44 | + |
| 45 | +In the actual RR Graph, when a wire passes through a switch block, its track number changes. Below is a more realistic example: |
| 46 | + |
| 47 | +.. figure:: images/lane_and_tap_realistic.png |
| 48 | + :alt: Lane and Tap Realistic |
| 49 | + :width: 50% |
| 50 | + :align: center |
| 51 | + |
| 52 | + A more realistic example of a lane and a tap. Each box contains a lane. |
| 53 | + |
| 54 | +Template File Format |
| 55 | +-------------------- |
| 56 | + |
| 57 | +There should be a directory containing the pattern files specified in the switch block maps file. Each template is a CSV file with the following format: |
| 58 | + |
| 59 | +* **Rows** represent source nodes |
| 60 | +* **Columns** represent sink nodes |
| 61 | +* An **'x' mark** at an intersection indicates that the source and sink nodes are connected |
| 62 | +* A **number** at an intersection indicates that the nodes are connected with the switch delay specified by that number |
| 63 | + |
| 64 | +**Note:** The pattern currently only supports uni-directional segments. Therefore, wires can only be driven from their starting point. |
| 65 | + |
| 66 | +Row Headers (Source Nodes) |
| 67 | +^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 68 | + |
| 69 | +Each row has four header columns describing the source node: |
| 70 | + |
| 71 | +1. **Column 1 - Direction:** The side from which the source node is entering the switch block (e.g., 'left', 'right', 'top', 'bottom') |
| 72 | +2. **Column 2 - Segment Type:** The segment length to which the source node belongs |
| 73 | +3. **Column 3 - Lane Number:** The lane to which the source node belongs (see terminology above) |
| 74 | +4. **Column 4 - Tap Number:** Which tap of the source node is at this switch block |
| 75 | + |
| 76 | +Column Headers (Sink Nodes) |
| 77 | +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 78 | + |
| 79 | +Each column has header rows describing the sink node: |
| 80 | + |
| 81 | +1. **Row 1 - Direction:** The side from which the sink node is exiting the switch block |
| 82 | +2. **Row 2 - Segment Type:** The segment length to which the sink node belongs |
| 83 | +3. **Row 3 - Fan-in:** The fan-in of the sink node (optional) |
| 84 | +4. **Row 4 - Lane Number:** The lane to which the sink node belongs |
| 85 | + |
| 86 | +Example |
| 87 | +^^^^^^^ |
| 88 | + |
| 89 | +Let’s consider an architecture with a channel width of 16 that contains only wire segments of length 4. |
| 90 | + |
| 91 | +The number of rows should be calculated as: |
| 92 | + |
| 93 | +- ``4`` (number of sides) × ``160/2`` (number of tracks in one direction) = ``320`` rows. |
| 94 | + |
| 95 | +On each side, there should be: |
| 96 | + |
| 97 | +- ``20`` lanes (``80 / 4``), and |
| 98 | +- each lane requires ``4`` rows (because length-4 wires require 4 tap positions). |
| 99 | + |
| 100 | +For the columns, the count should be: |
| 101 | + |
| 102 | +- ``4`` (number of sides) × ``160/2`` (number of tracks in one direction) ÷ ``4`` (number of starting tracks per lane) = ``80`` columns. |
0 commit comments