move compact routing hierarchy to build_fabric command

This commit is contained in:
tangxifan 2020-02-12 15:49:47 -07:00
parent df3ae60954
commit 13fadd0f91
4 changed files with 44 additions and 25 deletions

View File

@ -7,7 +7,8 @@
#include "device_rr_gsb.h"
#include "device_rr_gsb_utils.h"
#include "compact_routing_hierarchy.h"
//#include "build_device_module.h"
#include "openfpga_build_fabric.h"
/* Include global variables of VPR */
#include "globals.h"
@ -19,17 +20,14 @@ namespace openfpga {
* Identify the unique GSBs from the Device RR GSB arrays
* This function should only be called after the GSB builder is done
*******************************************************************/
void compact_routing_hierarchy(OpenfpgaContext& openfpga_context,
const Command& cmd, const CommandContext& cmd_context) {
static
void compress_routing_hierarchy(OpenfpgaContext& openfpga_context,
const bool& verbose_output) {
vtr::ScopedStartFinishTimer timer("Identify unique General Switch Blocks (GSBs)");
CommandOptionId opt_verbose = cmd.option("verbose");
/* Build unique module lists */
openfpga_context.mutable_device_rr_gsb().build_unique_module(g_vpr_ctx.device().rr_graph);
bool verbose_output = cmd_context.option_enable(cmd, opt_verbose);
/* Report the stats */
VTR_LOGV(verbose_output,
"Detected %lu unique X-direction connection blocks from a total of %d (compression rate=%d%)\n",
@ -54,7 +52,24 @@ void compact_routing_hierarchy(OpenfpgaContext& openfpga_context,
openfpga_context.device_rr_gsb().get_num_gsb_unique_module(),
find_device_rr_gsb_num_gsb_modules(openfpga_context.device_rr_gsb()),
100 * (openfpga_context.device_rr_gsb().get_num_gsb_unique_module() / find_device_rr_gsb_num_gsb_modules(openfpga_context.device_rr_gsb()) - 1));
}
/********************************************************************
* Build the module graph for FPGA device
*******************************************************************/
void build_fabric(OpenfpgaContext& openfpga_context,
const Command& cmd, const CommandContext& cmd_context) {
CommandOptionId opt_compress_routing = cmd.option("compress_routing");
CommandOptionId opt_verbose = cmd.option("verbose");
if (true == cmd_context.option_enable(cmd, opt_compress_routing)) {
compress_routing_hierarchy(openfpga_context, cmd_context.option_enable(cmd, opt_verbose));
}
/*
openfpga_context.mutable_module_graph() = build_device_module_graph();
*/
}
} /* end namespace openfpga */

View File

@ -1,5 +1,5 @@
#ifndef COMPACT_ROUTING_HIERARCHY_H
#define COMPACT_ROUTING_HIERARCHY_H
#ifndef OPENFPGA_BUILD_FABRIC_H
#define OPENFPGA_BUILD_FABRIC_H
/********************************************************************
* Include header files that are required by function declaration
@ -15,8 +15,8 @@
/* begin namespace openfpga */
namespace openfpga {
void compact_routing_hierarchy(OpenfpgaContext& openfpga_context,
const Command& cmd, const CommandContext& cmd_context);
void build_fabric(OpenfpgaContext& openfpga_context,
const Command& cmd, const CommandContext& cmd_context);
} /* end namespace openfpga */

View File

@ -8,7 +8,7 @@
#include "openfpga_pb_pin_fixup.h"
#include "openfpga_lut_truth_table_fixup.h"
#include "check_netlist_naming_conflict.h"
#include "compact_routing_hierarchy.h"
#include "openfpga_build_fabric.h"
#include "openfpga_setup_command.h"
/* begin namespace openfpga */
@ -121,20 +121,22 @@ void add_openfpga_setup_commands(openfpga::Shell<OpenfpgaContext>& shell) {
shell.set_command_dependency(shell_cmd_lut_truth_table_fixup_id, cmd_dependency_lut_truth_table_fixup);
/********************************
* Command 'compact_routing_hierarchy'
* Command 'build_fabric'
*/
Command shell_cmd_compact_routing_hierarchy("compact_routing_hierarchy");
Command shell_cmd_build_fabric("build_fabric");
/* Add an option '--verbose' */
shell_cmd_compact_routing_hierarchy.add_option("verbose", false, "Show verbose outputs");
shell_cmd_build_fabric.add_option("compress_routing", false, "Compress the number of unique routing modules by identifying the unique GSBs");
shell_cmd_build_fabric.add_option("duplicate_grid_pin", false, "Duplicate the pins on the same side of a grid");
shell_cmd_build_fabric.add_option("verbose", false, "Show verbose outputs");
/* Add command 'compact_routing_hierarchy' to the Shell */
ShellCommandId shell_cmd_compact_routing_hierarchy_id = shell.add_command(shell_cmd_compact_routing_hierarchy, "Identify the unique GSBs in the routing architecture so that the routing hierarchy of fabric can be compressed");
shell.set_command_class(shell_cmd_compact_routing_hierarchy_id, openfpga_setup_cmd_class);
shell.set_command_execute_function(shell_cmd_compact_routing_hierarchy_id, compact_routing_hierarchy);
/* The 'compact_routing_hierarchy' command should NOT be executed before 'link_openfpga_arch' */
std::vector<ShellCommandId> cmd_dependency_compact_routing_hierarchy;
ShellCommandId shell_cmd_build_fabric_id = shell.add_command(shell_cmd_build_fabric, "Build the FPGA fabric in a graph of modules");
shell.set_command_class(shell_cmd_build_fabric_id, openfpga_setup_cmd_class);
shell.set_command_execute_function(shell_cmd_build_fabric_id, build_fabric);
/* The 'build_fabric' command should NOT be executed before 'link_openfpga_arch' */
std::vector<ShellCommandId> cmd_dependency_build_fabric;
cmd_dependency_lut_truth_table_fixup.push_back(shell_cmd_link_openfpga_arch_id);
shell.set_command_dependency(shell_cmd_compact_routing_hierarchy_id, cmd_dependency_compact_routing_hierarchy);
shell.set_command_dependency(shell_cmd_build_fabric_id, cmd_dependency_build_fabric);
}
} /* end namespace openfpga */

View File

@ -11,13 +11,15 @@ link_openfpga_arch
check_netlist_naming_conflict --fix --report ./netlist_renaming.xml
# Apply fix-up to clustering nets based on routing results
pb_pin_fixup --verbose
pb_pin_fixup #--verbose
# Apply fix-up to Look-Up Table truth tables based on packing results
lut_truth_table_fixup --verbose
lut_truth_table_fixup #--verbose
# Compress the routing hierarchy
compact_routing_hierarchy --verbose
# Build the module graph
# - Enabled compression on routing architecture modules
# - Enable pin duplication on grid modules
build_fabric --compress_routing --duplicate_grid_pin --verbose
# Finish and exit OpenFPGA
exit