add more methods to acquire physical truth table from physical pb

This commit is contained in:
tangxifan 2020-02-25 21:21:44 -07:00
parent ca038857d3
commit 2dd80e4830
4 changed files with 18 additions and 0 deletions

View File

@ -86,5 +86,10 @@ void VprClusteringAnnotation::add_physical_pb(const ClusterBlockId& block_id,
physical_pbs_[block_id] = physical_pb;
}
PhysicalPb& VprClusteringAnnotation::mutable_physical_pb(const ClusterBlockId& block_id) {
VTR_ASSERT(physical_pbs_.end() != physical_pbs_.find(block_id));
return physical_pbs_.at(block_id);
}
} /* End namespace openfpga*/

View File

@ -41,6 +41,7 @@ class VprClusteringAnnotation {
const ClusterNetId& net_id);
void adapt_truth_table(t_pb* pb, const AtomNetlist::TruthTable& tt);
void add_physical_pb(const ClusterBlockId& block_id, const PhysicalPb& physical_pb);
PhysicalPb& mutable_physical_pb(const ClusterBlockId& block_id);
private: /* Internal data */
/* Pair a regular pb_type to its physical pb_type */
std::map<ClusterBlockId, std::map<int, ClusterNetId>> net_names_;

View File

@ -16,6 +16,17 @@ PhysicalPb::physical_pb_range PhysicalPb::pbs() const {
return vtr::make_range(pb_ids_.begin(), pb_ids_.end());
}
std::vector<PhysicalPbId> PhysicalPb::primitive_pbs() const {
std::vector<PhysicalPbId> results;
/* The primitive pbs are those without any children */
for (auto pb : pbs()) {
if (true == child_pbs_[pb].empty()) {
results.push_back(pb);
}
}
return results;
}
std::string PhysicalPb::name(const PhysicalPbId& pb) const {
VTR_ASSERT(true == valid_pb_id(pb));
return names_[pb];

View File

@ -39,6 +39,7 @@ class PhysicalPb {
typedef vtr::Range<physical_pb_iterator> physical_pb_range;
public: /* Public aggregators */
physical_pb_range pbs() const;
std::vector<PhysicalPbId> primitive_pbs() const;
std::string name(const PhysicalPbId& pb) const;
PhysicalPbId find_pb(const t_pb_graph_node* name) const;
PhysicalPbId parent(const PhysicalPbId& pb) const;