From b720b49eb16f569de26c645782f281d24c3b049a Mon Sep 17 00:00:00 2001 From: tangxifan Date: Fri, 21 Oct 2022 11:48:09 -0700 Subject: [PATCH 1/3] [lib] now count pcf errors --- libs/libpcf/src/base/pcf_data.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/libs/libpcf/src/base/pcf_data.cpp b/libs/libpcf/src/base/pcf_data.cpp index e4a036666..41043d04e 100644 --- a/libs/libpcf/src/base/pcf_data.cpp +++ b/libs/libpcf/src/base/pcf_data.cpp @@ -70,6 +70,7 @@ bool PcfData::validate() const { VTR_LOG_ERROR("Pin '%s[%lu]' is assigned to two nets '%s' and '%s'!\n", curr_pin.get_name().c_str(), curr_pin.get_lsb(), result->second.c_str(), curr_net.c_str()); + num_err++; } pin2net[curr_pin] = curr_net; } From 0999c9444b759beb1db21461f274593340f55b63 Mon Sep 17 00:00:00 2001 From: tangxifan Date: Fri, 21 Oct 2022 12:44:56 -0700 Subject: [PATCH 2/3] [lib] remove debugging messages --- libs/libpcf/src/base/pcf_data.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libs/libpcf/src/base/pcf_data.cpp b/libs/libpcf/src/base/pcf_data.cpp index 41043d04e..f4505b539 100644 --- a/libs/libpcf/src/base/pcf_data.cpp +++ b/libs/libpcf/src/base/pcf_data.cpp @@ -60,11 +60,12 @@ bool PcfData::validate() const { net2pin[curr_net] = curr_pin; } /* We should not have duplicated pins in assignment: 1 pin -> 2 nets */ - std::map pin2net; + /* Caution: must use constant pointer here, otherwise you may see duplicated key on BasicPort with different content! */ + std::map pin2net; for (const PcfIoConstraintId& io_id : io_constraints()) { std::string curr_net = io_constraint_nets_[io_id]; - BasicPort curr_pin = io_constraint_pins_[io_id]; - auto result = pin2net.find(curr_pin); + const BasicPort& curr_pin = io_constraint_pins_[io_id]; + auto result = pin2net.find(&curr_pin); if (result != pin2net.end()) { /* Found one pin assigned to two nets, this is definitely an error */ VTR_LOG_ERROR("Pin '%s[%lu]' is assigned to two nets '%s' and '%s'!\n", @@ -72,7 +73,7 @@ bool PcfData::validate() const { result->second.c_str(), curr_net.c_str()); num_err++; } - pin2net[curr_pin] = curr_net; + pin2net[&curr_pin] = curr_net; } if (num_err) { return false; From 2d428269195fd4498ed689e5fae5025f22d3d396 Mon Sep 17 00:00:00 2001 From: tangxifan Date: Fri, 21 Oct 2022 13:03:03 -0700 Subject: [PATCH 3/3] [lib] code format --- libs/libpcf/src/base/pcf_data.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libs/libpcf/src/base/pcf_data.cpp b/libs/libpcf/src/base/pcf_data.cpp index f4505b539..46b624b47 100644 --- a/libs/libpcf/src/base/pcf_data.cpp +++ b/libs/libpcf/src/base/pcf_data.cpp @@ -60,7 +60,8 @@ bool PcfData::validate() const { net2pin[curr_net] = curr_pin; } /* We should not have duplicated pins in assignment: 1 pin -> 2 nets */ - /* Caution: must use constant pointer here, otherwise you may see duplicated key on BasicPort with different content! */ + /* Caution: must use constant pointer here, otherwise you may see duplicated + * key on BasicPort with different content! */ std::map pin2net; for (const PcfIoConstraintId& io_id : io_constraints()) { std::string curr_net = io_constraint_nets_[io_id];