@@ -65,7 +65,7 @@ static void check_cluster_atom_blocks(t_pb* pb, std::unordered_set<AtomBlockId>&
65
65
const AtomContext& atom_ctx = g_vpr_ctx.atom ();
66
66
67
67
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 () ) {
69
69
/* primitive */
70
70
AtomBlockId blk_id = atom_pb_lookup.pb_atom (pb);
71
71
if (blk_id) {
@@ -396,7 +396,7 @@ static bool primitive_memory_sibling_feasible(const AtomBlockId blk_id, const t_
396
396
static bool primitive_feasible (const AtomBlockId blk_id, t_pb* cur_pb, const AtomPBBimap& atom_to_pb) {
397
397
const t_pb_type* cur_pb_type = cur_pb->pb_graph_node ->pb_type ;
398
398
399
- VTR_ASSERT (cur_pb_type->num_modes == 0 ); /* primitive */
399
+ VTR_ASSERT (cur_pb_type->is_primitive () ); /* primitive */
400
400
401
401
AtomBlockId cur_pb_blk_id = atom_to_pb.pb_atom (cur_pb);
402
402
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,
511
511
return e_block_pack_status::BLK_FAILED_FEASIBLE;
512
512
}
513
513
514
- bool is_primitive = (pb_type->num_modes == 0 );
515
-
516
- if (is_primitive) {
514
+ if (pb_type->is_primitive ()) {
517
515
VTR_ASSERT (!atom_to_pb.pb_atom (pb)
518
516
&& atom_to_pb.atom_pb (blk_id) == nullptr
519
517
&& atom_cluster[blk_id] == LegalizationClusterId::INVALID ());
@@ -576,7 +574,7 @@ static void reset_lookahead_pins_used(t_pb* cur_pb) {
576
574
return ; /* No pins used, no need to continue */
577
575
}
578
576
579
- if (pb_type->num_modes > 0 && cur_pb->name != nullptr ) {
577
+ if (! pb_type->is_primitive () && cur_pb->name != nullptr ) {
580
578
for (int i = 0 ; i < cur_pb->pb_graph_node ->num_input_pin_class ; i++) {
581
579
cur_pb->pb_stats ->lookahead_input_pins_used [i].clear ();
582
580
}
@@ -821,7 +819,7 @@ static void try_update_lookahead_pins_used(t_pb* cur_pb,
821
819
const AtomPBBimap& atom_to_pb) {
822
820
// run recursively till a leaf (primitive) pb block is reached
823
821
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 ) {
825
823
if (cur_pb->child_pbs != nullptr ) {
826
824
for (int i = 0 ; i < pb_type->modes [cur_pb->mode ].num_pb_type_children ; i++) {
827
825
if (cur_pb->child_pbs [i] != nullptr ) {
@@ -835,6 +833,7 @@ static void try_update_lookahead_pins_used(t_pb* cur_pb,
835
833
// find if this child (primitive) pb block has an atom mapped to it,
836
834
// if yes compute and mark lookahead pins used for that pb block
837
835
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?
838
837
if (pb_type->blif_model != nullptr && blk_id) {
839
838
compute_and_mark_lookahead_pins_used (blk_id, atom_cluster, atom_to_pb);
840
839
}
@@ -848,7 +847,7 @@ static void try_update_lookahead_pins_used(t_pb* cur_pb,
848
847
static bool check_lookahead_pins_used (t_pb* cur_pb, t_ext_pin_util max_external_pin_util) {
849
848
const t_pb_type* pb_type = cur_pb->pb_graph_node ->pb_type ;
850
849
851
- if (pb_type->num_modes > 0 && cur_pb->name ) {
850
+ if (! pb_type->is_primitive () && cur_pb->name ) {
852
851
for (int i = 0 ; i < cur_pb->pb_graph_node ->num_input_pin_class ; i++) {
853
852
size_t class_size = cur_pb->pb_graph_node ->input_pin_class_size [i];
854
853
@@ -1015,7 +1014,7 @@ static void revert_place_atom_block(const AtomBlockId blk_id,
1015
1014
static void commit_lookahead_pins_used (t_pb* cur_pb) {
1016
1015
const t_pb_type* pb_type = cur_pb->pb_graph_node ->pb_type ;
1017
1016
1018
- if (pb_type->num_modes > 0 && cur_pb->name ) {
1017
+ if (! pb_type->is_primitive () && cur_pb->name ) {
1019
1018
for (int i = 0 ; i < cur_pb->pb_graph_node ->num_input_pin_class ; i++) {
1020
1019
VTR_ASSERT (cur_pb->pb_stats ->lookahead_input_pins_used [i].size () <= (unsigned int )cur_pb->pb_graph_node ->input_pin_class_size [i]);
1021
1020
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) {
1076
1075
t_pb_type* pb_type = pb_child->pb_graph_node ->pb_type ;
1077
1076
1078
1077
/* Primitive, check occupancy */
1079
- if (pb_type->num_modes == 0 ) {
1078
+ if (pb_type->is_primitive () ) {
1080
1079
if (pb_child->name != nullptr ) {
1081
1080
can_free = false ;
1082
1081
}
0 commit comments