def labelITerm(iterm, pin_name, iotype, all_shapes_flag=False): net_name = pin_name net = chip_block.findNet(net_name) if net is None: net = odb.dbNet_create(chip_block, net_name) pin_bterm = chip_block.findBTerm(pin_name) if pin_bterm is None: pin_bterm = odb.dbBTerm_create(net, pin_name) assert pin_bterm is not None, "Failed to create or find " + pin_name pin_bterm.setIoType(iotype) pin_bpin = odb.dbBPin_create(pin_bterm) pin_bpin.setPlacementStatus("PLACED") if not all_shapes_flag: boxes = getBiggestBox(pad_iterm) else: boxes = getAllBoxes(pad_iterm) for box in boxes: layer, ll, ur = box odb.dbBox_create(pin_bpin, layer, ll.getX(), ll.getY(), ur.getX(), ur.getY()) odb.dbITerm_connect(pad_iterm, net) pin_bterm.connect(net)
def insert_diode(self, it, src_pos): # Get information about the instance inst_cell = it.getInst().getMaster().getName() inst_name = it.getInst().getName() inst_pos = it.getInst().getLocation() # Find where the pin is px, py = self.pin_position(it) # Apply standard cell or macro placement ? if inst_cell.startswith('sky130_fd_sc_hd__'): # FIXME dx, dy, do = self.place_diode_stdcell(it, px, py, src_pos) else: dx, dy, do = self.place_diode_macro(it, px, py, src_pos) # Insert instance and wire it up diode_inst_name = 'ANTENNA_' + inst_name + '_' + it.getMTerm( ).getConstName() diode_inst = odb.dbInst_create(self.block, self.diode_master, diode_inst_name) diode_inst.setOrient(do) diode_inst.setLocation(dx, dy) diode_inst.setPlacementStatus('PLACED') ait = diode_inst.findITerm(self.cfg['diode_cell_pin']) odb.dbITerm_connect(ait, it.getNet())
def insert_diode(self, it, src_pos, force_true=False): # Get information about the instance inst = it.getInst() inst_cell = inst.getMaster().getConstName() inst_name = inst.getConstName() inst_pos = inst.getLocation() inst_site = inst.getMaster().getSite().getConstName() if ( inst.getMaster().getSite() is not None) else None # Find where the pin is px, py = self.pin_position(it) # Apply standard cell or macro placement ? if inst_site == self.diode_site: dx, dy, do = self.place_diode_stdcell(it, px, py, src_pos) else: dx, dy, do = self.place_diode_macro(it, px, py, src_pos) # Insert instance and wire it up diode_inst_name = 'ANTENNA_' + inst_name + '_' + it.getMTerm( ).getConstName() diode_master = self.true_diode_master if force_true else self.diode_master diode_inst = odb.dbInst_create(self.block, diode_master, diode_inst_name) diode_inst.setOrient(do) diode_inst.setLocation(dx, dy) diode_inst.setPlacementStatus('PLACED') ait = diode_inst.findITerm(self.diode_pin) odb.dbITerm_connect(ait, it.getNet())
pin_bterm = chip_block.findBTerm(pin_name) if pin_bterm is None: pin_bterm = odb.dbBTerm_create(net, pin_name) assert pin_bterm is not None, "Failed to create or find " + pin_name pin_bterm.setIoType(iotype) # x = odb.new_intp(); y = odb.new_intp() # pad_iterm.getAvgXY(x, y); # crashes with clamps # x = odb.intp_value(x); y = odb.intp_value(y) pin_bpin = odb.dbBPin_create(pin_bterm) pin_bpin.setPlacementStatus("PLACED") odb.dbBox_create(pin_bpin, pad_pin_layer, ll.getX(), ll.getY(), ur.getX(), ur.getY()) odb.dbITerm_connect(pad_iterm, net) pin_bterm.connect(net) labeled.append(inst_name) assert labeled_count == pad_pins_to_label_count, ("Didn't label what I set out to label %d/%d" % (labeled_count, pad_pins_to_label_count), set(pad_pin_map.keys())-set(labeled)) print("Writing", output_def_file_name) odb.write_def(chip_block, output_def_file_name)
# print(to_connect) nets_macro = block_macro.getNets() created_macros = {} for net in nets_macro: iterms = net.getITerms() # asssumption: no pins (bterms) on top level if not keep_flag: for iterm in iterms: odb.dbITerm_disconnect(iterm) if net.getName() in to_connect: for node_iterm in to_connect[net.getName()]: node_master = node_iterm.getMTerm().getMaster() node_inst = node_iterm.getInst() node_inst_name = node_iterm.getInst().getName() if node_inst_name not in created_macros: created_macros[node_inst_name] = 1 print("Creating: ", node_master.getName(), node_inst_name) new_inst = odb.dbInst_create(block_macro, node_master, node_inst_name) new_inst.setOrient(node_inst.getOrient()) new_inst.setLocation( node_inst.getLocation()[0] - MACRO_TOP_PLACEMENT_X, node_inst.getLocation()[1] - MACRO_TOP_PLACEMENT_Y) new_inst.setPlacementStatus("FIRM") else: new_inst = block_macro.findInst(node_inst_name) odb.dbITerm_connect( new_inst.findITerm(node_iterm.getMTerm().getName()), net) odb.write_def(block_macro, output_def_file_name)
sys.exit(1) if len(VDD_ITERMS) > 2: print("Warning: cell", cell_name, "has", len(VDD_ITERMS), "power pins.") if len(GND_ITERMS) > 2: print("Warning: cell", cell_name, "has", len(GND_ITERMS), "ground pins.") for VDD_ITERM in VDD_ITERMS: if VDD_ITERM.isConnected(): pin_name = VDD_ITERM.getMTerm().getName() cell_name = cell_name print("Warning: power pin", pin_name, "of", cell_name, "is already connected") print("Warning: ignoring", cell_name + "/" + pin_name, "!!!!!!!") else: odb.dbITerm_connect(VDD_ITERM, DEFAULT_VDD) for GND_ITERM in GND_ITERMS: if GND_ITERM.isConnected(): pin_name = GND_ITERM.getMTerm().getName() cell_name = cell_name print("Warning: ground pin", pin_name, "of", cell_name, "is already connected") print("Warning: ignoring", cell_name + "/" + pin_name, "!!!!!!!") else: odb.dbITerm_connect(GND_ITERM, DEFAULT_GND) modified_cells += 1 print("Modified power connections of", modified_cells, "cells (Remaining:", len(cells)-modified_cells, ").")
print("Warning: not all power pins found for cell:", cell.getName()) if ignore_missing_pins: print("Warning: ignoring", cell.getName(), "!!!!!!!") continue else: print("Exiting... Use --ignore-missing-pins to ignore such errors") sys.exit(1) for VDD_ITERM in VDD_ITERMS: if VDD_ITERM.isConnected(): pin_name = VDD_ITERM.getMTerm().getName() cell_name = cell.getName() print("Warning: power pin", pin_name, "of", cell_name, "is already connected") print("Warning: ignoring", cell_name + "/" + pin_name, "!!!!!!!") else: odb.dbITerm_connect(VDD_ITERM, VDD) for GND_ITERM in GND_ITERMS: if GND_ITERM.isConnected(): pin_name = GND_ITERM.getMTerm().getName() cell_name = cell.getName() print("Warning: ground pin", pin_name, "of", cell_name, "is already connected") print("Warning: ignoring", cell_name + "/" + pin_name, "!!!!!!!") else: odb.dbITerm_connect(GND_ITERM, GND) modified_cells += 1 print("Modified power connections of", modified_cells, "cells (Remaining:", len(cells)-modified_cells, ").")