for j in range(len(list_nets_bp)): if ( list_comp_bb[i][0] == list_comp_bp[j][0] and list_comp_bb[i][1] == list_comp_bp[j][1] ): row.append(list_nets_bb[i]) row.append("-".join(list_comp_bb[i])) row.append(list_nets_bp[j]) mirror_bb_to_mirror_bp_map.append(row) # THE ABOVE WORKS ALTHOUGH IT SAYS THAT SOME NETS GO TO GROUND WHEN THEY # SHOULDN'T As of now, I know that the "..._2V5_SENSE_..." lines all go to GND # when they actually don't These all go to "GND" because they have ""ClassName" # "NetTie"" listed underneath their net names ################# # Output to csv # ################# # Mirror Custom Telemetry BB -> Mirror Backplane (short?) ###################### write_to_csv( mirror_bb_to_bp_mapping_filename, mirror_bb_to_mirror_bp_map, ["Mirror Telemetry BB net", "Telemetry BB connector", "Mirror Backplane net"], )
list_nets_inner_bb = list( map(lambda x: x.replace(' ', ''), inner_bb_ref.values())) list_comp_bp = list(mirror_bp_ref.keys()) list_nets_bp = list(mirror_bp_ref.values()) inner_bb_to_mirror_bp_map = [] for i in range(len(list_nets_inner_bb)): row = [] for j in range(len(list_nets_bp)): if (list_comp_inner_bb[i][0] == list_comp_bp[j][0] and list_comp_inner_bb[i][1] == list_comp_bp[j][1]): row.append(list_nets_inner_bb[i]) row.append("-".join(list_comp_inner_bb[i])) row.append(list_nets_bp[j]) inner_bb_to_mirror_bp_map.append(row) ################# # Output to csv # ################# # Inner BB -> Mirror Backplane (short?) ######################################## write_to_csv( inner_bb_to_mirror_bp_mapping_filename, inner_bb_to_mirror_bp_map, ["Inner BB net", "Inner BB connector", "Mirror Backplane net"], )
row.append( jpu_cable_length(jpu, var_attrs['cable_length'], var_attrs['cable_length_adj'])) if first_run: headers_csv.append('Length [cm]') headers_tex.append(makecell('Length', '[cm]')) var_attrs['data'].append(row) ################# # Write to file # ################# headers_tex += [ 'Cut', makecell('Crimp', 'P2B2'), 'Label', makecell('Crimp', 'PPP'), 'Check' ] for _, attrs in output_spec.items(): for _, var_attrs in attrs.items(): data = sorted(var_attrs['data'], key=lambda x: ppp_sort(x[0])) filename = var_attrs['filename'] title = var_attrs['title'] color = var_attrs['color'] write_to_csv(output_dir / Path(filename + '.csv'), data, headers_csv) write_to_latex_ppp(output_dir / Path(filename + '.tex'), title, data, headers_tex, color)
#################### # Make connections # #################### # Pathfinder -> COMET -> COMET DB -> COMET ##################################### comet_ufl_data = [] for ufl_pin, comet_pin in path_finder_ufl_to_comet.items(): row = [] fpga_pin = comet_j1_j2_duo_to_fpga[comet_pin] row.append('-'.join(fpga_pin)) row.append('-'.join(comet_pin)) row.append('-'.join(ufl_pin)) comet_ufl_data.append(row) comet_ufl_data.sort(key=lambda x: int(x[2].split('-')[0][1:])) ################# # Output to csv # ################# # COMET FPGA -> Pathfinder U.FL, full ########################################## write_to_csv(comet_pf_mapping_filename, comet_ufl_data, [ 'COMET FPGA pin', 'Pathfinder COMET connector', 'Pathfinder U.FL connector' ])
list_nets_bp = list(true_bp_ref.values()) inner_bb_to_true_bp_map = [] for i in range(len(list_nets_inner_bb)): row = [] for j in range(len(list_nets_bp)): if ( list_comp_inner_bb[i][0] == list_comp_bp[j][0] and list_comp_inner_bb[i][1] == list_comp_bp[j][1] ): row.append(list_nets_inner_bb[i]) row.append("-".join(list_comp_inner_bb[i])) row.append(list_nets_bp[j]) inner_bb_to_true_bp_map.append(row) ################# # Output to csv # ################# # Inner BB -> True Backplane (short?) ########################################## write_to_csv( inner_bb_to_true_bp_mapping_filename, inner_bb_to_true_bp_map, ["Inner BB net", "Inner BB connector", "True Backplane net"], )
# Debug # for rule in pt_rules_true: # rule.debug_node = NetNode('JD1', 'C3', 'JP0', 'F8') PtSelectorTrue = SelectorPD(pt_descr_true, pt_rules_true) pt_result_true = PtSelectorTrue.do() DcbSelectorTrue = SelectorPD(dcb_descr_true, dcb_rules_true) dcb_result_true = DcbSelectorTrue.do() # See if we have any unused rule # for rule in pt_rules+dcb_rules: # print('The rule {} has been used {} times'.format( # rule.__class__.__name__, rule.counter)) write_to_csv(pt_true_output_filename, pt_result_true, csv_line) write_to_csv(dcb_true_output_filename, dcb_result_true, csv_line) ############################################### # Generate True-type backplane auxiliary list # ############################################### pt_result_true_depop_aux = aux_dict_gen(pt_result_true) write_to_file(pt_result_true_depop_aux_output_filename, aux_output_gen(pt_result_true_depop_aux, 'Aux PT list for True-type')) ########################
row.reverse() comet_dcb_data.append(row) ################# # Output to csv # ################# # Debug: COMET -> COMET DB -> COMET ############################################ comet_j1_j2_fpga_data = [('-'.join(k), '-'.join(v)) for k, v in comet_j1_j2_to_fpga.items()] comet_j1_j2_fpga_data.sort(key=lambda x: re.sub(r'-(\d)$', r'-0\g<1>', x[0])) write_to_csv(debug_comet_mapping_filename, comet_j1_j2_fpga_data, ['COMET connector', 'COMET FPGA']) # Debug: DCB -> Pathfinder ##################################################### dcb_gbtxs_path_finder_comet_data = [ (dcb_ref[k], '-'.join(k), '-'.join(v)) for k, v in dcb_gbtxs_to_path_finder_comet.items() ] # Make sure '1' appears before '10' and '11' dcb_gbtxs_path_finder_comet_data.sort( key=lambda x: re.sub(r'CH(\d)_', r'CH0\g<1>_', x[0])) write_to_csv(debug_dcb_path_finder_mapping_filename, dcb_gbtxs_path_finder_comet_data, ['Signal ID', 'DCB data GBTx pin', 'Pathfinder COMET connector'])
elif (elk_data[3000]['dcb_idx'] != '11' or elk_data[3000]['DC_OUT_RCLK'] != '0' or elk_data[3000]['stv_bp'] != 'X-2-S' or elk_data[3000]['stv_ut'] != 'UTbX_6A' or elk_data[3000]['bp_var'] != 'beta' or elk_data[3000]['bp_idx'] != 'middle' or elk_data[3000]['bp_type'] != 'm'): raise ValueError('Unit test failed: {}'.format(elk_data[3000])) # Write to csv else: write_to_csv( mapping_output_filename, elk_data, { 'PEPI': 'pepi', 'Stave': 'stv_ut', 'Flex': 'stv_bp', 'Hybrid': 'hybrid', 'ASIC index': 'asic_idx', 'BP variant (alpha/beta/gamma)': 'bp_var', 'BP index (inner/middle/outer)': 'bp_idx', 'BP type (true/mirrored)': 'bp_type', 'DCB index': 'dcb_idx', 'GBTx index': 'gbtx_idx', 'GBTx channels (GBT frame bytes)': 'gbtx_chs', 'DC_OUT_RCLK': 'DC_OUT_RCLK', 'MC_TFC': 'MC_TFC', 'EC_HYB_I2C_SCL': 'EC_HYB_I2C_SCL', 'EC_HYB_I2C_SDA': 'EC_HYB_I2C_SDA', 'EC_RESET_GPIO': 'EC_RESET_GPIO', 'EC_ADC': 'EC_ADC' })