[lib] now io_net_place can output .place file
This commit is contained in:
parent
a526dbee07
commit
eed6c10b0c
|
@ -61,4 +61,66 @@ void IoNetPlace::set_net_coord(const std::string& net,
|
|||
io_coords_[net][2] = z;
|
||||
}
|
||||
|
||||
int IoNetPlace::write_to_place_file(const std::string& fname,
|
||||
const bool& include_time_stamp,
|
||||
const bool& verbose) const {
|
||||
std::string timer_message = std::string("Write I/O coordinates to a place file '") + fname + std::string("'");
|
||||
|
||||
std::string dir_path = format_dir_path(find_path_dir_name(fname));
|
||||
|
||||
/* Create directories */
|
||||
create_directory(dir_path);
|
||||
|
||||
/* Start time count */
|
||||
vtr::ScopedStartFinishTimer timer(timer_message);
|
||||
|
||||
/* Use default name if user does not provide one */
|
||||
VTR_ASSERT(true != fname.empty());
|
||||
|
||||
/* Create a file handler*/
|
||||
std::fstream fp;
|
||||
/* Open a file */
|
||||
fp.open(fname, std::fstream::out | std::fstream::trunc);
|
||||
|
||||
/* Validate the file stream */
|
||||
check_file_stream(fname.c_str(), fp);
|
||||
|
||||
int err_code = 0;
|
||||
|
||||
/* Write XML head */
|
||||
fp << "# FPGA Fixed I/O placement file" << std::endl;
|
||||
fp << "# Generated by OpenFPGA" << std::endl;
|
||||
|
||||
auto end = std::chrono::system_clock::now();
|
||||
std::time_t end_time = std::chrono::system_clock::to_time_t(end);
|
||||
if (include_time_stamp) {
|
||||
fp << "# Date: " << std::ctime(&end_time) ;
|
||||
}
|
||||
|
||||
fp << "#Block Name\tx\ty\tz" << std::endl;
|
||||
fp << "#----------\t-\t-\t-" << std::endl;
|
||||
|
||||
size_t io_cnt = 0;
|
||||
|
||||
/* Walk through the fabric I/O location map data structure */
|
||||
for (auto pair : io_coords_) {
|
||||
fp << pair.first.c_str() << "\t";
|
||||
fp << pair.second[0] << "\t";
|
||||
fp << pair.second[1] << "\t";
|
||||
fp << pair.second[2] << "\n";
|
||||
io_cnt++;
|
||||
}
|
||||
|
||||
/* close a file */
|
||||
fp.close();
|
||||
|
||||
VTR_LOGV(verbose,
|
||||
"Outputted %lu I/Os to place file: %s\n",
|
||||
io_cnt,
|
||||
fname.c_str());
|
||||
|
||||
return err_code;
|
||||
}
|
||||
|
||||
|
||||
} /* end namespace openfpga */
|
||||
|
|
|
@ -34,6 +34,10 @@ class IoNetPlace {
|
|||
size_t io_x(const std::string& net) const;
|
||||
size_t io_y(const std::string& net) const;
|
||||
size_t io_z(const std::string& net) const;
|
||||
public: /* Writers */
|
||||
int write_to_place_file(const std::string& fname,
|
||||
const bool& include_time_stamp,
|
||||
const bool& verbose) const;
|
||||
public: /* Public mutators */
|
||||
void set_net_coord(const std::string& net,
|
||||
const size_t& x,
|
||||
|
|
Loading…
Reference in New Issue