@@ -4218,4 +4218,94 @@ void DbMarkerDescriptor::paintMarker(odb::dbMarker* marker,
42184218 }
42194219}
42204220
4221+ // ////////////////////////////////////////////////
4222+
4223+ DbScanInstDescriptor::DbScanInstDescriptor (odb::dbDatabase* db)
4224+ : BaseDbDescriptor<odb::dbScanInst>(db)
4225+ {
4226+ }
4227+
4228+ std::string DbScanInstDescriptor::getName (std::any object) const
4229+ {
4230+ auto * scan_inst = std::any_cast<odb::dbScanInst*>(object);
4231+ auto * inst = scan_inst->getInst ();
4232+ return " (Scan) " + inst->getName ();
4233+ }
4234+
4235+ std::string DbScanInstDescriptor::getTypeName () const
4236+ {
4237+ return " Scan Inst" ;
4238+ }
4239+
4240+ bool DbScanInstDescriptor::getBBox (std::any object, odb::Rect& bbox) const
4241+ {
4242+ auto * scan_inst = std::any_cast<odb::dbScanInst*>(object);
4243+ auto * inst = scan_inst->getInst ();
4244+ bbox = inst->getBBox ()->getBox ();
4245+ return true ;
4246+ }
4247+
4248+ void DbScanInstDescriptor::highlight (std::any object, Painter& painter) const
4249+ {
4250+ auto * scan_inst = std::any_cast<odb::dbScanInst*>(object);
4251+ auto * inst_descriptor = Gui::get ()->getDescriptor <odb::dbInst*>();
4252+ inst_descriptor->highlight (scan_inst->getInst (), painter);
4253+ }
4254+
4255+ bool DbScanInstDescriptor::getAllObjects (SelectionSet& objects) const
4256+ {
4257+ auto * block = db_->getChip ()->getBlock ();
4258+ auto * db_dft = block->getDft ();
4259+
4260+ for (auto * scan_chain : db_dft->getScanChains ()) {
4261+ for (auto * scan_partition : scan_chain->getScanPartitions ()) {
4262+ for (auto * scan_list : scan_partition->getScanLists ()) {
4263+ for (auto * scan_inst : scan_list->getScanInsts ()) {
4264+ objects.insert (makeSelected (scan_inst));
4265+ }
4266+ }
4267+ }
4268+ }
4269+
4270+ return true ;
4271+ }
4272+
4273+ Descriptor::Properties DbScanInstDescriptor::getDBProperties (
4274+ odb::dbScanInst* scan_inst) const
4275+ {
4276+ Properties props;
4277+
4278+ props.push_back ({" Scan Clock" , scan_inst->getScanClock ()});
4279+ props.push_back ({" Clock Edge" , scan_inst->getClockEdgeString ()});
4280+ props.push_back (getScanPinProperty (" Enable" , scan_inst->getScanEnable ()));
4281+
4282+ PropertyList access_pins_props;
4283+ odb::dbScanInst::AccessPins access_pins = scan_inst->getAccessPins ();
4284+ Property scan_in_prop = getScanPinProperty (" In" , access_pins.scan_in );
4285+ access_pins_props.push_back ({scan_in_prop.name , scan_in_prop.value });
4286+ Property scan_out_prop = getScanPinProperty (" Out" , access_pins.scan_out );
4287+ access_pins_props.push_back ({scan_out_prop.name , scan_out_prop.value });
4288+ props.push_back ({" Access Pins" , access_pins_props});
4289+
4290+ auto gui = Gui::get ();
4291+ props.push_back ({" Inst" , gui->makeSelected (scan_inst->getInst ())});
4292+
4293+ return props;
4294+ }
4295+
4296+ /* static */
4297+ Descriptor::Property DbScanInstDescriptor::getScanPinProperty (
4298+ const std::string& name,
4299+ const std::variant<odb::dbBTerm*, odb::dbITerm*>& pin)
4300+ {
4301+ Descriptor::Property property;
4302+ property.name = name;
4303+
4304+ auto gui = Gui::get ();
4305+ std::visit ([&](auto * term) { property.value = gui->makeSelected (term); },
4306+ pin);
4307+
4308+ return property;
4309+ }
4310+
42214311} // namespace gui
0 commit comments