Skip to content

Commit 1965f2d

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 bcd49bb commit 1965f2d

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
@@ -886,7 +886,7 @@ class NetlistWriterVisitor : public NetlistVisitor {
886886
print_sdf();
887887
}
888888

889-
private: //Internal Helper functions
889+
protected:
890890
virtual void print_primary_io(int depth) {
891891
//Primary Inputs
892892
for (auto iter = inputs_.begin(); iter != inputs_.end(); ++iter) {
@@ -977,6 +977,7 @@ class NetlistWriterVisitor : public NetlistVisitor {
977977
verilog_os_ << indent(depth) << "endmodule\n";
978978
}
979979

980+
private: //Internal Helper functions
980981
///@brief Writes out the blif netlist
981982
void print_blif(int depth = 0) {
982983
blif_os_ << indent(depth) << "#BLIF generated by VPR " << vtr::VERSION << " from post-place-and-route implementation\n";
@@ -1081,47 +1082,6 @@ class NetlistWriterVisitor : public NetlistVisitor {
10811082
sdf_os_ << indent(depth) << ")\n";
10821083
}
10831084

1084-
/**
1085-
* @brief Returns the name of a wire connecting a primitive and global net.
1086-
*
1087-
* The wire is recorded and instantiated by the top level output routines.
1088-
*/
1089-
std::string make_inst_wire(AtomNetId atom_net_id, ///<The id of the net in the atom netlist
1090-
tatum::NodeId tnode_id, ///<The tnode associated with the primitive pin
1091-
std::string inst_name, ///<The name of the instance associated with the pin
1092-
PortType port_type, ///<The port direction
1093-
int port_idx, ///<The instance port index
1094-
int pin_idx) { ///<The instance pin index
1095-
1096-
std::string wire_name = inst_name;
1097-
if (port_type == PortType::INPUT) {
1098-
wire_name = join_identifier(wire_name, "input");
1099-
} else if (port_type == PortType::CLOCK) {
1100-
wire_name = join_identifier(wire_name, "clock");
1101-
} else {
1102-
VTR_ASSERT(port_type == PortType::OUTPUT);
1103-
wire_name = join_identifier(wire_name, "output");
1104-
}
1105-
1106-
wire_name = join_identifier(wire_name, std::to_string(port_idx));
1107-
wire_name = join_identifier(wire_name, std::to_string(pin_idx));
1108-
1109-
auto value = std::make_pair(wire_name, tnode_id);
1110-
if (port_type == PortType::INPUT || port_type == PortType::CLOCK) {
1111-
//Add the sink
1112-
logical_net_sinks_[atom_net_id].push_back(value);
1113-
1114-
} else {
1115-
//Add the driver
1116-
VTR_ASSERT(port_type == PortType::OUTPUT);
1117-
1118-
auto ret = logical_net_drivers_.insert(std::make_pair(atom_net_id, value));
1119-
VTR_ASSERT(ret.second); //Was inserted, drivers are unique
1120-
}
1121-
1122-
return wire_name;
1123-
}
1124-
11251085
/**
11261086
* @brief Returns the name of a circuit-level Input/Output
11271087
*
@@ -1177,6 +1137,48 @@ class NetlistWriterVisitor : public NetlistVisitor {
11771137
return io_name;
11781138
}
11791139

1140+
protected:
1141+
/**
1142+
* @brief Returns the name of a wire connecting a primitive and global net.
1143+
*
1144+
* The wire is recorded and instantiated by the top level output routines.
1145+
*/
1146+
std::string make_inst_wire(AtomNetId atom_net_id, ///<The id of the net in the atom netlist
1147+
tatum::NodeId tnode_id, ///<The tnode associated with the primitive pin
1148+
std::string inst_name, ///<The name of the instance associated with the pin
1149+
PortType port_type, ///<The port direction
1150+
int port_idx, ///<The instance port index
1151+
int pin_idx) { ///<The instance pin index
1152+
1153+
std::string wire_name = inst_name;
1154+
if (port_type == PortType::INPUT) {
1155+
wire_name = join_identifier(wire_name, "input");
1156+
} else if (port_type == PortType::CLOCK) {
1157+
wire_name = join_identifier(wire_name, "clock");
1158+
} else {
1159+
VTR_ASSERT(port_type == PortType::OUTPUT);
1160+
wire_name = join_identifier(wire_name, "output");
1161+
}
1162+
1163+
wire_name = join_identifier(wire_name, std::to_string(port_idx));
1164+
wire_name = join_identifier(wire_name, std::to_string(pin_idx));
1165+
1166+
auto value = std::make_pair(wire_name, tnode_id);
1167+
if (port_type == PortType::INPUT || port_type == PortType::CLOCK) {
1168+
//Add the sink
1169+
logical_net_sinks_[atom_net_id].push_back(value);
1170+
1171+
} else {
1172+
//Add the driver
1173+
VTR_ASSERT(port_type == PortType::OUTPUT);
1174+
1175+
auto ret = logical_net_drivers_.insert(std::make_pair(atom_net_id, value));
1176+
VTR_ASSERT(ret.second); //Was inserted, drivers are unique
1177+
}
1178+
1179+
return wire_name;
1180+
}
1181+
11801182
///@brief Returns an Instance object representing the LUT
11811183
std::shared_ptr<Instance> make_lut_instance(const t_pb* atom) {
11821184
//Determine what size LUT
@@ -1792,18 +1794,6 @@ class NetlistWriterVisitor : public NetlistVisitor {
17921794
return top_pb->pb_route;
17931795
}
17941796

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-
18071797
///@brief Returns the tnode ID of the given atom's connected cluster pin
18081798
tatum::NodeId find_tnode(const t_pb* atom, int cluster_pin_idx) {
18091799
auto& atom_ctx = g_vpr_ctx.atom();
@@ -1821,6 +1811,19 @@ class NetlistWriterVisitor : public NetlistVisitor {
18211811
return tnode_id;
18221812
}
18231813

1814+
private:
1815+
///@brief Returns the top complex block which contains the given pb
1816+
const t_pb* find_top_cb(const t_pb* curr) {
1817+
//Walk up through the pb graph until curr
1818+
//has no parent, at which point it will be the top pb
1819+
const t_pb* parent = curr->parent_pb;
1820+
while (parent != nullptr) {
1821+
curr = parent;
1822+
parent = curr->parent_pb;
1823+
}
1824+
return curr;
1825+
}
1826+
18241827
///@brief Returns a LogicVec representing the LUT mask of the given LUT atom
18251828
LogicVec load_lut_mask(size_t num_inputs, //LUT size
18261829
const t_pb* atom) { //LUT primitive
@@ -2078,13 +2081,15 @@ class NetlistWriterVisitor : public NetlistVisitor {
20782081
return ::get_delay_ps(delay_sec); //Class overload hides file-scope by default
20792082
}
20802083

2081-
private: //Data
2082-
std::string top_module_name_; ///<Name of the top level module (i.e. the circuit)
2084+
private: //Data
2085+
std::string top_module_name_; ///<Name of the top level module (i.e. the circuit)
2086+
protected:
20832087
std::vector<std::string> inputs_; ///<Name of circuit inputs
20842088
std::vector<std::string> outputs_; ///<Name of circuit outputs
20852089
std::vector<Assignment> assignments_; ///<Set of assignments (i.e. net-to-net connections)
20862090
std::vector<std::shared_ptr<Instance>> cell_instances_; ///<Set of cell instances
20872091

2092+
private:
20882093
//Drivers of logical nets.
20892094
// Key: logic net id, Value: pair of wire_name and tnode_id
20902095
std::map<AtomNetId, std::pair<std::string, tatum::NodeId>> logical_net_drivers_;
@@ -2095,7 +2100,10 @@ class NetlistWriterVisitor : public NetlistVisitor {
20952100
std::map<std::string, float> logical_net_sink_delays_;
20962101

20972102
//Output streams
2103+
protected:
20982104
std::ostream& verilog_os_;
2105+
2106+
private:
20992107
std::ostream& blif_os_;
21002108
std::ostream& sdf_os_;
21012109

0 commit comments

Comments
 (0)