@@ -65,7 +65,7 @@ static void check_cluster_atom_blocks(t_pb* pb, std::unordered_set<AtomBlockId>&
6565 const AtomContext& atom_ctx = g_vpr_ctx.atom ();
6666
6767 const t_pb_type* pb_type = pb->pb_graph_node ->pb_type ;
68- if (pb_type->num_modes == 0 ) {
68+ if (pb_type->is_primitive () ) {
6969 /* primitive */
7070 AtomBlockId blk_id = atom_pb_lookup.pb_atom (pb);
7171 if (blk_id) {
@@ -396,7 +396,7 @@ static bool primitive_memory_sibling_feasible(const AtomBlockId blk_id, const t_
396396static bool primitive_feasible (const AtomBlockId blk_id, t_pb* cur_pb, const AtomPBBimap& atom_to_pb) {
397397 const t_pb_type* cur_pb_type = cur_pb->pb_graph_node ->pb_type ;
398398
399- VTR_ASSERT (cur_pb_type->num_modes == 0 ); /* primitive */
399+ VTR_ASSERT (cur_pb_type->is_primitive () ); /* primitive */
400400
401401 AtomBlockId cur_pb_blk_id = atom_to_pb.pb_atom (cur_pb);
402402 if (cur_pb_blk_id && cur_pb_blk_id != blk_id) {
@@ -511,9 +511,7 @@ try_place_atom_block_rec(const t_pb_graph_node* pb_graph_node,
511511 return e_block_pack_status::BLK_FAILED_FEASIBLE;
512512 }
513513
514- bool is_primitive = (pb_type->num_modes == 0 );
515-
516- if (is_primitive) {
514+ if (pb_type->is_primitive ()) {
517515 VTR_ASSERT (!atom_to_pb.pb_atom (pb)
518516 && atom_to_pb.atom_pb (blk_id) == nullptr
519517 && atom_cluster[blk_id] == LegalizationClusterId::INVALID ());
@@ -576,7 +574,7 @@ static void reset_lookahead_pins_used(t_pb* cur_pb) {
576574 return ; /* No pins used, no need to continue */
577575 }
578576
579- if (pb_type->num_modes > 0 && cur_pb->name != nullptr ) {
577+ if (! pb_type->is_primitive () && cur_pb->name != nullptr ) {
580578 for (int i = 0 ; i < cur_pb->pb_graph_node ->num_input_pin_class ; i++) {
581579 cur_pb->pb_stats ->lookahead_input_pins_used [i].clear ();
582580 }
@@ -821,7 +819,7 @@ static void try_update_lookahead_pins_used(t_pb* cur_pb,
821819 const AtomPBBimap& atom_to_pb) {
822820 // run recursively till a leaf (primitive) pb block is reached
823821 const t_pb_type* pb_type = cur_pb->pb_graph_node ->pb_type ;
824- if (pb_type->num_modes > 0 && cur_pb->name != nullptr ) {
822+ if (! pb_type->is_primitive () && cur_pb->name != nullptr ) {
825823 if (cur_pb->child_pbs != nullptr ) {
826824 for (int i = 0 ; i < pb_type->modes [cur_pb->mode ].num_pb_type_children ; i++) {
827825 if (cur_pb->child_pbs [i] != nullptr ) {
@@ -835,6 +833,7 @@ static void try_update_lookahead_pins_used(t_pb* cur_pb,
835833 // find if this child (primitive) pb block has an atom mapped to it,
836834 // if yes compute and mark lookahead pins used for that pb block
837835 AtomBlockId blk_id = atom_to_pb.pb_atom (cur_pb);
836+ // TODO: Primitive pb_types should have non-null blif_model. Shoud this be an assertion?
838837 if (pb_type->blif_model != nullptr && blk_id) {
839838 compute_and_mark_lookahead_pins_used (blk_id, atom_cluster, atom_to_pb);
840839 }
@@ -848,7 +847,7 @@ static void try_update_lookahead_pins_used(t_pb* cur_pb,
848847static bool check_lookahead_pins_used (t_pb* cur_pb, t_ext_pin_util max_external_pin_util) {
849848 const t_pb_type* pb_type = cur_pb->pb_graph_node ->pb_type ;
850849
851- if (pb_type->num_modes > 0 && cur_pb->name ) {
850+ if (! pb_type->is_primitive () && cur_pb->name ) {
852851 for (int i = 0 ; i < cur_pb->pb_graph_node ->num_input_pin_class ; i++) {
853852 size_t class_size = cur_pb->pb_graph_node ->input_pin_class_size [i];
854853
@@ -1015,7 +1014,7 @@ static void revert_place_atom_block(const AtomBlockId blk_id,
10151014static void commit_lookahead_pins_used (t_pb* cur_pb) {
10161015 const t_pb_type* pb_type = cur_pb->pb_graph_node ->pb_type ;
10171016
1018- if (pb_type->num_modes > 0 && cur_pb->name ) {
1017+ if (! pb_type->is_primitive () && cur_pb->name ) {
10191018 for (int i = 0 ; i < cur_pb->pb_graph_node ->num_input_pin_class ; i++) {
10201019 VTR_ASSERT (cur_pb->pb_stats ->lookahead_input_pins_used [i].size () <= (unsigned int )cur_pb->pb_graph_node ->input_pin_class_size [i]);
10211020 for (size_t j = 0 ; j < cur_pb->pb_stats ->lookahead_input_pins_used [i].size (); j++) {
@@ -1076,7 +1075,7 @@ static bool cleanup_pb(t_pb* pb) {
10761075 t_pb_type* pb_type = pb_child->pb_graph_node ->pb_type ;
10771076
10781077 /* Primitive, check occupancy */
1079- if (pb_type->num_modes == 0 ) {
1078+ if (pb_type->is_primitive () ) {
10801079 if (pb_child->name != nullptr ) {
10811080 can_free = false ;
10821081 }
0 commit comments