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