debuged
This commit is contained in:
parent
699131ad58
commit
913fdc043e
|
@ -1,8 +1,12 @@
|
|||
/************************************************************************
|
||||
* Member functions for class DeviceRRGSB
|
||||
***********************************************************************/
|
||||
|
||||
#include "device_rr_gsb.h"
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
#include "rr_gsb_utils.h"
|
||||
#include "vtr_assert.h"
|
||||
#include "vtr_log.h"
|
||||
|
@ -182,6 +186,18 @@ void DeviceRRGSB::reserve(const vtr::Point<size_t>& coordinate) {
|
|||
cby_unique_module_id_[x].resize(coordinate.y());
|
||||
}
|
||||
}
|
||||
void DeviceRRGSB::reserve_unique_modules(const vtr::Point<size_t>& coordinate) {
|
||||
sb_unique_module_id_.resize(coordinate.x());
|
||||
cbx_unique_module_id_.resize(coordinate.x());
|
||||
cby_unique_module_id_.resize(coordinate.x());
|
||||
|
||||
for (size_t x = 0; x < coordinate.x(); ++x) {
|
||||
sb_unique_module_id_[x].resize(coordinate.y());
|
||||
|
||||
cbx_unique_module_id_[x].resize(coordinate.y());
|
||||
cby_unique_module_id_[x].resize(coordinate.y());
|
||||
}
|
||||
}
|
||||
|
||||
/* Resize rr_switch_block array is needed*/
|
||||
void DeviceRRGSB::resize_upon_need(const vtr::Point<size_t>& coordinate) {
|
||||
|
@ -351,7 +367,34 @@ void DeviceRRGSB::build_gsb_unique_module() {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceRRGSB::print_txt() {
|
||||
std::ofstream outFile(
|
||||
"/home/linear/project/test_data/and2/config/output_read.txt");
|
||||
outFile << "################# sb_unique_module_id_ #########" << "\n";
|
||||
for (int i = 0; i < sb_unique_module_id_.size(); i++) {
|
||||
for (int j = 0; j < sb_unique_module_id_[0].size(); j++) {
|
||||
outFile << i << "," << j << ":" << sb_unique_module_id_[i][j] << "\n";
|
||||
}
|
||||
}
|
||||
outFile << "################# cbx_unique_module_id_ #########" << "\n";
|
||||
for (int i = 0; i < cbx_unique_module_id_.size(); i++) {
|
||||
for (int j = 0; j < cbx_unique_module_id_[0].size(); j++) {
|
||||
outFile << i << "," << j << ":" << cbx_unique_module_id_[i][j] << "\n";
|
||||
}
|
||||
}
|
||||
outFile << "################# cby_unique_module_id_ #########" << "\n";
|
||||
for (int i = 0; i < cby_unique_module_id_.size(); i++) {
|
||||
for (int j = 0; j < cby_unique_module_id_[0].size(); j++) {
|
||||
outFile << i << "," << j << ":" << cby_unique_module_id_[i][j] << "\n";
|
||||
}
|
||||
}
|
||||
outFile << "################# gsb_unique_module_id_ #########" << "\n";
|
||||
for (int i = 0; i < gsb_unique_module_id_.size(); i++) {
|
||||
for (int j = 0; j < gsb_unique_module_id_[0].size(); j++) {
|
||||
outFile << i << "," << j << ":" << gsb_unique_module_id_[i][j] << "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
void DeviceRRGSB::build_unique_module(const RRGraphView& rr_graph) {
|
||||
build_sb_unique_module(rr_graph);
|
||||
|
||||
|
@ -359,6 +402,32 @@ void DeviceRRGSB::build_unique_module(const RRGraphView& rr_graph) {
|
|||
build_cb_unique_module(rr_graph, CHANY);
|
||||
|
||||
build_gsb_unique_module();
|
||||
std::ofstream outFile(
|
||||
"/home/linear/project/test_data/and2/config/output.txt");
|
||||
outFile << "################# sb_unique_module_id_ #########" << "\n";
|
||||
for (int i = 0; i < sb_unique_module_id_.size(); i++) {
|
||||
for (int j = 0; j < sb_unique_module_id_[0].size(); j++) {
|
||||
outFile << i << "," << j << ":" << sb_unique_module_id_[i][j] << "\n";
|
||||
}
|
||||
}
|
||||
outFile << "################# cbx_unique_module_id_ #########" << "\n";
|
||||
for (int i = 0; i < cbx_unique_module_id_.size(); i++) {
|
||||
for (int j = 0; j < cbx_unique_module_id_[0].size(); j++) {
|
||||
outFile << i << "," << j << ":" << cbx_unique_module_id_[i][j] << "\n";
|
||||
}
|
||||
}
|
||||
outFile << "################# cby_unique_module_id_ #########" << "\n";
|
||||
for (int i = 0; i < cby_unique_module_id_.size(); i++) {
|
||||
for (int j = 0; j < cby_unique_module_id_[0].size(); j++) {
|
||||
outFile << i << "," << j << ":" << cby_unique_module_id_[i][j] << "\n";
|
||||
}
|
||||
}
|
||||
outFile << "################# gsb_unique_module_id_ #########" << "\n";
|
||||
for (int i = 0; i < gsb_unique_module_id_.size(); i++) {
|
||||
for (int j = 0; j < gsb_unique_module_id_[0].size(); j++) {
|
||||
outFile << i << "," << j << ":" << gsb_unique_module_id_[i][j] << "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceRRGSB::add_gsb_unique_module(const vtr::Point<size_t>& coordinate) {
|
||||
|
@ -421,7 +490,7 @@ void DeviceRRGSB::clear() {
|
|||
clear_sb_unique_module_id();
|
||||
}
|
||||
|
||||
void DeviceRRGSB::clear_unique_modules(){
|
||||
void DeviceRRGSB::clear_unique_modules() {
|
||||
/* clean unique module lists */
|
||||
clear_cb_unique_module(CHANX);
|
||||
clear_cb_unique_module_id(CHANX);
|
||||
|
@ -433,7 +502,6 @@ void DeviceRRGSB::clear_unique_modules(){
|
|||
clear_sb_unique_module_id();
|
||||
}
|
||||
|
||||
|
||||
void DeviceRRGSB::clear_gsb() {
|
||||
/* clean gsb array */
|
||||
for (size_t x = 0; x < rr_gsb_.size(); ++x) {
|
||||
|
@ -575,45 +643,62 @@ size_t DeviceRRGSB::get_cb_unique_module_index(
|
|||
return cb_unique_module_id;
|
||||
}
|
||||
|
||||
void DeviceRRGSB::preload_unique_cb_module(
|
||||
void DeviceRRGSB::preload_unique_cbx_module(
|
||||
const vtr::Point<size_t> block_coordinate,
|
||||
const std::vector<vtr::Point<size_t>> instance_coords,
|
||||
const t_rr_type& cb_type) {
|
||||
const std::vector<vtr::Point<size_t>> instance_coords) {
|
||||
/* Add to list if this is a unique mirror*/
|
||||
size_t limit_x;
|
||||
size_t limit_y;
|
||||
switch (cb_type) {
|
||||
case CHANX:
|
||||
limit_x = cbx_unique_module_id_.size();
|
||||
break;
|
||||
case CHANY:
|
||||
limit_x = cby_unique_module_id_.size();
|
||||
break;
|
||||
default:
|
||||
VTR_LOG_ERROR("Invalid type");
|
||||
}
|
||||
size_t limit_x = cbx_unique_module_id_.size();
|
||||
size_t limit_y = cbx_unique_module_id_[0].size();
|
||||
|
||||
VTR_ASSERT(block_coordinate.x() < limit_x);
|
||||
add_cb_unique_module(cb_type, block_coordinate);
|
||||
VTR_ASSERT(block_coordinate.y() < limit_y);
|
||||
add_cb_unique_module(CHANX, block_coordinate);
|
||||
/* Record the id of unique mirror */
|
||||
set_cb_unique_module_id(cb_type, block_coordinate,
|
||||
get_num_cb_unique_module(cb_type) - 1);
|
||||
set_cb_unique_module_id(CHANX, block_coordinate,
|
||||
get_num_cb_unique_module(CHANX) - 1);
|
||||
|
||||
/* Traverse the unique_mirror list and set up its module id */
|
||||
for (auto instance_location : instance_coords) {
|
||||
/* Record the id of unique mirror */
|
||||
VTR_ASSERT(instance_location.x() < limit_x);
|
||||
VTR_ASSERT(instance_location.y() < limit_y);
|
||||
set_cb_unique_module_id(
|
||||
cb_type, instance_location,
|
||||
CHANX, instance_location,
|
||||
cbx_unique_module_id_[block_coordinate.x()][block_coordinate.y()]);
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceRRGSB::preload_unique_cby_module(
|
||||
const vtr::Point<size_t> block_coordinate,
|
||||
const std::vector<vtr::Point<size_t>> instance_coords) {
|
||||
/* Add to list if this is a unique mirror*/
|
||||
size_t limit_x = cby_unique_module_id_.size();
|
||||
size_t limit_y = cby_unique_module_id_[0].size();
|
||||
|
||||
VTR_ASSERT(block_coordinate.x() < limit_x);
|
||||
VTR_ASSERT(block_coordinate.y() < limit_y);
|
||||
add_cb_unique_module(CHANY, block_coordinate);
|
||||
/* Record the id of unique mirror */
|
||||
set_cb_unique_module_id(CHANY, block_coordinate,
|
||||
get_num_cb_unique_module(CHANY) - 1);
|
||||
|
||||
/* Traverse the unique_mirror list and set up its module id */
|
||||
for (auto instance_location : instance_coords) {
|
||||
/* Record the id of unique mirror */
|
||||
VTR_ASSERT(instance_location.x() < limit_x);
|
||||
VTR_ASSERT(instance_location.y() < limit_y);
|
||||
set_cb_unique_module_id(
|
||||
CHANY, instance_location,
|
||||
cby_unique_module_id_[block_coordinate.x()][block_coordinate.y()]);
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceRRGSB::preload_unique_sb_module(
|
||||
const vtr::Point<size_t> block_coordinate,
|
||||
const std::vector<vtr::Point<size_t>> instance_coords) {
|
||||
/*input block coordinate should be within gsb coord range*/
|
||||
VTR_ASSERT(block_coordinate.x() < sb_unique_module_id_.size());
|
||||
VTR_ASSERT(block_coordinate.y() < sb_unique_module_id_[0].size());
|
||||
sb_unique_module_.push_back(block_coordinate);
|
||||
/* Record the id of unique module */
|
||||
sb_unique_module_id_[block_coordinate.x()][block_coordinate.y()] =
|
||||
|
@ -623,6 +708,7 @@ void DeviceRRGSB::preload_unique_sb_module(
|
|||
* the unique module */
|
||||
for (auto instance_location : instance_coords) {
|
||||
VTR_ASSERT(instance_location.x() < sb_unique_module_id_.size());
|
||||
VTR_ASSERT(instance_location.y() < sb_unique_module_id_[0].size());
|
||||
sb_unique_module_id_[instance_location.x()][instance_location.y()] =
|
||||
sb_unique_module_id_[block_coordinate.x()][block_coordinate.y()];
|
||||
}
|
||||
|
|
|
@ -68,11 +68,14 @@ class DeviceRRGSB {
|
|||
size_t get_cb_unique_module_index(const t_rr_type& cb_type,
|
||||
const vtr::Point<size_t>& coordinate) const;
|
||||
|
||||
public: /* Mutators */
|
||||
public: /* Mutators */
|
||||
void build_gsb_unique_module(); /* Add a switch block to the array, which will
|
||||
automatically identify and update the lists
|
||||
of unique mirrors and rotatable mirrors */
|
||||
void reserve(
|
||||
const vtr::Point<size_t>& coordinate); /* Pre-allocate the rr_switch_block
|
||||
array that the device requires */
|
||||
void reserve_sb_unique_submodule_id(
|
||||
void reserve_unique_modules(
|
||||
const vtr::Point<size_t>&
|
||||
coordinate); /* Pre-allocate the rr_sb_unique_module_id matrix that the
|
||||
device requires */
|
||||
|
@ -95,10 +98,13 @@ class DeviceRRGSB {
|
|||
automatically identify and update the lists
|
||||
of unique mirrors and rotatable mirrors */
|
||||
void clear(); /* clean the content */
|
||||
void preload_unique_cb_module(
|
||||
void print_txt();
|
||||
void preload_unique_cbx_module(
|
||||
const vtr::Point<size_t> block_coordinate,
|
||||
const std::vector<vtr::Point<size_t>> instance_coords,
|
||||
const t_rr_type& cb_type);
|
||||
const std::vector<vtr::Point<size_t>> instance_coords);
|
||||
void preload_unique_cby_module(
|
||||
const vtr::Point<size_t> block_coordinate,
|
||||
const std::vector<vtr::Point<size_t>> instance_coords);
|
||||
void preload_unique_sb_module(
|
||||
const vtr::Point<size_t> block_coordinate,
|
||||
const std::vector<vtr::Point<size_t>> instance_coords);
|
||||
|
@ -154,10 +160,8 @@ class DeviceRRGSB {
|
|||
const t_rr_type&
|
||||
cb_type); /* Add a switch block to the array, which will automatically
|
||||
identify and update the lists of unique side module */
|
||||
void build_gsb_unique_module(); /* Add a switch block to the array, which will
|
||||
automatically identify and update the lists
|
||||
of unique mirrors and rotatable mirrors */
|
||||
private: /* Internal Data */
|
||||
|
||||
private: /* Internal Data */
|
||||
std::vector<std::vector<RRGSB>> rr_gsb_;
|
||||
|
||||
std::vector<std::vector<size_t>>
|
||||
|
|
|
@ -150,9 +150,8 @@ int build_fabric_template(T& openfpga_ctx, const Command& cmd,
|
|||
openfpga_ctx, cmd_context.option_enable(cmd, opt_verbose));
|
||||
/* Update flow manager to enable compress routing */
|
||||
openfpga_ctx.mutable_flow_manager().set_compress_routing(true);
|
||||
}
|
||||
|
||||
if (cmd_context.option_enable(cmd, opt_preload)){
|
||||
} else if (true == cmd_context.option_enable(cmd, opt_compress_routing) &&
|
||||
true == cmd_context.option_enable(cmd, opt_preload)){
|
||||
openfpga_ctx.mutable_flow_manager().set_compress_routing(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
/********************************************************************
|
||||
* Parse XML codes of a <instance> to an object of device_rr_gsb
|
||||
* instance is the mirror module of unique module.
|
||||
* instance is the mirror module of unique module.
|
||||
*******************************************************************/
|
||||
vtr::Point<size_t> read_xml_unique_instance_info(
|
||||
pugi::xml_node& xml_instance_info, const pugiutil::loc_data& loc_data) {
|
||||
|
@ -113,7 +113,9 @@ int read_xml_unique_blocks(T& openfpga_ctx, const char* file_name,
|
|||
openfpga::DeviceRRGSB& device_rr_gsb = openfpga_ctx.mutable_device_rr_gsb();
|
||||
/* clear unique modules */
|
||||
device_rr_gsb.clear_unique_modules();
|
||||
|
||||
vtr::Point<size_t> grid_coord(g_vpr_ctx.device().grid.width() - 1,
|
||||
g_vpr_ctx.device().grid.height() - 1);
|
||||
device_rr_gsb.reserve_unique_modules(grid_coord);
|
||||
/* load unique blocks xml file and set up device_rr_gdb */
|
||||
for (pugi::xml_node xml_block_info : xml_root.children()) {
|
||||
/* Error out if the XML child has an invalid name! */
|
||||
|
@ -137,11 +139,11 @@ int read_xml_unique_blocks(T& openfpga_ctx, const char* file_name,
|
|||
device_rr_gsb.preload_unique_sb_module(block_coordinate,
|
||||
instance_coords);
|
||||
} else if (type == "cby") {
|
||||
device_rr_gsb.preload_unique_cb_module(block_coordinate,
|
||||
instance_coords, CHANY);
|
||||
device_rr_gsb.preload_unique_cby_module(block_coordinate,
|
||||
instance_coords);
|
||||
} else if (type == "cbx") {
|
||||
device_rr_gsb.preload_unique_cb_module(block_coordinate,
|
||||
instance_coords, CHANX);
|
||||
device_rr_gsb.preload_unique_cbx_module(block_coordinate,
|
||||
instance_coords);
|
||||
} else {
|
||||
VTR_LOG_ERROR("Unexpected type!");
|
||||
}
|
||||
|
@ -150,13 +152,15 @@ int read_xml_unique_blocks(T& openfpga_ctx, const char* file_name,
|
|||
return 1;
|
||||
}
|
||||
}
|
||||
device_rr_gsb.build_gsb_unique_module();
|
||||
device_rr_gsb.print_txt();
|
||||
if (verbose_output) {
|
||||
report_unique_module_status(openfpga_ctx, true);
|
||||
}
|
||||
} catch (pugiutil::XmlError& e) {
|
||||
archfpga_throw(file_name, e.line(), "%s", e.what());
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -179,13 +183,18 @@ int write_xml_block(
|
|||
<< "\n";
|
||||
|
||||
for (const auto& instance_info : id_instance_map[pair.first]) {
|
||||
openfpga::write_tab_to_file(fp, 2);
|
||||
fp << "<instance";
|
||||
write_xml_attribute(fp, "x", instance_info.x());
|
||||
write_xml_attribute(fp, "y", instance_info.y());
|
||||
if (instance_info.x() == pair.second.x() &&
|
||||
instance_info.y() == pair.second.y()) {
|
||||
;
|
||||
}else{
|
||||
openfpga::write_tab_to_file(fp, 2);
|
||||
fp << "<instance";
|
||||
write_xml_attribute(fp, "x", instance_info.x());
|
||||
write_xml_attribute(fp, "y", instance_info.y());
|
||||
|
||||
fp << "/>"
|
||||
<< "\n";
|
||||
fp << "/>"
|
||||
<< "\n";
|
||||
}
|
||||
}
|
||||
openfpga::write_tab_to_file(fp, 1);
|
||||
fp << "</block>"
|
||||
|
|
Loading…
Reference in New Issue