From 43e78585baf68cc45a13276a47dc7c7f877c5330 Mon Sep 17 00:00:00 2001 From: tangxifan Date: Tue, 24 Dec 2019 14:55:17 -0700 Subject: [PATCH] add routing track naming function for unique modules --- .../vpr/SRC/fpga_x2p/base/fpga_x2p_naming.cpp | 45 +++++++++++++++++++ .../vpr/SRC/fpga_x2p/base/fpga_x2p_naming.h | 4 ++ 2 files changed, 49 insertions(+) diff --git a/vpr7_x2p/vpr/SRC/fpga_x2p/base/fpga_x2p_naming.cpp b/vpr7_x2p/vpr/SRC/fpga_x2p/base/fpga_x2p_naming.cpp index 72bc59994..abf4a7a7e 100644 --- a/vpr7_x2p/vpr/SRC/fpga_x2p/base/fpga_x2p_naming.cpp +++ b/vpr7_x2p/vpr/SRC/fpga_x2p/base/fpga_x2p_naming.cpp @@ -244,6 +244,8 @@ std::string generate_routing_channel_module_name(const t_rr_type& chan_type, /********************************************************************* * Generate the port name for a routing track with a given coordinate * and port direction + * This function is mainly used in naming routing tracks in the top-level netlists + * where we do need unique names (with coordinates) for each routing tracks *********************************************************************/ std::string generate_routing_track_port_name(const t_rr_type& chan_type, const vtr::Point& coordinate, @@ -281,6 +283,49 @@ std::string generate_routing_track_port_name(const t_rr_type& chan_type, return port_name; } +/********************************************************************* + * Generate the port name for a routing track in a module + * This function is created to ease the PnR for each unique routing module + * So it is mainly used when creating non-top-level modules! + * Note that this function does not include any port coordinate + * so that each module can be instanciated across the fabric + * Even though, port direction must be provided! + *********************************************************************/ +std::string generate_routing_module_track_port_name(const t_rr_type& chan_type, + const size_t& track_id, + const PORTS& port_direction) { + /* Channel must be either CHANX or CHANY */ + VTR_ASSERT( (CHANX == chan_type) || (CHANY == chan_type) ); + + /* Create a map between chan_type and module_prefix */ + std::map module_prefix_map; + /* TODO: use a constexpr string to replace the fixed name? */ + module_prefix_map[CHANX] = std::string("chanx"); + module_prefix_map[CHANY] = std::string("chany"); + + std::string port_name = module_prefix_map[chan_type]; + port_name += std::string("_"); + + switch (port_direction) { + case OUT_PORT: + port_name += std::string("out_"); + break; + case IN_PORT: + port_name += std::string("in_"); + break; + default: + vpr_printf(TIO_MESSAGE_ERROR, + "(File: %s [LINE%d]) Invalid direction of chan_rr_node!\n", + __FILE__, __LINE__); + exit(1); + } + + /* Add the track id to the port name */ + port_name += std::to_string(track_id) + std::string("_"); + + return port_name; +} + /********************************************************************* * Generate the middle output port name for a routing track * with a given coordinate diff --git a/vpr7_x2p/vpr/SRC/fpga_x2p/base/fpga_x2p_naming.h b/vpr7_x2p/vpr/SRC/fpga_x2p/base/fpga_x2p_naming.h index 83e84af3b..3508792d4 100644 --- a/vpr7_x2p/vpr/SRC/fpga_x2p/base/fpga_x2p_naming.h +++ b/vpr7_x2p/vpr/SRC/fpga_x2p/base/fpga_x2p_naming.h @@ -69,6 +69,10 @@ std::string generate_routing_track_port_name(const t_rr_type& chan_type, const size_t& track_id, const PORTS& port_direction); +std::string generate_routing_module_track_port_name(const t_rr_type& chan_type, + const size_t& track_id, + const PORTS& port_direction); + std::string generate_routing_track_middle_output_port_name(const t_rr_type& chan_type, const vtr::Point& coordinate, const size_t& track_id);