3.5.1.17.2 Struct Partitioning

Partitioning a struct creates a separate interface / memory for each field in the struct. Two partitioning types are supported for struct types: fields and complete.
Fields Partitioning
Fields partitioning acts on 1-level of nested struct types, i.e. only the fields in the top struct type are disaggregated. In our example, to partition clients into its fields, partition pragma with struct_fields type is used:
UpdateResult update(Client clients[N], ap_uint<6> id, Account acc) {
#pragma HLS function top
#pragma HLS memory partition argument(clients) type(struct_fields)
    //...
}
In the HLS summary report, clients result in 2 memory interfaces acc and id. Notice that the inner struct member acc is not partitioned into its members and kept as a single interface.
| RTL Interface Generated by SmartHLS                                                                |
+----------+-----------------+---------------------------------+------------------+------------------+
| C++ Name | Interface Type  | Signal Name                     | Signal Bit-width | Signal Direction |
+----------+-----------------+---------------------------------+------------------+------------------+
|          | Clock & Reset   | clk (positive edge)             | 1                | input            |
|          |                 | clients_acc_address_b           | 2                | output           |
|          |                 | clients_acc_clken               | 1                | output           |
|          |                 | clients_acc_read_data_a         | 128              | input            |
|          |                 | clients_acc_read_data_b         | 128              | input            |
|          |                 | clients_acc_read_en_a           | 1                | output           |
|          |                 | clients_acc_read_en_b           | 1                | output           |
|          |                 | clients_acc_write_data_a        | 128              | output           |
|          |                 | clients_acc_write_data_b        | 128              | output           |
|          |                 | clients_acc_write_en_a          | 1                | output           |
|          |                 | clients_acc_write_en_b          | 1                | output           |
|          |                 | clients_id_address_a            | 2                | output           |
|          |                 | clients_id_address_b            | 2                | output           |
|          |                 | clients_id_clken                | 1                | output           |
|          |                 | clients_id_read_data_a          | 6                | input            |
|          |                 | clients_id_read_data_b          | 6                | input            |
|          |                 | clients_id_read_en_a            | 1                | output           |
|          |                 | clients_id_read_en_b            | 1                | output           |
+----------+-----------------+---------------------------------+------------------+------------------+
| acc      | Scalar Memory   | acc_read_data                   | 128              | input            |
Important:
  • Fields partitioning keeps the inner aggregate types (arrays and structs) without partitioning.
  • Fields partitioning an array of struct results in an array for each field in the struct.
Complete Partitioning
Complete partitioning of a struct type creates a separate interface / memory for each primitive element in the struct. This implies that partitioning is applied recursively on the struct or a array of struct. In our example, to partition clients into its fields, partition pragma with complete type is used:
UpdateResult update(Client clients[N], ap_uint<6> id, Account acc) {
#pragma HLS function top
#pragma HLS memory partition argument(clients) type(complete)
    //...
}
In the HLS summary report, clients result in 12 interfaces which is 4 array elements with 3 fields for each element.
| RTL Interface Generated by SmartHLS                                                                   |
+----------+-----------------+------------------------------------+------------------+------------------+
| C++ Name | Interface Type  | Signal Name                        | Signal Bit-width | Signal Direction |
+----------+-----------------+------------------------------------+------------------+------------------+
|          | Clock & Reset   | clk (positive edge)                | 1                | input            |
|          |                 | clients_a0_acc_checking_write_data | 64               | output           |
|          |                 | clients_a0_acc_checking_write_en   | 1                | output           |
|          |                 | clients_a0_acc_savings_read_data   | 64               | input            |
|          |                 | clients_a0_acc_savings_write_data  | 64               | output           |
|          |                 | clients_a0_acc_savings_write_en    | 1                | output           |
|          |                 | clients_a0_id_read_data            | 6                | input            |
|          |                 | clients_a1_acc_checking_read_data  | 64               | input            |
|          |                 | clients_a1_acc_checking_write_data | 64               | output           |
|          |                 | clients_a1_acc_checking_write_en   | 1                | output           |
|          |                 | clients_a1_acc_savings_read_data   | 64               | input            |
|          |                 | clients_a1_acc_savings_write_data  | 64               | output           |
|          |                 | clients_a1_acc_savings_write_en    | 1                | output           |
|          |                 | clients_a1_id_read_data            | 6                | input            |
|          |                 | clients_a2_acc_checking_read_data  | 64               | input            |
|          |                 | clients_a2_acc_checking_write_data | 64               | output           |
|          |                 | clients_a2_acc_checking_write_en   | 1                | output           |
|          |                 | clients_a2_acc_savings_read_data   | 64               | input            |
|          |                 | clients_a2_acc_savings_write_data  | 64               | output           |
|          |                 | clients_a2_acc_savings_write_en    | 1                | output           |
|          |                 | clients_a2_id_read_data            | 6                | input            |
|          |                 | clients_a3_acc_checking_read_data  | 64               | input            |
|          |                 | clients_a3_acc_checking_write_data | 64               | output           |
|          |                 | clients_a3_acc_checking_write_en   | 1                | output           |
|          |                 | clients_a3_acc_savings_read_data   | 64               | input            |
|          |                 | clients_a3_acc_savings_write_data  | 64               | output           |
|          |                 | clients_a3_acc_savings_write_en    | 1                | output           |
|          |                 | clients_a3_id_read_data            | 6                | input            |
+----------+-----------------+------------------------------------+------------------+------------------+