def process(self, data, jp): net_name = data['DCB slot'] + '_' + jp + '_' + data['Signal ID'] return ( NetNode(DCB=data['DCB slot'], DCB_PIN=data['SEAM pin'], PT=jp, PT_PIN=data['Pigtail pin'] ), self.prop_gen(net_name, data['Note']))
def process(self, data, jd): net_name = jd + '_' + data['Pigtail slot'] + '_' + data['Signal ID'] return ( NetNode(DCB=jd, DCB_PIN=data['SEAM pin'], PT=data['Pigtail slot'], PT_PIN=data['Pigtail pin'] ), self.prop_gen(net_name))
def test_multiple_nodes(self): nodes_dict = { NetNode('JD1', 'A1'): { 'NETNAME': 'JD1_JPL1_unreal', 'ATTR': None }, NetNode('JD2', 'A2', 'JP1', 'A1'): { 'NETNAME': 'JD2_JP1_unreal', 'ATTR': None }, } self.assertEqual( dict(netnode_to_netlist(nodes_dict)), { 'JD1_JPL1_unreal': [('JD1', 'A1')], 'JD2_JP1_unreal': [('JD2', 'A2'), ('JP1', 'A1')], })
def process(self, data, jd): if 'SEC_DIN' in data['Signal ID'] or 'EC_SEC_CLK' in data['Signal ID']: net_name = jd + '_SEC_ELK_' + data['Signal ID'][-1] else: net_name = jd + '_ELK_' + data['Signal ID'][-1] return ( NetNode(DCB=jd, DCB_PIN=data['SEAM pin']), self.prop_gen(net_name, attr='_FRO_'))
def test_dcb_pt_node(self): nodes_dict = { NetNode('JD1', 'A1', 'JP1', 'A1'): { 'NETNAME': 'JD1_JP1_unreal', 'ATTR': None } } self.assertEqual(dict(netnode_to_netlist(nodes_dict)), {'JD1_JP1_unreal': [('JD1', 'A1'), ('JP1', 'A1')]})
def process(self, data, jd): net_name = jd + '_' + 'AGND' return ( NetNode(DCB=jd, DCB_PIN=data['SEAM pin'], PT=data['Pigtail slot'] if data['Pigtail slot'] is not None else None, PT_PIN=data['Pigtail pin'] if data['Pigtail pin'] is not None else None ), self.prop_gen(net_name))
def test_with_dummy(self): self.maxDiff = None dataset = {0: (1, 2, 3), 1: (1, 2)} rule = RulePDDummy() selector = SelectorPD(dataset, [rule]) result = selector.do() self.assertEqual( result, { NetNode(1, 1): { 'NETNAME': 1, 'NOTE': None, 'ATTR': None }, NetNode(1, 2): { 'NETNAME': 2, 'NOTE': None, 'ATTR': None }, })
def process(self, data, jp): dcb_name, tail = data['Signal ID'].split('_', 1) if 'EC_ADC' in data['Signal ID']: # Becuase EC_ADC connects to Thermistor, add prefix THERM net_name = dcb_name + '_' + jp + '_THERM_' + tail else: net_name = dcb_name + '_' + jp + '_' + tail return ( NetNode(PT=jp, PT_PIN=data['Pigtail pin'], DCB=data['DCB slot'], DCB_PIN=data['SEAM pin']), self.prop_gen(net_name, data['Note']))
def process(self, data, jp): net_name = jp + '_' + data['Signal ID'] attr = '_FRO_' for rule in self.rules: pt_name, tail = rule.split('_', 1) if jp == pt_name and data['Signal ID'] in tail: net_name = rule attr = None break return ( NetNode(PT=jp, PT_PIN=data['Pigtail pin']), self.prop_gen(net_name, data['Note'], attr))
def process(self, data, jd): if 'EC_ADC' in data['Signal ID']: # Becuase EC_ADC connects to Thermistor, add prefix THERM net_name = jd + '_' + data['Pigtail slot'] + '_THERM_' \ + data['Signal ID'] + '_P' else: net_name = jd + '_' + data['Pigtail slot'] + '_' \ + data['Signal ID'] + '_P' return ( NetNode(DCB=jd, DCB_PIN=data['SEAM pin'], PT=data['Pigtail slot'], PT_PIN=data['Pigtail pin'] ), self.prop_gen(net_name))
def process(self, data, jd): jp = jd.replace('D', 'P') signal = data['Signal ID'] if 'REF13' in signal: jp_pin = 'A16' net_name = jp + jp_pin + '_' + 'P3_LV_SENSE_GND' elif 'REF14' in signal: jp_pin = 'J24' net_name = jp + jp_pin + '_' + 'P1_WEST_LV_SENSE_GND' elif 'REF15' in signal: # NOTE: This is a special case, because in the netname, the pin # number is padded! jp_pin = 'F5' net_name = jp + 'F05' + '_' + 'P2_EAST_LV_SENSE_GND' else: raise ValueError( 'EC_ADC_REF: {} detected but not belongs to any known case'.format( signal )) return ( NetNode(DCB=jd, DCB_PIN=data['SEAM pin'], PT=jp, PT_PIN=jp_pin), self.prop_gen(net_name))
def test_debug(self): dataset = { NetNode('JD1', 'A1'): 1, NetNode('JD2', 'A1'): 1, NetNode('JD2', 'A3'): 1, NetNode('JD5', 'A6'): 1, } rule = RuleNetDummy({}, {}, {}) rule.debug_node = NetNode('JD5', 'A6') selector = SelectorNet(dataset, [rule]) result = selector.do() self.assertEqual(result['Test'], [ 'Node: DCB: JD1, DCB_PIN: A1, PT: None, PT_PIN: None', 'Node: DCB: JD2, DCB_PIN: A1, PT: None, PT_PIN: None', 'Node: DCB: JD2, DCB_PIN: A3, PT: None, PT_PIN: None', 'Node: DCB: JD5, DCB_PIN: A6, PT: None, PT_PIN: None' ]) self.assertEqual( rule.last_debug_msg, 'Node ' + RuleNet.node_to_str(NetNode('JD5', 'A6')) + ' is being handled by: RuleNetDummy')
def process(self, data, idx): return (NetNode(DCB=idx, DCB_PIN=data), self.prop_gen(netname=data))
def test_entry_with_attr(self): entry = NetNode('2', '3', '4', '5') self.assertEqual(csv_line(entry, { 'NETNAME': 'A_B', 'ATTR': '_C_' }), 'A_C_B,2,3,4,5')
def process(self, data, jp): return ( NetNode(PT=jp, PT_PIN=data['Pigtail pin']), self.prop_gen('GND', data['Note']))
def test_normal_entry(self): entry = NetNode(*[str(i) for i in range(1, 5)]) self.assertEqual(csv_line(entry, self.dummy_prop), 'NET,1,2,3,4')
def test_entry_with_none(self): entry = NetNode(*[str(i) for i in range(1, 4)], None) self.assertEqual(csv_line(entry, self.dummy_prop), 'NET,1,2,3,')
def process(self, data, jp): netname = jp + '_' + self.find_jt(jp) + '_' + data['Signal ID'].replace( 'THERMISTOR', 'THERM') return ( NetNode(PT=jp, PT_PIN=data['Pigtail pin']), self.prop_gen(netname, data['Note']))
def process(self, data, jp): net_name = jp + PADDING(data['Pigtail pin']) + '_' + data['Signal ID'] return ( NetNode(PT=jp, PT_PIN=data['Pigtail pin']), self.prop_gen(net_name, data['Note'], None))
def process(self, data, jd): net_name = jd + '_' + data['Signal ID'] return ( NetNode(DCB=jd, DCB_PIN=data['SEAM pin']), self.prop_gen(net_name, attr='_FRO_'))
def process(self, data, jd): return ( NetNode(DCB=jd, DCB_PIN=data['SEAM pin']), self.prop_gen('GND'))
def process(self, data, jd): # Note: here the matching nodes will have placeholder in netlist file. return ( NetNode(DCB=jd, DCB_PIN=data['SEAM pin']), self.prop_gen(None, attr='_PlaceHolder_'))
def process(self, data, jd): net_name = self.netname_replacement(jd, data['Signal ID']) return ( NetNode(DCB=jd, DCB_PIN=data['SEAM pin'],), self.prop_gen(net_name))
def process(self, data, jp): # Note: here the matching nodes will have placeholder in netlist file. return ( NetNode(PT=jp, PT_PIN=data['Pigtail pin']), self.prop_gen(None, data['Note'], '_PlaceHolder_'))