Skip to content

Commit 7907357

Browse files
authored
Merge pull request verilog-to-routing#3636 from verilog-to-routing/update_bus_based_mux
Adding bus attribute to mux tag
2 parents 172ffb7 + 61fc03c commit 7907357

5 files changed

Lines changed: 59 additions & 8 deletions

File tree

doc/src/arch/reference.rst

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1668,13 +1668,16 @@ The following describes the tags that are accepted in the ``<interconnect>`` tag
16681668
16691669
Direct interconnect example.
16701670
1671-
.. arch:tag:: <mux name="string" input="string" output="string"/>
1671+
.. arch:tag:: <mux name="string" input="string" output="string" bus="{true|false}"/>
16721672
16731673
:req_param name: Identifier for the interconnect.
16741674
:req_param input: Pins that are inputs to this interconnect. Different data lines are separated by a space.
16751675
:req_param output: Pins that are outputs of this interconnect.
1676+
:opt_param bus: Whether this mux selects between multi-bit (bus) data lines.
16761677
1677-
This tag supports both single-bit muxes and bus-based muxes. Note that the bit width of each mux input must match the bit width of the mux output.
1678+
When ``true``, each data line may be a multi-bit bus and the bit width of every mux input must match the bit width of the mux output.
1679+
1680+
When ``false`` (the default), every data line and the output must be a single pin.
16781681
16791682
**Example:**
16801683
@@ -1686,6 +1689,34 @@ The following describes the tags that are accepted in the ``<interconnect>`` tag
16861689
16871690
Mux interconnect example.
16881691
1692+
**Bus-based example:**
1693+
1694+
With ``bus="true"`` each data line may be a multi-bit bus. Every input data
1695+
line and the output must have the same bit width. In the example below the
1696+
27-bit buses ``one_mult_27x27.a`` and ``one_mult_27x27.b`` are the two data
1697+
lines selected onto the 27-bit output ``mult_27x27.a``:
1698+
1699+
.. code-block:: xml
1700+
1701+
<mux name="a2a" input="one_mult_27x27.a one_mult_27x27.b" output="mult_27x27.a" bus="true"/>
1702+
1703+
A data line may also be a bit-slice of a wider port, or a concatenation of
1704+
pins using ``{...}``; in every case the width of each data line must match
1705+
the output width. Here each data line is a 27-bit slice of the 54-bit
1706+
``mult_27.datain`` bus:
1707+
1708+
.. code-block:: xml
1709+
1710+
<mux name="datain2a" input="mult_27.datain[26:0] mult_27.datain[53:27]" output="one_mult_27x27.a" bus="true"/>
1711+
1712+
.. note::
1713+
1714+
``bus="true"`` is currently a convenience shorthand: VPR expands it into a
1715+
set of independent single-bit muxes (one per output bit), rather than
1716+
modeling a true multi-bit bus. This means each single-bit mux gets its own
1717+
separate config bit, whereas in a true bus-based mux all of the bit-level
1718+
muxes would share a single config bit.
1719+
16891720
16901721
16911722
A ``<complete>``, ``<direct>``, or ``<mux>`` tag may take one or more additional, optional, ``<pack_pattern>`` tags that are used to describe *molecules*.

libs/libarchfpga/src/physical_types.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1110,6 +1110,9 @@ struct t_pin_to_pin_annotation {
11101110
* annotations: Annotations for delay, power, etc
11111111
* infer_annotations: This interconnect is autogenerated, if true, infer pack_patterns
11121112
* such as carry-chains and forced packs based on interconnect linked to it
1113+
* bus: For MUX_INTERC only: when true, each data line may be a multi-bit bus
1114+
* (the bit width of every input set must match the output width). When
1115+
* false, every input set and the output must be a single pin.
11131116
* parent_mode_index: Mode of parent as int
11141117
*/
11151118
struct t_interconnect {
@@ -1122,6 +1125,8 @@ struct t_interconnect {
11221125
std::vector<t_pin_to_pin_annotation> annotations;
11231126
bool infer_annotations;
11241127

1128+
bool bus;
1129+
11251130
int line_num; /* Interconnect is processed later, need to know what line number it messed up on to give proper error message */
11261131

11271132
int parent_mode_index;
@@ -1135,6 +1140,7 @@ struct t_interconnect {
11351140
t_interconnect() {
11361141
type = (e_interconnect)0;
11371142
infer_annotations = false;
1143+
bus = false;
11381144
line_num = 0;
11391145
parent_mode_index = 0;
11401146
parent_mode = nullptr;

libs/libarchfpga/src/read_xml_arch_file.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1847,17 +1847,26 @@ static void process_interconnect(vtr::string_internment& strings,
18471847
for (auto child_name : {"complete", "direct", "mux"}) {
18481848
pugi::xml_node cur = get_first_child(Parent, child_name, loc_data, ReqOpt::OPTIONAL);
18491849

1850+
const bool is_mux = (std::string_view(child_name) == "mux");
1851+
1852+
// The optional 'bus' attribute is only valid on <mux> tags
1853+
std::vector<std::string> expected_attributes = {"name", "input", "output"};
1854+
if (is_mux) {
1855+
expected_attributes.emplace_back("bus");
1856+
}
1857+
18501858
while (cur != nullptr) {
1851-
expect_only_attributes(cur, {"name", "input", "output"}, loc_data);
1859+
expect_only_attributes(cur, expected_attributes, loc_data);
18521860
expect_only_children(cur, {"delay_constant", "delay_matrix", "C_constant", "C_matrix", "pack_pattern", "metadata"}, loc_data);
18531861

18541862
if (0 == strcmp(cur.name(), "complete")) {
18551863
mode->interconnect[interconnect_idx].type = COMPLETE_INTERC;
18561864
} else if (0 == strcmp(cur.name(), "direct")) {
18571865
mode->interconnect[interconnect_idx].type = DIRECT_INTERC;
18581866
} else {
1859-
VTR_ASSERT(0 == strcmp(cur.name(), "mux"));
1867+
VTR_ASSERT(is_mux);
18601868
mode->interconnect[interconnect_idx].type = MUX_INTERC;
1869+
mode->interconnect[interconnect_idx].bus = get_attribute(cur, "bus", loc_data, ReqOpt::OPTIONAL).as_bool(false);
18611870
}
18621871

18631872
mode->interconnect[interconnect_idx].line_num = loc_data.line(cur);

vpr/src/pack/pb_type_graph.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,6 +1239,11 @@ static void alloc_and_load_mux_interc_edges(t_interconnect* interconnect,
12391239
}
12401240
}
12411241

1242+
if (!interconnect->bus && num_output_ptrs[0] != 1) {
1243+
vpr_throw(VPR_ERROR_ARCH, get_arch_file_name(), interconnect->line_num,
1244+
"Bus-based mux requires the 'bus' attribute to be set to true on the <mux> tag\n");
1245+
}
1246+
12421247
/* One edge per (input_set, pin) pair so every edge remains single-pin.
12431248
* For a 1-bit mux this is identical to the original behaviour. */
12441249
const int pins_per_set = num_output_ptrs[0];

vtr_flow/arch/timing/k6_frac_N10_tileable_4add_2chains_depop50_mem20K_22nm.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -726,8 +726,8 @@
726726
<delay_constant max="1.848e-9" in_port="mult_27x27.b" out_port="mult_27x27.out"/>
727727
</pb_type>
728728
<interconnect>
729-
<mux name="a2a" input="one_mult_27x27.a one_mult_27x27.b" output="mult_27x27.a"/>
730-
<mux name="b2b" input="one_mult_27x27.a one_mult_27x27.b" output="mult_27x27.b"/>
729+
<mux name="a2a" input="one_mult_27x27.a one_mult_27x27.b" output="mult_27x27.a" bus="true"/>
730+
<mux name="b2b" input="one_mult_27x27.a one_mult_27x27.b" output="mult_27x27.b" bus="true"/>
731731
<direct name="out2out" input="mult_27x27.out" output="one_mult_27x27.out"/>
732732
</interconnect>
733733
<power method="pin-toggle">
@@ -741,11 +741,11 @@
741741
Subtract 72.5 ps delay, which is already in the connection block input mux, leading
742742
to a 134 ps delay.
743743
-->
744-
<mux name="datain2a" input="mult_27.datain[26:0] mult_27.datain[53:27]" output="one_mult_27x27.a">
744+
<mux name="datain2a" input="mult_27.datain[26:0] mult_27.datain[53:27]" output="one_mult_27x27.a" bus="true">
745745
<delay_constant max="134e-12" in_port="mult_27.datain[26:0]" out_port="one_mult_27x27.a"/>
746746
<delay_constant max="134e-12" in_port="mult_27.datain[53:27]" out_port="one_mult_27x27.a"/>
747747
</mux>
748-
<mux name="datain2b" input="mult_27.datain[26:0] mult_27.datain[53:27]" output="one_mult_27x27.b">
748+
<mux name="datain2b" input="mult_27.datain[26:0] mult_27.datain[53:27]" output="one_mult_27x27.b" bus="true">
749749
<delay_constant max="134e-12" in_port="mult_27.datain[26:0]" out_port="one_mult_27x27.b"/>
750750
<delay_constant max="134e-12" in_port="mult_27.datain[53:27]" out_port="one_mult_27x27.b"/>
751751
</mux>

0 commit comments

Comments
 (0)