add instance name for each pb graph node

This commit is contained in:
tangxifan 2019-10-26 17:25:45 -06:00
parent 7649d9228e
commit f116351831
4 changed files with 58 additions and 4 deletions

View File

@ -881,6 +881,21 @@ std::string generate_physical_block_module_name(const std::string& prefix,
return module_name; 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() * This function is a wrapper for the function generate_physical_block_module_name()
* which can automatically decode the io_side and add a prefix * 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); 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 * This function try to infer if a grid locates at the border of a
* FPGA fabric, i.e., TOP/RIGHT/BOTTOM/LEFT sides * FPGA fabric, i.e., TOP/RIGHT/BOTTOM/LEFT sides

View File

@ -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, std::string generate_physical_block_module_name(const std::string& prefix,
t_pb_type* physical_pb_type); 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, std::string generate_grid_physical_block_module_name(const std::string& prefix,
t_pb_type* pb_type, t_pb_type* pb_type,
const e_side& border_side); 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<size_t>& device_size, e_side find_grid_border_side(const vtr::Point<size_t>& device_size,
const vtr::Point<size_t>& grid_coordinate); const vtr::Point<size_t>& grid_coordinate);

View File

@ -552,7 +552,8 @@ void rec_build_physical_block_bitstream(BitstreamManager& bitstream_manager,
const MuxLibrary& mux_lib, const MuxLibrary& mux_lib,
const e_side& border_side, const e_side& border_side,
t_phy_pb* physical_pb, 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 */ /* 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; 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 */ /* 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_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); ConfigBlockId pb_configurable_block = bitstream_manager.add_block(pb_block_name);
bitstream_manager.add_child_block(parent_configurable_block, pb_configurable_block); 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, module_manager, circuit_lib, mux_lib,
border_side, border_side,
child_pb, 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, rec_build_physical_block_bitstream(bitstream_manager, grid_configurable_block,
module_manager, circuit_lib, mux_lib, module_manager, circuit_lib, mux_lib,
border_side, border_side,
top_pb, top_pb_graph_node); top_pb, top_pb_graph_node, z);
} }
} }

View File

@ -908,6 +908,11 @@ void rec_build_physical_block_modules(ModuleManager& module_manager,
/* Add the memory module as a child of primitive module */ /* Add the memory module as a child of primitive module */
module_manager.add_child_module(pb_module, child_pb_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, /* Identify if this sub module includes configuration bits,
* we will update the memory module and instance list * 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) { for (int iz = 0; iz < phy_block_type->capacity; ++iz) {
size_t pb_instance_id = module_manager.num_instance(grid_module, pb_module); size_t pb_instance_id = module_manager.num_instance(grid_module, pb_module);
module_manager.add_child_module(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, /* Identify if this sub module includes configuration bits,
* we will update the memory module and instance list * we will update the memory module and instance list
*/ */