@@ -681,6 +681,82 @@ static bool read_hostpipe_mappings(
681
681
return result;
682
682
}
683
683
684
+ /*
685
+ New section added in 2024.1
686
+ - Number of group of sideband signals -> each group map to each hostpipe
687
+ For each sideband signal group
688
+ - pipe logical name
689
+ - number of sideband signals (including data field)
690
+ - number of fields for each sideband signal
691
+ - port identifier, like 0 for data, 1,2,3 for different sideband signals
692
+ - port offset (in bits)
693
+ - sideband size (in bits)
694
+
695
+ If a hostpipe has no sideband signal (e.g, a pipe only has data field), it won't
696
+ have a sideband signal group. If none of the hostpipe has any sideband signals,
697
+ the whole section will just be 0, which represents the number of sideband signal
698
+ group is 0.
699
+
700
+ */
701
+
702
+ static bool read_sideband_mappings (
703
+ const std::string &config_str, std::string::size_type &curr_pos,
704
+ std::vector<acl_sideband_signal_mapping> &sideband_signal_mappings,
705
+ std::vector<int > &counters, std::string &err_str) noexcept {
706
+
707
+ // Get how many hostpipes have sideband signals
708
+ unsigned int num_of_sideband_groups = 0 ;
709
+ bool result = read_uint_counters (config_str, curr_pos, num_of_sideband_groups,
710
+ counters);
711
+
712
+ // If none of the hostpipes have sideband signals, this section ends here.
713
+ if (num_of_sideband_groups == 0 ) {
714
+ return result;
715
+ }
716
+
717
+ // Reaching here means we need to parse sideband signals.
718
+
719
+ for (unsigned int i = 0 ; result && (i < num_of_sideband_groups); i++) {
720
+
721
+ std::string logical_name;
722
+ unsigned num_sideband_signals = 0 ;
723
+ result =
724
+ read_string_counters (config_str, curr_pos, logical_name, counters) &&
725
+ read_uint_counters (config_str, curr_pos, num_sideband_signals,
726
+ counters);
727
+ assert (num_sideband_signals >=
728
+ 2 ); // If it has an entry, it must have 1 data signal + at least 1
729
+ // sideband signals
730
+
731
+ unsigned num_fields_per_sideband = 0 ;
732
+ if (result) {
733
+ result = read_uint_counters (config_str, curr_pos, num_fields_per_sideband,
734
+ counters);
735
+ }
736
+
737
+ for (unsigned int j = 0 ; result && (j < num_sideband_signals); j++) {
738
+ counters.emplace_back (num_fields_per_sideband);
739
+ acl_sideband_signal_mapping mapping{};
740
+ mapping.logical_name = logical_name;
741
+ result = read_uint_counters (config_str, curr_pos, mapping.port_identifier ,
742
+ counters) &&
743
+ read_uint_counters (config_str, curr_pos, mapping.port_offset ,
744
+ counters) &&
745
+ read_uint_counters (config_str, curr_pos, mapping.sideband_size ,
746
+ counters);
747
+ sideband_signal_mappings.emplace_back (mapping);
748
+
749
+ while (result && counters.back () > 0 ) {
750
+ std::string tmp;
751
+ result = read_string_counters (config_str, curr_pos, tmp, counters);
752
+ }
753
+ check_section_counters (counters);
754
+ counters.pop_back ();
755
+ }
756
+ }
757
+ return result;
758
+ }
759
+
684
760
static bool read_kernel_args (const std::string &config_str,
685
761
const bool kernel_arg_info_available,
686
762
std::string::size_type &curr_pos,
@@ -1221,6 +1297,17 @@ bool acl_load_device_def_from_str(const std::string &config_str,
1221
1297
config_str, curr_pos, devdef.hostpipe_mappings , counters, err_str);
1222
1298
}
1223
1299
1300
+ // Starting from 2024.1, there is a new section that adds sideband signal
1301
+ // information.
1302
+
1303
+ // Read program scoped hostpipes sideband signals mapping
1304
+
1305
+ if (result && counters.back () > 0 ) {
1306
+ result = read_sideband_mappings (config_str, curr_pos,
1307
+ devdef.sideband_signal_mappings , counters,
1308
+ err_str);
1309
+ }
1310
+
1224
1311
// forward compatibility: bypassing remaining fields at the end of device
1225
1312
// description section
1226
1313
while (result && counters.size () > 0 &&
0 commit comments