4444
4545static const char * netlist_file_name = nullptr ;
4646
47+ /* *
48+ * @brief XML parser to populate the routing represented on the ports of the pb.
49+ */
4750static void process_ports (pugi::xml_node Parent,
4851 t_pb* pb,
4952 t_pb_routes& pb_route,
5053 const pugiutil::loc_data& loc_data);
5154
55+ /* *
56+ * @brief XML parser to populate pb info and to update internal nets of the parent CLB
57+ *
58+ * @param Parent XML tag for this pb_type
59+ * @param pb physical block to use
60+ * @param loc_data xml location info for error reporting
61+ */
5262static void process_pb (pugi::xml_node Parent,
5363 const ClusterBlockId index,
5464 t_pb* pb,
5565 t_pb_routes& pb_route,
5666 int & num_primitives,
5767 const pugiutil::loc_data& loc_data);
5868
69+ /* *
70+ * @brief XML parser to populate CLB info and to update nets with the nets of this CLB
71+ *
72+ * @param clb_nlist Array of CLBs in the netlist
73+ * @param index index of the CLB to allocate and load information into
74+ * @param loc_data xml location info for error reporting
75+ */
5976static void process_complex_block (pugi::xml_node Parent,
6077 const ClusterBlockId index,
6178 int & num_primitives,
6279 const pugiutil::loc_data& loc_data,
6380 const std::unordered_map<std::string, int >& logical_block_type_name_to_index,
6481 ClusteredNetlist& clb_nlist);
6582
83+ /* *
84+ * @brief After the clustered netlist has been created, many of the atom
85+ * netlist datastructures will become out of date. Need to sync the
86+ * clustered netlist with the atom netlist.
87+ */
6688static void sync_clustered_and_atom_netlists (ClusteredNetlist& clb_nlist,
6789 AtomNetlist& atom_netlist,
6890 AtomLookup& atom_lookup);
6991
92+ /* *
93+ * @brief This function updates the nets list and the connections between
94+ * that list and the complex block
95+ */
7096static void load_external_nets_and_cb (ClusteredNetlist& clb_nlist, const AtomNetlist& atom_netlist);
7197
7298static void load_internal_to_block_net_nums (const t_logical_block_type_ptr type, t_pb_routes& pb_route);
7399
74100static void load_atom_index_for_pb_pin (t_pb_routes& pb_route, int ipin);
75101
102+ /* *
103+ * @brief Counts the number of constant generators in the design and displays
104+ * this information to the log files.
105+ */
76106static void mark_constant_generators (const ClusteredNetlist& clb_nlist, int verbosity);
77107
78108static size_t mark_constant_generators_rec (const t_pb* pb, const t_pb_routes& pb_route, int verbosity);
79109
110+ /* *
111+ * @brief Walk through the atom netlist looking up and storing the t_pb_graph_pin
112+ * associated with each connected AtomPinId
113+ */
80114static void load_atom_pin_mapping (const ClusteredNetlist& clb_nlist);
81115
82116/* *
@@ -88,8 +122,8 @@ ClusteredNetlist read_netlist(const char* net_file,
88122 const t_arch* arch,
89123 bool verify_file_digests,
90124 int verbosity) {
91- AtomNetlist& atom_netlist = g_vpr_ctx.mutable_atom ().mutable_netlist ();
92- AtomLookup& atom_lookup = g_vpr_ctx.mutable_atom ().mutable_lookup ();
125+ AtomNetlist& mutable_atom_netlist = g_vpr_ctx.mutable_atom ().mutable_netlist ();
126+ AtomLookup& mutable_atom_lookup = g_vpr_ctx.mutable_atom ().mutable_lookup ();
93127 const auto & logical_block_types = g_vpr_ctx.device ().logical_block_types ;
94128
95129 vtr::ScopedStartFinishTimer read_netlist_timer (" Loading packed FPGA netlist file." );
@@ -174,11 +208,11 @@ ClusteredNetlist read_netlist(const char* net_file,
174208 // Note that we currently don't require that the atom_netlist_id exists,
175209 // to remain compatible with old .net files
176210 std::string atom_nl_id = atom_netlist_id.value ();
177- if (atom_nl_id != atom_netlist .netlist_id ()) {
211+ if (atom_nl_id != mutable_atom_netlist .netlist_id ()) {
178212 std::string msg = vtr::string_fmt (
179213 " Netlist was generated from a different atom netlist file"
180214 " (loaded atom netlist ID: %s, packed netlist atom netlist ID: %s)" ,
181- atom_nl_id.c_str (), atom_netlist .netlist_id ().c_str ());
215+ atom_nl_id.c_str (), mutable_atom_netlist .netlist_id ().c_str ());
182216 if (verify_file_digests) {
183217 vpr_throw (VPR_ERROR_NET_F, netlist_file_name, loc_data.line (top), msg.c_str ());
184218 } else {
@@ -189,18 +223,18 @@ ClusteredNetlist read_netlist(const char* net_file,
189223
190224 // Collect top level I/Os
191225 pugi::xml_node top_inputs = pugiutil::get_single_child (top, " inputs" , loc_data);
192- auto circuit_inputs = vtr::StringToken (top_inputs.text ().get ()).split (" \t\n " );
226+ std::vector<std::string> circuit_inputs = vtr::StringToken (top_inputs.text ().get ()).split (" \t\n " );
193227
194228 pugi::xml_node top_outputs = pugiutil::get_single_child (top, " outputs" , loc_data);
195- auto circuit_outputs = vtr::StringToken (top_outputs.text ().get ()).split (" \t\n " );
229+ std::vector<std::string> circuit_outputs = vtr::StringToken (top_outputs.text ().get ()).split (" \t\n " );
196230
197231 pugi::xml_node top_clocks = pugiutil::get_single_child (top, " clocks" , loc_data);
198- auto circuit_clocks = vtr::StringToken (top_clocks.text ().get ()).split (" \t\n " );
232+ std::vector<std::string> circuit_clocks = vtr::StringToken (top_clocks.text ().get ()).split (" \t\n " );
199233
200234 /* Parse all CLB blocks and all nets*/
201235
202236 // Reset atom/pb mapping (it is reloaded from the packed netlist file)
203- atom_lookup .mutable_atom_pb_bimap ().reset_bimap ();
237+ mutable_atom_lookup .mutable_atom_pb_bimap ().reset_bimap ();
204238
205239 // Count the number of blocks for allocation
206240 size_t bcount = pugiutil::count_children (top, " block" , loc_data, pugiutil::ReqOpt::OPTIONAL);
@@ -222,23 +256,23 @@ ClusteredNetlist read_netlist(const char* net_file,
222256 VTR_ASSERT (bcount == i);
223257 VTR_ASSERT (clb_nlist.blocks ().size () == i);
224258 VTR_ASSERT (num_primitives >= 0 );
225- VTR_ASSERT (static_cast <size_t >(num_primitives) == atom_netlist .blocks ().size ());
259+ VTR_ASSERT (static_cast <size_t >(num_primitives) == mutable_atom_netlist .blocks ().size ());
226260
227261 /* Error check */
228- for (AtomBlockId blk_id : atom_netlist .blocks ()) {
229- if (atom_lookup .atom_pb_bimap ().atom_pb (blk_id) == nullptr ) {
262+ for (AtomBlockId blk_id : mutable_atom_netlist .blocks ()) {
263+ if (mutable_atom_lookup .atom_pb_bimap ().atom_pb (blk_id) == nullptr ) {
230264 VPR_FATAL_ERROR (VPR_ERROR_NET_F,
231265 " .blif file and .net file do not match, .net file missing atom %s.\n " ,
232- atom_netlist .block_name (blk_id).c_str ());
266+ mutable_atom_netlist .block_name (blk_id).c_str ());
233267 }
234268 }
235269 /* TODO: Add additional check to make sure net connections match */
236270
237271 mark_constant_generators (clb_nlist, verbosity);
238272
239- load_external_nets_and_cb (clb_nlist, atom_netlist );
273+ load_external_nets_and_cb (clb_nlist, mutable_atom_netlist );
240274
241- sync_clustered_and_atom_netlists (clb_nlist, atom_netlist, atom_lookup );
275+ sync_clustered_and_atom_netlists (clb_nlist, mutable_atom_netlist, mutable_atom_lookup );
242276
243277 } catch (pugiutil::XmlError& e) {
244278 vpr_throw (VPR_ERROR_NET_F, e.filename_c_str (), e.line (),
@@ -251,11 +285,6 @@ ClusteredNetlist read_netlist(const char* net_file,
251285 return clb_nlist;
252286}
253287
254- /* *
255- * @brief After the clustered netlist has been created, many of the atom
256- * netlist datastructures will become out of date. Need to sync the
257- * clustered netlist with the atom netlist.
258- */
259288static void sync_clustered_and_atom_netlists (ClusteredNetlist& clb_nlist,
260289 AtomNetlist& atom_netlist,
261290 AtomLookup& atom_lookup) {
@@ -289,13 +318,6 @@ static void sync_clustered_and_atom_netlists(ClusteredNetlist& clb_nlist,
289318 load_atom_pin_mapping (clb_nlist);
290319}
291320
292- /* *
293- * @brief XML parser to populate CLB info and to update nets with the nets of this CLB
294- *
295- * @param clb_nlist Array of CLBs in the netlist
296- * @param index index of the CLB to allocate and load information into
297- * @param loc_data xml location info for error reporting
298- */
299321static void process_complex_block (pugi::xml_node clb_block,
300322 const ClusterBlockId index,
301323 int & num_primitives,
@@ -435,22 +457,15 @@ void process_attrs_params(pugi::xml_node Parent, const char* child_name, T& atom
435457 }
436458}
437459
438- /* *
439- * @brief XML parser to populate pb info and to update internal nets of the parent CLB
440- *
441- * @param Parent XML tag for this pb_type
442- * @param pb physical block to use
443- * @param loc_data xml location info for error reporting
444- */
445460static void process_pb (pugi::xml_node Parent,
446461 const ClusterBlockId index,
447462 t_pb* pb,
448463 t_pb_routes& pb_route,
449464 int & num_primitives,
450465 const pugiutil::loc_data& loc_data) {
451466 const AtomNetlist& atom_netlist = g_vpr_ctx.atom ().netlist ();
452- AtomLookup& atom_lookup = g_vpr_ctx.mutable_atom ().mutable_lookup ();
453- AtomPBBimap& atom_pb_bimap = atom_lookup .mutable_atom_pb_bimap ();
467+ AtomLookup& mutable_atom_lookup = g_vpr_ctx.mutable_atom ().mutable_lookup ();
468+ AtomPBBimap& mutable_atom_pb_bimap = mutable_atom_lookup .mutable_atom_pb_bimap ();
454469
455470 // Process the ports.
456471 pugi::xml_node inputs = pugiutil::get_single_child (Parent, " inputs" , loc_data);
@@ -474,8 +489,8 @@ static void process_pb(pugi::xml_node Parent,
474489
475490 // Update atom netlist mapping
476491 VTR_ASSERT (blk_id);
477- atom_pb_bimap .set_atom_pb (blk_id, pb);
478- atom_lookup .set_atom_clb (blk_id, index);
492+ mutable_atom_pb_bimap .set_atom_pb (blk_id, pb);
493+ mutable_atom_lookup .set_atom_clb (blk_id, index);
479494
480495 // Process the attributes and params.
481496 auto atom_attrs = atom_netlist.block_attrs (blk_id);
@@ -549,7 +564,7 @@ static void process_pb(pugi::xml_node Parent,
549564 " Unknown pb type %s.\n " , instance_type.value ());
550565 }
551566
552- atom_pb_bimap .set_atom_pb (AtomBlockId::INVALID (), new_child_pb);
567+ mutable_atom_pb_bimap .set_atom_pb (AtomBlockId::INVALID (), new_child_pb);
553568
554569 // Set the name of the new pb.
555570 pugi::xml_attribute mode;
@@ -591,9 +606,6 @@ static void process_pb(pugi::xml_node Parent,
591606 }
592607}
593608
594- /* *
595- * @brief XML parser to populate the routing represented on the ports of the pb.
596- */
597609static void process_ports (pugi::xml_node Parent,
598610 t_pb* pb,
599611 t_pb_routes& pb_route,
@@ -637,7 +649,7 @@ static void process_ports(pugi::xml_node Parent,
637649 }
638650
639651 // Extract all the pins for this port
640- auto pins = vtr::StringToken (Cur.text ().get ()).split (" \t\n " );
652+ std::vector<std::string> pins = vtr::StringToken (Cur.text ().get ()).split (" \t\n " );
641653 int num_tokens = pins.size ();
642654
643655 // Check that the number of pins from the netlist file matches the pb port's number of pins
@@ -846,7 +858,7 @@ static void process_ports(pugi::xml_node Parent,
846858 pb_type->name , pb->pb_graph_node ->placement_index );
847859 }
848860
849- auto pin_mapping = vtr::StringToken (pin_rot_map.text ().get ()).split (" \t\n " );
861+ std::vector<std::string> pin_mapping = vtr::StringToken (pin_rot_map.text ().get ()).split (" \t\n " );
850862
851863 if (size_t (pb_gport->num_pins ) != pin_mapping.size ()) {
852864 vpr_throw (VPR_ERROR_NET_F, netlist_file_name, loc_data.line (pin_rot_map),
@@ -876,10 +888,6 @@ static void process_ports(pugi::xml_node Parent,
876888 }
877889}
878890
879- /* *
880- * @brief This function updates the nets list and the connections between
881- * that list and the complex block
882- */
883891static void load_external_nets_and_cb (ClusteredNetlist& clb_nlist,
884892 const AtomNetlist& atom_netlist) {
885893 // Create a set of all unique net names that we can see. We want to ignore
@@ -1044,10 +1052,6 @@ static void load_external_nets_and_cb(ClusteredNetlist& clb_nlist,
10441052 }
10451053}
10461054
1047- /* *
1048- * @brief Counts the number of constant generators in the design and displays
1049- * this information to the log files.
1050- */
10511055static void mark_constant_generators (const ClusteredNetlist& clb_nlist, int verbosity) {
10521056 size_t const_gen_count = 0 ;
10531057 for (ClusterBlockId blk_id : clb_nlist.blocks ()) {
@@ -1141,10 +1145,6 @@ static void load_atom_index_for_pb_pin(t_pb_routes& pb_route, int ipin) {
11411145 pb_route[driver].sink_pb_pin_ids .push_back (ipin);
11421146}
11431147
1144- /* *
1145- * @brief Walk through the atom netlist looking up and storing the t_pb_graph_pin
1146- * associated with each connected AtomPinId
1147- */
11481148static void load_atom_pin_mapping (const ClusteredNetlist& clb_nlist) {
11491149 const AtomNetlist& atom_netlist = g_vpr_ctx.atom ().netlist ();
11501150 const AtomPBBimap& atom_pb_bimap = g_vpr_ctx.atom ().lookup ().atom_pb_bimap ();
@@ -1203,11 +1203,11 @@ static void load_atom_pin_mapping(const ClusteredNetlist& clb_nlist) {
12031203
12041204void set_atom_pin_mapping (const ClusteredNetlist& clb_nlist, const AtomBlockId atom_blk, const AtomPortId atom_port, const t_pb_graph_pin* gpin) {
12051205 const AtomNetlist& atom_netlist = g_vpr_ctx.atom ().netlist ();
1206- AtomLookup& atom_lookup = g_vpr_ctx.mutable_atom ().mutable_lookup ();
1206+ AtomLookup& mutable_atom_lookup = g_vpr_ctx.mutable_atom ().mutable_lookup ();
12071207
12081208 VTR_ASSERT (atom_netlist.port_block (atom_port) == atom_blk);
12091209
1210- ClusterBlockId clb_index = atom_lookup .atom_clb (atom_blk);
1210+ ClusterBlockId clb_index = mutable_atom_lookup .atom_clb (atom_blk);
12111211 VTR_ASSERT (clb_index != ClusterBlockId::INVALID ());
12121212
12131213 const t_pb* clb_pb = clb_nlist.block_pb (clb_index);
@@ -1221,7 +1221,7 @@ void set_atom_pin_mapping(const ClusteredNetlist& clb_nlist, const AtomBlockId a
12211221 return ;
12221222 }
12231223
1224- const t_pb* atom_pb = atom_lookup .atom_pb_bimap ().atom_pb (atom_blk);
1224+ const t_pb* atom_pb = mutable_atom_lookup .atom_pb_bimap ().atom_pb (atom_blk);
12251225
12261226 // This finds the index within the atom port to which the current gpin
12271227 // is mapped. Note that this accounts for any applied pin rotations
@@ -1233,5 +1233,5 @@ void set_atom_pin_mapping(const ClusteredNetlist& clb_nlist, const AtomBlockId a
12331233 VTR_ASSERT (pb_route.atom_net_id == atom_netlist.pin_net (atom_pin));
12341234
12351235 // Save the mapping
1236- atom_lookup .set_atom_pin_pb_graph_pin (atom_pin, gpin);
1236+ mutable_atom_lookup .set_atom_pin_pb_graph_pin (atom_pin, gpin);
12371237}
0 commit comments