Skip to content

Commit 90b61d3

Browse files
committed
vpr: base: netlist writer: change access specifiers
Change access specifiers from private to protected for some members of NetlistWriterVisitor to make those visible in class that will derive from the visitor. Signed-off-by: Pawel Czarnecki <[email protected]>
1 parent 980b450 commit 90b61d3

File tree

1 file changed

+64
-56
lines changed

1 file changed

+64
-56
lines changed

vpr/src/base/netlist_writer.cpp

Lines changed: 64 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -883,7 +883,7 @@ class NetlistWriterVisitor : public NetlistVisitor {
883883
print_sdf();
884884
}
885885

886-
private: //Internal Helper functions
886+
protected: //Internal Helper functions
887887
///@brief Writes out the verilog netlist
888888
void print_verilog(int depth = 0) {
889889
verilog_os_ << indent(depth) << "//Verilog generated by VPR " << vtr::VERSION << " from post-place-and-route implementation\n";
@@ -957,6 +957,7 @@ class NetlistWriterVisitor : public NetlistVisitor {
957957
verilog_os_ << indent(depth) << "endmodule\n";
958958
}
959959

960+
private: //Internal Helper functions
960961
///@brief Writes out the blif netlist
961962
void print_blif(int depth = 0) {
962963
blif_os_ << indent(depth) << "#BLIF generated by VPR " << vtr::VERSION << " from post-place-and-route implementation\n";
@@ -1061,47 +1062,6 @@ class NetlistWriterVisitor : public NetlistVisitor {
10611062
sdf_os_ << indent(depth) << ")\n";
10621063
}
10631064

1064-
/**
1065-
* @brief Returns the name of a wire connecting a primitive and global net.
1066-
*
1067-
* The wire is recorded and instantiated by the top level output routines.
1068-
*/
1069-
std::string make_inst_wire(AtomNetId atom_net_id, ///<The id of the net in the atom netlist
1070-
tatum::NodeId tnode_id, ///<The tnode associated with the primitive pin
1071-
std::string inst_name, ///<The name of the instance associated with the pin
1072-
PortType port_type, ///<The port direction
1073-
int port_idx, ///<The instance port index
1074-
int pin_idx) { ///<The instance pin index
1075-
1076-
std::string wire_name = inst_name;
1077-
if (port_type == PortType::INPUT) {
1078-
wire_name = join_identifier(wire_name, "input");
1079-
} else if (port_type == PortType::CLOCK) {
1080-
wire_name = join_identifier(wire_name, "clock");
1081-
} else {
1082-
VTR_ASSERT(port_type == PortType::OUTPUT);
1083-
wire_name = join_identifier(wire_name, "output");
1084-
}
1085-
1086-
wire_name = join_identifier(wire_name, std::to_string(port_idx));
1087-
wire_name = join_identifier(wire_name, std::to_string(pin_idx));
1088-
1089-
auto value = std::make_pair(wire_name, tnode_id);
1090-
if (port_type == PortType::INPUT || port_type == PortType::CLOCK) {
1091-
//Add the sink
1092-
logical_net_sinks_[atom_net_id].push_back(value);
1093-
1094-
} else {
1095-
//Add the driver
1096-
VTR_ASSERT(port_type == PortType::OUTPUT);
1097-
1098-
auto ret = logical_net_drivers_.insert(std::make_pair(atom_net_id, value));
1099-
VTR_ASSERT(ret.second); //Was inserted, drivers are unique
1100-
}
1101-
1102-
return wire_name;
1103-
}
1104-
11051065
/**
11061066
* @brief Returns the name of a circuit-level Input/Output
11071067
*
@@ -1157,6 +1117,48 @@ class NetlistWriterVisitor : public NetlistVisitor {
11571117
return io_name;
11581118
}
11591119

1120+
protected:
1121+
/**
1122+
* @brief Returns the name of a wire connecting a primitive and global net.
1123+
*
1124+
* The wire is recorded and instantiated by the top level output routines.
1125+
*/
1126+
std::string make_inst_wire(AtomNetId atom_net_id, ///<The id of the net in the atom netlist
1127+
tatum::NodeId tnode_id, ///<The tnode associated with the primitive pin
1128+
std::string inst_name, ///<The name of the instance associated with the pin
1129+
PortType port_type, ///<The port direction
1130+
int port_idx, ///<The instance port index
1131+
int pin_idx) { ///<The instance pin index
1132+
1133+
std::string wire_name = inst_name;
1134+
if (port_type == PortType::INPUT) {
1135+
wire_name = join_identifier(wire_name, "input");
1136+
} else if (port_type == PortType::CLOCK) {
1137+
wire_name = join_identifier(wire_name, "clock");
1138+
} else {
1139+
VTR_ASSERT(port_type == PortType::OUTPUT);
1140+
wire_name = join_identifier(wire_name, "output");
1141+
}
1142+
1143+
wire_name = join_identifier(wire_name, std::to_string(port_idx));
1144+
wire_name = join_identifier(wire_name, std::to_string(pin_idx));
1145+
1146+
auto value = std::make_pair(wire_name, tnode_id);
1147+
if (port_type == PortType::INPUT || port_type == PortType::CLOCK) {
1148+
//Add the sink
1149+
logical_net_sinks_[atom_net_id].push_back(value);
1150+
1151+
} else {
1152+
//Add the driver
1153+
VTR_ASSERT(port_type == PortType::OUTPUT);
1154+
1155+
auto ret = logical_net_drivers_.insert(std::make_pair(atom_net_id, value));
1156+
VTR_ASSERT(ret.second); //Was inserted, drivers are unique
1157+
}
1158+
1159+
return wire_name;
1160+
}
1161+
11601162
///@brief Returns an Instance object representing the LUT
11611163
std::shared_ptr<Instance> make_lut_instance(const t_pb* atom) {
11621164
//Determine what size LUT
@@ -1772,18 +1774,6 @@ class NetlistWriterVisitor : public NetlistVisitor {
17721774
return top_pb->pb_route;
17731775
}
17741776

1775-
///@brief Returns the top complex block which contains the given pb
1776-
const t_pb* find_top_cb(const t_pb* curr) {
1777-
//Walk up through the pb graph until curr
1778-
//has no parent, at which point it will be the top pb
1779-
const t_pb* parent = curr->parent_pb;
1780-
while (parent != nullptr) {
1781-
curr = parent;
1782-
parent = curr->parent_pb;
1783-
}
1784-
return curr;
1785-
}
1786-
17871777
///@brief Returns the tnode ID of the given atom's connected cluster pin
17881778
tatum::NodeId find_tnode(const t_pb* atom, int cluster_pin_idx) {
17891779
auto& atom_ctx = g_vpr_ctx.atom();
@@ -1801,6 +1791,19 @@ class NetlistWriterVisitor : public NetlistVisitor {
18011791
return tnode_id;
18021792
}
18031793

1794+
private:
1795+
///@brief Returns the top complex block which contains the given pb
1796+
const t_pb* find_top_cb(const t_pb* curr) {
1797+
//Walk up through the pb graph until curr
1798+
//has no parent, at which point it will be the top pb
1799+
const t_pb* parent = curr->parent_pb;
1800+
while (parent != nullptr) {
1801+
curr = parent;
1802+
parent = curr->parent_pb;
1803+
}
1804+
return curr;
1805+
}
1806+
18041807
///@brief Returns a LogicVec representing the LUT mask of the given LUT atom
18051808
LogicVec load_lut_mask(size_t num_inputs, //LUT size
18061809
const t_pb* atom) { //LUT primitive
@@ -2058,13 +2061,15 @@ class NetlistWriterVisitor : public NetlistVisitor {
20582061
return ::get_delay_ps(delay_sec); //Class overload hides file-scope by default
20592062
}
20602063

2061-
private: //Data
2062-
std::string top_module_name_; ///<Name of the top level module (i.e. the circuit)
2064+
private: //Data
2065+
std::string top_module_name_; ///<Name of the top level module (i.e. the circuit)
2066+
protected:
20632067
std::vector<std::string> inputs_; ///<Name of circuit inputs
20642068
std::vector<std::string> outputs_; ///<Name of circuit outputs
20652069
std::vector<Assignment> assignments_; ///<Set of assignments (i.e. net-to-net connections)
20662070
std::vector<std::shared_ptr<Instance>> cell_instances_; ///<Set of cell instances
20672071

2072+
private:
20682073
//Drivers of logical nets.
20692074
// Key: logic net id, Value: pair of wire_name and tnode_id
20702075
std::map<AtomNetId, std::pair<std::string, tatum::NodeId>> logical_net_drivers_;
@@ -2075,7 +2080,10 @@ class NetlistWriterVisitor : public NetlistVisitor {
20752080
std::map<std::string, float> logical_net_sink_delays_;
20762081

20772082
//Output streams
2083+
protected:
20782084
std::ostream& verilog_os_;
2085+
2086+
private:
20792087
std::ostream& blif_os_;
20802088
std::ostream& sdf_os_;
20812089

0 commit comments

Comments
 (0)