@@ -242,28 +242,28 @@ static t_port get_generic_port(t_arch* arch,
242242}
243243
244244/* * @brief Returns true if a given port name exists in the given complex block */ 
245- static  bool  block_port_exists (t_pb_type* pb_type, std::string  port_name) {
245+ static  bool  block_port_exists (t_pb_type* pb_type, std::string_view  port_name) {
246246    for  (int  iport = 0 ; iport < pb_type->num_ports ; iport++) {
247247        const  t_port port = pb_type->ports [iport];
248248
249-         if  (std::string ( port.name )  == port_name)
249+         if  (port.name  == port_name)
250250            return  true ;
251251    }
252252
253253    return  false ;
254254}
255255
256- /* * @brief Returns a pack pattern given it's  name, input and output strings */ 
257- static  t_pin_to_pin_annotation get_pack_pattern (std::string  pp_name, std::string  input, std::string  output) {
256+ /* * @brief Returns a pack pattern given its  name, input and output strings */ 
257+ static  t_pin_to_pin_annotation get_pack_pattern (std::string_view  pp_name, std::string_view  input, std::string_view  output) {
258258    t_pin_to_pin_annotation pp;
259259
260260    pp.type  = E_ANNOT_PIN_TO_PIN_PACK_PATTERN;
261261    pp.format  = E_ANNOT_PIN_TO_PIN_CONSTANT;
262-     pp.annotation_entries .push_back ({E_ANNOT_PIN_TO_PIN_PACK_PATTERN_NAME, pp_name});
263-     pp.input_pins  = vtr::strdup ( input. c_str ()) ;
264-     pp.output_pins  = vtr::strdup ( output. c_str ()) ;
262+     pp.annotation_entries .push_back ({E_ANNOT_PIN_TO_PIN_PACK_PATTERN_NAME, pp_name. data () });
263+     pp.input_pins  = input;
264+     pp.output_pins  = output;
265265
266-     pp.clock  =  nullptr ;
266+     pp.clock . clear () ;
267267
268268    return  pp;
269269}
@@ -1216,8 +1216,8 @@ struct ArchReader {
12161216                ostr = std::string (pb_type->name ) + " .in[" std::to_string (j) + " ]" 
12171217                name = istr + " _to_" 
12181218
1219-                 ic->input_string  = vtr::strdup ( istr. c_str ()) ;
1220-                 ic->output_string  = vtr::strdup ( ostr. c_str ()) ;
1219+                 ic->input_string  = istr;
1220+                 ic->output_string  = ostr;
12211221                ic->name  = vtr::strdup (name.c_str ());
12221222            }
12231223
@@ -1231,8 +1231,8 @@ struct ArchReader {
12311231            ostr = std::string (parent->name ) + " ." output_pin ;
12321232            name = istr + " _to_" 
12331233
1234-             ic->input_string  = vtr::strdup ( istr. c_str ()) ;
1235-             ic->output_string  = vtr::strdup ( ostr. c_str ()) ;
1234+             ic->input_string  = istr;
1235+             ic->output_string  = ostr;
12361236            ic->name  = vtr::strdup (name.c_str ());
12371237        }
12381238    }
@@ -1267,14 +1267,12 @@ struct ArchReader {
12671267        mode->interconnect  = new  t_interconnect[mode->num_interconnect ];
12681268        t_interconnect* ic = &mode->interconnect [0 ];
12691269
1270-         std::string istr, ostr, name;
1270+         std::string istr = std::string (pb_type->name ) + " .in" 
1271+         std::string ostr = std::string (pb_type->name ) + " .out" 
1272+         std::string name = " passthrough" 
12711273
1272-         istr = std::string (pb_type->name ) + " .in" 
1273-         ostr = std::string (pb_type->name ) + " .out" 
1274-         name = " passthrough" 
1275- 
1276-         ic->input_string  = vtr::strdup (istr.c_str ());
1277-         ic->output_string  = vtr::strdup (ostr.c_str ());
1274+         ic->input_string  = istr;
1275+         ic->output_string  = ostr;
12781276        ic->name  = vtr::strdup (name.c_str ());
12791277
12801278        ic->type  = COMPLETE_INTERC;
@@ -1329,8 +1327,8 @@ struct ArchReader {
13291327        ostr = std::string (lut->name ) + " .in" 
13301328        name = istr + " _to_" 
13311329
1332-         ic->input_string  = vtr::strdup ( istr. c_str ()) ;
1333-         ic->output_string  = vtr::strdup ( ostr. c_str ()) ;
1330+         ic->input_string  = istr;
1331+         ic->output_string  = ostr;
13341332        ic->name  = vtr::strdup (name.c_str ());
13351333
13361334        //  Output
@@ -1343,8 +1341,8 @@ struct ArchReader {
13431341        ostr = std::string (pb_type->name ) + " .out" 
13441342        name = istr + " _to_" 
13451343
1346-         ic->input_string  = vtr::strdup ( istr. c_str ()) ;
1347-         ic->output_string  = vtr::strdup ( ostr. c_str ()) ;
1344+         ic->input_string  = istr;
1345+         ic->output_string  = ostr;
13481346        ic->name  = vtr::strdup (name.c_str ());
13491347    }
13501348
@@ -1458,15 +1456,15 @@ struct ArchReader {
14581456        o_ic->type  = DIRECT_INTERC;
14591457        o_ic->parent_mode_index  = 0 ;
14601458        o_ic->parent_mode  = omode;
1461-         o_ic->input_string  = vtr::strdup ( opad_istr. c_str ()) ;
1462-         o_ic->output_string  = vtr::strdup ( opad_ostr. c_str ()) ;
1459+         o_ic->input_string  = opad_istr;
1460+         o_ic->output_string  = opad_ostr;
14631461
14641462        i_ic->name  = vtr::strdup (i_ic_name.c_str ());
14651463        i_ic->type  = DIRECT_INTERC;
14661464        i_ic->parent_mode_index  = 0 ;
14671465        i_ic->parent_mode  = imode;
1468-         i_ic->input_string  = vtr::strdup ( ipad_istr.c_str () );
1469-         i_ic->output_string  = vtr::strdup ( ipad_ostr.c_str () );
1466+         i_ic->input_string  = ipad_istr.c_str ();
1467+         i_ic->output_string  = ipad_ostr.c_str ();
14701468
14711469        omode->interconnect [0 ] = *o_ic;
14721470        imode->interconnect [0 ] = *i_ic;
@@ -1611,8 +1609,8 @@ struct ArchReader {
16111609                ic->type  = DIRECT_INTERC;
16121610                ic->parent_mode_index  = idx;
16131611                ic->parent_mode  = mode;
1614-                 ic->input_string  = vtr::strdup ( istr. c_str ()) ;
1615-                 ic->output_string  = vtr::strdup ( ostr. c_str ()) ;
1612+                 ic->input_string  = istr;
1613+                 ic->output_string  = ostr;
16161614            }
16171615
16181616            create_ports (leaf, pins, name);
@@ -1667,8 +1665,8 @@ struct ArchReader {
16671665        ic->type  = ic_type;
16681666        ic->parent_mode_index  = idx;
16691667        ic->parent_mode  = mode;
1670-         ic->input_string  = vtr::strdup ( istr. c_str ()) ;
1671-         ic->output_string  = vtr::strdup ( ostr. c_str ()) ;
1668+         ic->input_string  = istr;
1669+         ic->output_string  = ostr;
16721670    }
16731671
16741672    /* * @brief Processes all the ports of a given complex block.
@@ -1787,8 +1785,8 @@ struct ArchReader {
17871785
17881786            VTR_ASSERT (names.insert (ic_name).second );
17891787            ic->name  = vtr::strdup (ic_name.c_str ());
1790-             ic->input_string  = vtr::strdup ( input. c_str ()) ;
1791-             ic->output_string  = vtr::strdup ( outputs_str. c_str ()) ;
1788+             ic->input_string  = input;
1789+             ic->output_string  = outputs_str;
17921790        }
17931791
17941792        //  Checks and, in case, adds all the necessary pack patterns to the marked interconnects
@@ -2144,8 +2142,8 @@ struct ArchReader {
21442142            ic->type  = DIRECT_INTERC;
21452143            ic->parent_mode_index  = 0 ;
21462144            ic->parent_mode  = mode;
2147-             ic->input_string  = vtr::strdup ( istr. c_str ()) ;
2148-             ic->output_string  = vtr::strdup ( ostr. c_str ()) ;
2145+             ic->input_string  = istr;
2146+             ic->output_string  = ostr;
21492147
21502148            count++;
21512149        }
@@ -2529,7 +2527,7 @@ void FPGAInterchangeReadArch(const char* FPGAInterchangeDeviceFile,
25292527
25302528    auto  device_reader = message_reader.getRoot <DeviceResources::Device>();
25312529
2532-     arch->architecture_id  = vtr::strdup  ( vtr:: secure_digest_file). c_str () );
2530+     arch->architecture_id  = vtr::secure_digest_file (FPGAInterchangeDeviceFile);
25332531
25342532    ArchReader reader (arch, device_reader, FPGAInterchangeDeviceFile, PhysicalTileTypes, LogicalBlockTypes);
25352533    reader.read_arch ();
0 commit comments