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 2091cb8ba..18db75d24 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 @@ -881,6 +881,21 @@ std::string generate_physical_block_module_name(const std::string& prefix, return module_name; } + +/********************************************************************* + * Generate the instance name for physical block with a given index + **********************************************************************/ +std::string generate_physical_block_instance_name(const std::string& prefix, + t_pb_type* pb_type, + const size_t& index) { + std::string instance_name = generate_physical_block_module_name(prefix, pb_type); + /* Add index to the name */ + instance_name += std::string("_"); + instance_name += std::to_string(index); + + return instance_name; +} + /********************************************************************* * This function is a wrapper for the function generate_physical_block_module_name() * which can automatically decode the io_side and add a prefix @@ -892,6 +907,22 @@ std::string generate_grid_physical_block_module_name(const std::string& prefix, return generate_physical_block_module_name(module_name_prefix, pb_type); } +/********************************************************************* + * Generate the instance name for physical block in Grid with a given index + **********************************************************************/ +std::string generate_grid_physical_block_instance_name(const std::string& prefix, + t_pb_type* pb_type, + const e_side& border_side, + const size_t& index) { + std::string module_name_prefix = generate_grid_block_prefix(prefix, border_side); + std::string instance_name = generate_physical_block_module_name(module_name_prefix, pb_type); + /* Add index to the name */ + instance_name += std::string("_"); + instance_name += std::to_string(index); + + return instance_name; +} + /******************************************************************** * This function try to infer if a grid locates at the border of a * FPGA fabric, i.e., TOP/RIGHT/BOTTOM/LEFT sides 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 2d4f08f08..156b21350 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 @@ -175,10 +175,20 @@ std::string generate_grid_block_instance_name(const std::string& prefix, std::string generate_physical_block_module_name(const std::string& prefix, t_pb_type* physical_pb_type); +std::string generate_physical_block_instance_name(const std::string& prefix, + t_pb_type* pb_type, + const size_t& index); + std::string generate_grid_physical_block_module_name(const std::string& prefix, t_pb_type* pb_type, const e_side& border_side); +std::string generate_grid_physical_block_instance_name(const std::string& prefix, + t_pb_type* pb_type, + const e_side& border_side, + const size_t& index); + + e_side find_grid_border_side(const vtr::Point& device_size, const vtr::Point& grid_coordinate); diff --git a/vpr7_x2p/vpr/SRC/fpga_x2p/bitstream/build_grid_bitstream.cpp b/vpr7_x2p/vpr/SRC/fpga_x2p/bitstream/build_grid_bitstream.cpp index 90e110fab..41cfa7d8d 100644 --- a/vpr7_x2p/vpr/SRC/fpga_x2p/bitstream/build_grid_bitstream.cpp +++ b/vpr7_x2p/vpr/SRC/fpga_x2p/bitstream/build_grid_bitstream.cpp @@ -552,7 +552,8 @@ void rec_build_physical_block_bitstream(BitstreamManager& bitstream_manager, const MuxLibrary& mux_lib, const e_side& border_side, t_phy_pb* physical_pb, - t_pb_graph_node* physical_pb_graph_node) { + t_pb_graph_node* physical_pb_graph_node, + const size_t& pb_graph_node_index) { /* Get the physical pb_type that is linked to the pb_graph node */ t_pb_type* physical_pb_type = physical_pb_graph_node->pb_type; @@ -561,7 +562,7 @@ void rec_build_physical_block_bitstream(BitstreamManager& bitstream_manager, /* Create a block for the physical block under the grid block in bitstream manager */ std::string pb_block_name_prefix = generate_grid_block_prefix(std::string(GRID_MODULE_NAME_PREFIX), border_side); - std::string pb_block_name = generate_physical_block_module_name(pb_block_name_prefix, physical_pb_type); + std::string pb_block_name = generate_physical_block_instance_name(pb_block_name_prefix, physical_pb_type, pb_graph_node_index); ConfigBlockId pb_configurable_block = bitstream_manager.add_block(pb_block_name); bitstream_manager.add_child_block(parent_configurable_block, pb_configurable_block); @@ -579,7 +580,8 @@ void rec_build_physical_block_bitstream(BitstreamManager& bitstream_manager, module_manager, circuit_lib, mux_lib, border_side, child_pb, - &(physical_pb_graph_node->child_pb_graph_nodes[physical_mode_index][ipb][jpb])); + &(physical_pb_graph_node->child_pb_graph_nodes[physical_mode_index][ipb][jpb]), + jpb); } } } @@ -660,7 +662,7 @@ void build_physical_block_bitstream(BitstreamManager& bitstream_manager, rec_build_physical_block_bitstream(bitstream_manager, grid_configurable_block, module_manager, circuit_lib, mux_lib, border_side, - top_pb, top_pb_graph_node); + top_pb, top_pb_graph_node, z); } } diff --git a/vpr7_x2p/vpr/SRC/fpga_x2p/module_builder/build_grid_modules.cpp b/vpr7_x2p/vpr/SRC/fpga_x2p/module_builder/build_grid_modules.cpp index f5ca6ce77..7d55a7b28 100644 --- a/vpr7_x2p/vpr/SRC/fpga_x2p/module_builder/build_grid_modules.cpp +++ b/vpr7_x2p/vpr/SRC/fpga_x2p/module_builder/build_grid_modules.cpp @@ -908,6 +908,11 @@ void rec_build_physical_block_modules(ModuleManager& module_manager, /* Add the memory module as a child of primitive module */ module_manager.add_child_module(pb_module, child_pb_module); + + /* Set an instance name to bind to a block in bitstream generation */ + std::string child_pb_instance_name = generate_physical_block_instance_name(pb_module_name_prefix, &(physical_pb_type->modes[physical_mode_index].pb_type_children[ichild]), inst); + module_manager.set_child_instance_name(pb_module, child_pb_module, child_instance_id, child_pb_instance_name); + /* Identify if this sub module includes configuration bits, * we will update the memory module and instance list */ @@ -1015,6 +1020,12 @@ void build_grid_module(ModuleManager& module_manager, for (int iz = 0; iz < phy_block_type->capacity; ++iz) { size_t pb_instance_id = module_manager.num_instance(grid_module, pb_module); module_manager.add_child_module(grid_module, pb_module); + + /* Give the child module with a unique instance name */ + std::string instance_name = generate_grid_physical_block_instance_name(pb_module_name_prefix, phy_block_type->pb_graph_head->pb_type, border_side, iz); + /* Set an instance name to bind to a block in bitstream generation */ + module_manager.set_child_instance_name(grid_module, pb_module, pb_instance_id, instance_name); + /* Identify if this sub module includes configuration bits, * we will update the memory module and instance list */