| 680 | } // namespace |
| 681 | |
| 682 | void PlaceDB::buildChain() { |
| 683 | const Design &design = db_->design(); |
| 684 | const Layout &layout = db_->layout(); |
| 685 | auto top_module_inst = design.topModuleInst(); |
| 686 | auto const &netlist = top_module_inst->netlist(); |
| 687 | const std::string &module_name = place_params_.carry_chain_module_name_; |
| 688 | Design::IndexType module_id = design.modelId(module_name); |
| 689 | openparfAssert(module_id != std::numeric_limits<decltype(module_id)>::max()); |
| 690 | IndexType num_inst = netlist.numInsts(); |
| 691 | IndexType count = 0; |
| 692 | std::vector<bool> visited_mark(num_inst, false); |
| 693 | auto IsVisited = [&visited_mark](const Inst &inst) -> bool { return visited_mark[inst.id()] == true; }; |
| 694 | auto IsChain = [&module_id](const Inst &inst) -> bool { return inst.attr().modelId() == module_id; }; |
| 695 | |
| 696 | chain_insts_.clear(); |
| 697 | |
| 698 | openparfPrint(kDebug, "carry_chain_module_name: %s(%i)\n", module_name.c_str(), module_id); |
| 699 | |
| 700 | for (IndexType old_inst_id : new2old_inst_ids_) { |
| 701 | const Inst &inst = netlist.inst(old_inst_id); |
| 702 | std::vector<IndexType> chain_old_inst_ids; |
| 703 | if (!IsChain(inst) || IsVisited(inst)) continue; |
| 704 | chain_old_inst_ids = ExtractChainFromOneInst(*this, visited_mark, module_id, inst); |
| 705 | chain_insts_.pushBackIndexBegin(count); |
| 706 | for (auto const &old_inst_id : chain_old_inst_ids) { |
| 707 | auto new_inst_id = old2new_inst_ids_[old_inst_id]; |
| 708 | chain_insts_.pushBack(new_inst_id); |
| 709 | } |
| 710 | count += chain_old_inst_ids.size(); |
| 711 | } |
| 712 | |
| 713 | // dump the extracted carry chain. |
| 714 | if (false) { |
| 715 | std::ofstream of("carry_chain.txt"); |
| 716 | for (int i = 0; i < chain_insts_.size1(); i++) { |
| 717 | for (int j = 0; j < chain_insts_.size2(i); j++) { |
| 718 | auto new_inst_id = chain_insts_.at(i, j); |
| 719 | auto old_inst_id = new2old_inst_ids_[new_inst_id]; |
| 720 | const Inst &inst = netlist.inst(old_inst_id); |
| 721 | of << inst.attr().name() << "(" << new_inst_id << ") "; |
| 722 | } |
| 723 | of << std::endl; |
| 724 | } |
| 725 | of.close(); |
| 726 | } |
| 727 | } |
| 728 | |
| 729 | void PlaceDB::buildResource2AreaTypeMapping() { |
| 730 | auto const &design = db_->design(); |
nothing calls this directly
no test coverage detected