add comments
This commit is contained in:
parent
27db6d2496
commit
5ccad723c4
|
@ -65,8 +65,9 @@ size_t DeviceRRGSB::get_num_cb_unique_module(const t_rr_type& cb_type) const {
|
|||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
/* Identify if unique blocks are preloaded or built */
|
||||
bool DeviceRRGSB::is_compressed() const { return is_compressed_; }
|
||||
|
||||
/* Identify if a GSB actually exists at a location */
|
||||
bool DeviceRRGSB::is_gsb_exist(const RRGraphView& rr_graph,
|
||||
const vtr::Point<size_t> coord) const {
|
||||
|
@ -96,10 +97,12 @@ size_t DeviceRRGSB::get_num_sb_unique_module() const {
|
|||
return sb_unique_module_.size();
|
||||
}
|
||||
|
||||
/* get the coordinate of unique mirrors of switch blocks */
|
||||
vtr::Point<size_t> DeviceRRGSB::get_sb_unique_block_coord(size_t id) const {
|
||||
return sb_unique_module_[id];
|
||||
}
|
||||
|
||||
/* get the coordinates of the instances of a unique switch block */
|
||||
std::vector<vtr::Point<size_t>> DeviceRRGSB::get_sb_unique_block_instance_coord(
|
||||
const vtr::Point<size_t>& unique_block_coord) const {
|
||||
auto unique_module_id =
|
||||
|
@ -120,10 +123,12 @@ std::vector<vtr::Point<size_t>> DeviceRRGSB::get_sb_unique_block_instance_coord(
|
|||
return instance_map;
|
||||
}
|
||||
|
||||
/* get the coordinate of unique mirrors of connection blocks of CHANX type */
|
||||
vtr::Point<size_t> DeviceRRGSB::get_cbx_unique_block_coord(size_t id) const {
|
||||
return cbx_unique_module_[id];
|
||||
}
|
||||
|
||||
/* get the coordinates of the instances of a unique connection block of CHANX type */
|
||||
std::vector<vtr::Point<size_t>>
|
||||
DeviceRRGSB::get_cbx_unique_block_instance_coord(
|
||||
const vtr::Point<size_t>& unique_block_coord) const {
|
||||
|
@ -145,10 +150,12 @@ DeviceRRGSB::get_cbx_unique_block_instance_coord(
|
|||
return instance_map;
|
||||
}
|
||||
|
||||
/* get the coordinate of unique mirrors of connection blocks of CHANY type */
|
||||
vtr::Point<size_t> DeviceRRGSB::get_cby_unique_block_coord(size_t id) const {
|
||||
return cby_unique_module_[id];
|
||||
}
|
||||
|
||||
/* get the coordinates of the instances of a unique connection block of CHANY type */
|
||||
std::vector<vtr::Point<size_t>>
|
||||
DeviceRRGSB::get_cby_unique_block_instance_coord(
|
||||
const vtr::Point<size_t>& unique_block_coord) const {
|
||||
|
@ -246,6 +253,7 @@ void DeviceRRGSB::reserve(const vtr::Point<size_t>& coordinate) {
|
|||
cby_unique_module_id_[x].resize(coordinate.y());
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceRRGSB::reserve_unique_modules() {
|
||||
/* As rr_gsb_ has been built, it has valid size. Will reserve space for
|
||||
* unique blocks according to rr_gsb_'s size*/
|
||||
|
@ -658,6 +666,11 @@ size_t DeviceRRGSB::get_cb_unique_module_index(
|
|||
return cb_unique_module_id;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Preload unique blocks
|
||||
***********************************************************************/
|
||||
/* preload unique cbx blocks and their corresponding instance information. This
|
||||
* function will be called when read_unique_blocks command invoked */
|
||||
void DeviceRRGSB::preload_unique_cbx_module(
|
||||
const vtr::Point<size_t>& block_coordinate,
|
||||
const std::vector<vtr::Point<size_t>>& instance_coords) {
|
||||
|
@ -682,6 +695,8 @@ void DeviceRRGSB::preload_unique_cbx_module(
|
|||
}
|
||||
}
|
||||
|
||||
/* preload unique cby blocks and their corresponding instance information. This
|
||||
* function will be called when read_unique_blocks command invoked */
|
||||
void DeviceRRGSB::preload_unique_cby_module(
|
||||
const vtr::Point<size_t>& block_coordinate,
|
||||
const std::vector<vtr::Point<size_t>>& instance_coords) {
|
||||
|
@ -707,6 +722,8 @@ void DeviceRRGSB::preload_unique_cby_module(
|
|||
}
|
||||
}
|
||||
|
||||
/* preload unique sb blocks and their corresponding instance information. This
|
||||
* function will be called when read_unique_blocks command invoked */
|
||||
void DeviceRRGSB::preload_unique_sb_module(
|
||||
const vtr::Point<size_t>& block_coordinate,
|
||||
const std::vector<vtr::Point<size_t>>& instance_coords) {
|
||||
|
|
|
@ -44,17 +44,24 @@ class DeviceRRGSB {
|
|||
size_t get_num_gsb_unique_module()
|
||||
const; /* get the number of unique mirrors of GSB */
|
||||
|
||||
size_t get_num_sb_unique_module() const;
|
||||
vtr::Point<size_t> get_sb_unique_block_coord(size_t id) const;
|
||||
size_t get_num_sb_unique_module()
|
||||
const; /* get the number of unique mirrors of SB */
|
||||
vtr::Point<size_t> get_sb_unique_block_coord(
|
||||
size_t id) const; /* get the coordinate of a unique switch block */
|
||||
std::vector<vtr::Point<size_t>> get_sb_unique_block_instance_coord(
|
||||
const vtr::Point<size_t>& unique_block_coord) const;
|
||||
const vtr::Point<size_t>& unique_block_coord)
|
||||
const; /* get the coordinates of the instances of a unique switch block */
|
||||
|
||||
vtr::Point<size_t> get_cbx_unique_block_coord(size_t id) const;
|
||||
vtr::Point<size_t> get_cbx_unique_block_coord(
|
||||
size_t id) const; /* get the coordinate of a unique connection block of CHANX type */
|
||||
std::vector<vtr::Point<size_t>> get_cbx_unique_block_instance_coord(
|
||||
const vtr::Point<size_t>& unique_block_coord) const;
|
||||
vtr::Point<size_t> get_cby_unique_block_coord(size_t id) const;
|
||||
const vtr::Point<size_t>& unique_block_coord)
|
||||
const; /* get the coordinates of the instances of a unique connection block of CHANX type*/
|
||||
vtr::Point<size_t> get_cby_unique_block_coord(
|
||||
size_t id) const; /* get the coordinate of a unique connection block of CHANY type */
|
||||
std::vector<vtr::Point<size_t>> get_cby_unique_block_instance_coord(
|
||||
const vtr::Point<size_t>& unique_block_coord) const;
|
||||
const vtr::Point<size_t>& unique_block_coord)
|
||||
const; /* get the coordinates of the instances of a unique connection block of CHANY type */
|
||||
|
||||
const RRGSB& get_gsb_unique_module(
|
||||
const size_t& index) const; /* Get a rr-gsb which is a unique mirror */
|
||||
|
@ -110,14 +117,22 @@ class DeviceRRGSB {
|
|||
void clear(); /* clean the content */
|
||||
void preload_unique_cbx_module(
|
||||
const vtr::Point<size_t>& block_coordinate,
|
||||
const std::vector<vtr::Point<size_t>>& instance_coords);
|
||||
const std::vector<vtr::Point<size_t>>&
|
||||
instance_coords); /* preload unique CBX blocks and their corresponding
|
||||
instance information. This function will be called
|
||||
when read_unique_blocks command invoked */
|
||||
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);
|
||||
void clear_unique_modules();
|
||||
const std::vector<vtr::Point<size_t>>&
|
||||
instance_coords); /* preload unique CBY blocks and their corresponding
|
||||
instance information. This function will be called
|
||||
when read_unique_blocks command invoked */
|
||||
void preload_unique_sb_module(const vtr::Point<size_t>& block_coordinate,
|
||||
const std::vector<vtr::Point<size_t>>&
|
||||
instance_coords); /* preload unique SB blocks
|
||||
and their corresponding instance information. This function
|
||||
will be called when read_unique_blocks command invoked */
|
||||
void clear_unique_modules();/* clean the content of unique blocks*/
|
||||
|
||||
private: /* Internal cleaners */
|
||||
void clear_gsb(); /* clean the content */
|
||||
|
@ -160,7 +175,7 @@ class DeviceRRGSB {
|
|||
|
||||
private: /* Internal Data */
|
||||
std::vector<std::vector<RRGSB>> rr_gsb_;
|
||||
bool is_compressed_ = false; // is_valid
|
||||
bool is_compressed_ = false; /* True if the unique blocks have been preloaded or built */
|
||||
|
||||
std::vector<std::vector<size_t>>
|
||||
gsb_unique_module_id_; /* A map from rr_gsb to its unique mirror */
|
||||
|
|
|
@ -1,14 +1,4 @@
|
|||
|
||||
/********************************************************************
|
||||
* This file includes the top-level functions of this library
|
||||
* which includes:
|
||||
* -- reads an XML file of unique blocks to the associated
|
||||
* data structures: device_rr_gsb
|
||||
* -- write device__rr_gsb's info about unique blocks to a xml file
|
||||
*******************************************************************/
|
||||
|
||||
#include <string>
|
||||
|
||||
/* Headers from pugi XML library */
|
||||
#include "pugixml.hpp"
|
||||
#include "pugixml_util.hpp"
|
||||
|
@ -29,11 +19,13 @@
|
|||
#include "write_xml_utils.h"
|
||||
|
||||
/********************************************************************
|
||||
* Parse XML codes of a <instance> to an object of device_rr_gsb
|
||||
* instance is the mirror of unique module.
|
||||
* This file includes the top-level functions of this library
|
||||
* which includes:
|
||||
* -- reads an XML file of unique blocks to the associated
|
||||
* data structures: device_rr_gsb
|
||||
*******************************************************************/
|
||||
namespace openfpga {
|
||||
|
||||
/*read the instances' coordinate of a unique block from a xml file*/
|
||||
std::vector<vtr::Point<size_t>> read_xml_unique_instance_coords(
|
||||
const pugi::xml_node& xml_block_info, const pugiutil::loc_data& loc_data) {
|
||||
std::vector<vtr::Point<size_t>> instance_coords;
|
||||
|
@ -48,6 +40,7 @@ std::vector<vtr::Point<size_t>> read_xml_unique_instance_coords(
|
|||
return instance_coords;
|
||||
}
|
||||
|
||||
/*read the unique block coordinate from a xml file */
|
||||
vtr::Point<size_t> read_xml_unique_block_coord(
|
||||
const pugi::xml_node& xml_block_info, const pugiutil::loc_data& loc_data) {
|
||||
int block_x = get_attribute(xml_block_info, "x", loc_data).as_int();
|
||||
|
@ -56,6 +49,7 @@ vtr::Point<size_t> read_xml_unique_block_coord(
|
|||
return block_coordinate;
|
||||
}
|
||||
|
||||
/*report information of read unique blocks*/
|
||||
void report_unique_module_status_read(const DeviceRRGSB& device_rr_gsb,
|
||||
bool verbose_output) {
|
||||
/* Report the stats */
|
||||
|
@ -102,9 +96,7 @@ void report_unique_module_status_read(const DeviceRRGSB& device_rr_gsb,
|
|||
1.));
|
||||
}
|
||||
|
||||
/********************************************************************
|
||||
* Parse XML codes about <unique_blocks> to an object of device_rr_gsb
|
||||
*******************************************************************/
|
||||
/*Parse XML codes about <unique_blocks> to an object of device_rr_gsb*/
|
||||
int read_xml_unique_blocks(DeviceRRGSB& device_rr_gsb, const char* file_name,
|
||||
bool verbose_output) {
|
||||
vtr::ScopedStartFinishTimer timer("Read unique blocks xml file");
|
||||
|
|
|
@ -1,14 +1,6 @@
|
|||
#ifndef READ_XML_UNIQUE_BLOCKS_H
|
||||
#define READ_XML_UNIQUE_BLOCKS_H
|
||||
|
||||
/********************************************************************
|
||||
* This file includes the top-level functions of this library
|
||||
* which includes:
|
||||
* -- reads an XML file of unique blocks to the associated
|
||||
* data structures: device_rr_gsb
|
||||
* -- write device__rr_gsb's info about unique blocks to a xml file
|
||||
*******************************************************************/
|
||||
|
||||
#include <string>
|
||||
|
||||
/* Headers from pugi XML library */
|
||||
|
@ -25,8 +17,10 @@
|
|||
#include "device_rr_gsb_utils.h"
|
||||
|
||||
/********************************************************************
|
||||
* Parse XML codes of a <instance> to an object of device_rr_gsb
|
||||
* instance is the mirror of unique module.
|
||||
* This file includes the top-level functions of this library
|
||||
* which includes:
|
||||
* -- reads an XML file of unique blocks to the associated
|
||||
* data structures: device_rr_gsb
|
||||
*******************************************************************/
|
||||
namespace openfpga {
|
||||
|
||||
|
|
|
@ -1,12 +1,4 @@
|
|||
|
||||
/********************************************************************
|
||||
* This file includes the top-level functions of this library
|
||||
* which includes:
|
||||
* -- reads an XML file of unique blocks to the associated
|
||||
* data structures: device_rr_gsb
|
||||
* -- write device__rr_gsb's info about unique blocks to a xml file
|
||||
*******************************************************************/
|
||||
|
||||
#include <string>
|
||||
|
||||
/* Headers from pugi XML library */
|
||||
|
@ -27,11 +19,17 @@
|
|||
#include "rr_gsb.h"
|
||||
#include "write_xml_unique_blocks.h"
|
||||
#include "write_xml_utils.h"
|
||||
|
||||
/********************************************************************
|
||||
* Parse XML codes of a <instance> to an object of device_rr_gsb
|
||||
* instance is the mirror of unique module.
|
||||
* This file includes the top-level functions of this library
|
||||
* which includes:
|
||||
* -- write the unique blocks' information in the associated data structures:
|
||||
*device_rr_gsb to a XML file
|
||||
*******************************************************************/
|
||||
namespace openfpga {
|
||||
|
||||
/*Write unique blocks and their corresponding instances' information from
|
||||
*device_rr_gsb to a XML file*/
|
||||
int write_xml_atom_block(std::fstream& fp,
|
||||
const std::vector<vtr::Point<size_t>>& instance_map,
|
||||
const vtr::Point<size_t>& unique_block_coord,
|
||||
|
@ -69,6 +67,7 @@ int write_xml_atom_block(std::fstream& fp,
|
|||
return openfpga::CMD_EXEC_SUCCESS;
|
||||
}
|
||||
|
||||
/* Report information about written unique blocks */
|
||||
void report_unique_module_status_write(const DeviceRRGSB& device_rr_gsb,
|
||||
bool verbose_output) {
|
||||
/* Report the stats */
|
||||
|
@ -116,6 +115,7 @@ void report_unique_module_status_write(const DeviceRRGSB& device_rr_gsb,
|
|||
1.));
|
||||
}
|
||||
|
||||
/*Top level function to write the xml file of unique blocks*/
|
||||
int write_xml_unique_blocks(const DeviceRRGSB& device_rr_gsb, const char* fname,
|
||||
bool verbose_output) {
|
||||
vtr::ScopedStartFinishTimer timer("Write unique blocks...");
|
||||
|
|
|
@ -1,14 +1,6 @@
|
|||
#ifndef WRITE_XML_UNIQUE_BLOCKS_H
|
||||
#define WRITE_XML_UNIQUE_BLOCKS_H
|
||||
|
||||
/********************************************************************
|
||||
* This file includes the top-level functions of this library
|
||||
* which includes:
|
||||
* -- reads an XML file of unique blocks to the associated
|
||||
* data structures: device_rr_gsb
|
||||
* -- write device__rr_gsb's info about unique blocks to a xml file
|
||||
*******************************************************************/
|
||||
|
||||
#include <string>
|
||||
|
||||
/* Headers from pugi XML library */
|
||||
|
@ -24,18 +16,21 @@
|
|||
#include "arch_error.h"
|
||||
#include "device_rr_gsb_utils.h"
|
||||
|
||||
/********************************************************************
|
||||
* Parse XML codes of a <instance> to an object of device_rr_gsb
|
||||
* instance is the mirror of unique module.
|
||||
*******************************************************************/
|
||||
namespace openfpga {
|
||||
|
||||
/********************************************************************
|
||||
* This file includes the top-level functions of this library
|
||||
* which includes:
|
||||
* -- write the unique blocks' information in the associated data structures:
|
||||
*device_rr_gsb to a XML file
|
||||
*******************************************************************/
|
||||
|
||||
namespace openfpga {
|
||||
int write_xml_atom_block(std::fstream& fp,
|
||||
const std::vector<vtr::Point<size_t>>& instance_map,
|
||||
const vtr::Point<size_t>& unique_block_coord,
|
||||
std::string type);
|
||||
void report_unique_module_status_write(const DeviceRRGSB& device_rr_gsb,
|
||||
bool verbose_output);
|
||||
bool verbose_output); /*report status of written info*/
|
||||
int write_xml_unique_blocks(const DeviceRRGSB& device_rr_gsb, const char* fname,
|
||||
bool verbose_output);
|
||||
} // namespace openfpga
|
||||
|
|
|
@ -1323,6 +1323,8 @@ void add_setup_command_templates(openfpga::Shell<T>& shell,
|
|||
/********************************
|
||||
* Command 'read_unique_blocks'
|
||||
*/
|
||||
/* The command should NOT be executed before
|
||||
* 'link_openfpga_arch' */
|
||||
std::vector<ShellCommandId> cmd_dependency_read_unique_blocks_command;
|
||||
cmd_dependency_read_unique_blocks_command.push_back(link_arch_cmd_id);
|
||||
add_read_unique_blocks_command_template<T>(
|
||||
|
|
Loading…
Reference in New Issue