Skip to content

Commit 974af1f

Browse files
committed
add comment
1 parent 95e5f35 commit 974af1f

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

libs/librrgraph/src/io/rr_graph_reader.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ void load_rr_file(RRGraphBuilder* rr_graph_builder,
8787
rr_graph_builder->set_tileable(true);
8888
}
8989

90+
// If Cap'n Proto is enabled, a unique ID is assigned to the schema used to serialize the RR graph.
91+
// This ID is used to verify that the schema used to serialize the RR graph matches the
92+
// schema being used to deserialize it.
93+
// If Cap'n Proto is not enabled, the schema ID is 0 and no schema ID check is performed.
9094
unsigned long schema_file_id = 0;
9195
#ifdef VTR_ENABLE_CAPNPROTO
9296
::capnp::Schema schema = ::capnp::Schema::from<ucap::RrGraph>();

libs/librrgraph/src/io/rr_graph_uxsdcxx_serializer.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1730,8 +1730,11 @@ class RrGraphSerializer final : public uxsd::RrGraphBase<RrGraphContextTypes> {
17301730
* </xs:complexType>
17311731
*/
17321732
inline void set_rr_graph_schema_file_id(unsigned long schema_file_id, void*& /*ctx*/) final {
1733-
// Only check if the schema file ID is not 0. If it is 0, it means capnproto is not enabled.
1734-
// Thus, we cannot check the schema file ID mismatch.
1733+
// Only check if schema_file_id_ (set when initializing the class) is not 0.
1734+
// If it is 0, it means Cap'n Proto is not enabled, so we cannot check for a schema file ID mismatch.
1735+
// This function is only called when the RR graph file being read contains a schema file ID.
1736+
// If it does not, this function is not called, and the RR graph can be read without performing
1737+
// the schema file ID check.
17351738
if (schema_file_id_ != 0) {
17361739
if (schema_file_id != schema_file_id_) {
17371740
report_error(

libs/librrgraph/src/io/rr_graph_writer.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ void write_rr_graph(RRGraphBuilder* rr_graph_builder,
4141
const int route_verbosity,
4242
bool is_flat) {
4343

44+
// If Cap'n Proto is enabled, a unique ID is assigned to the schema used to serialize the RR graph.
45+
// This ID is used to verify that the schema used to serialize the RR graph matches the
46+
// schema being used to deserialize it.
47+
// If Cap'n Proto is not enabled, the schema ID is 0 and no schema ID check is performed.
4448
unsigned long schema_file_id = 0;
4549
#ifdef VTR_ENABLE_CAPNPROTO
4650
::capnp::Schema schema = ::capnp::Schema::from<ucap::RrGraph>();

0 commit comments

Comments
 (0)