read bin format mod (with bug)

This commit is contained in:
Lin 2024-09-27 18:41:30 +08:00
parent 59f1e4adc9
commit ed381692a7
9 changed files with 60 additions and 69 deletions

View File

@ -1,18 +1,18 @@
#include "mmap_file.h"
#include "vtr_error.h"
#include "vtr_util.h"
#include <fcntl.h>
#include <sys/stat.h>
#include "vtr_error.h"
#include "vtr_util.h"
#ifndef _WIN32
#include <sys/mman.h>
#include <sys/mman.h>
#endif
#include <unistd.h>
#include "kj/filesystem.h"
MmapFile::MmapFile(const std::string& file)
: size_(0) {
MmapFile::MmapFile(const std::string& file) : size_(0) {
try {
auto fs = kj::newDiskFilesystem();
auto path = fs->getCurrentPath().evalNative(file);

View File

@ -2,6 +2,7 @@
#define MMAP_FILE_H_
#include <string>
#include "capnp/message.h"
#include "kj/array.h"

View File

@ -3,10 +3,11 @@
#include <fcntl.h>
#include <unistd.h>
#include "vtr_error.h"
#include "kj/filesystem.h"
#include "vtr_error.h"
void writeMessageToFile(const std::string& file, ::capnp::MessageBuilder* builder) {
void writeMessageToFile(const std::string& file,
::capnp::MessageBuilder* builder) {
try {
auto fs = kj::newDiskFilesystem();
auto path = fs->getCurrentPath().evalNative(file);

View File

@ -3,6 +3,7 @@
#include <limits>
#include <string>
#include "capnp/serialize.h"
// Platform indepedent way to file message to a file on disk.

View File

@ -116,7 +116,7 @@ std::vector<vtr::Point<size_t>> DeviceRRGSB::get_sb_unique_block_instance_coord(
sb_unique_module_id_[location_x][location_y];
if (unique_module_id_instance == unique_module_id) {
vtr::Point<size_t> instance_coord(location_x, location_y);
if (instance_coord != unique_block_coord){
if (instance_coord != unique_block_coord) {
instance_map.push_back(instance_coord);
}
}
@ -146,7 +146,7 @@ DeviceRRGSB::get_cbx_unique_block_instance_coord(
cbx_unique_module_id_[location_x][location_y];
if (unique_module_id_instance == unique_module_id) {
vtr::Point<size_t> instance_coord(location_x, location_y);
if (instance_coord != unique_block_coord){
if (instance_coord != unique_block_coord) {
instance_map.push_back(instance_coord);
}
}
@ -176,7 +176,7 @@ DeviceRRGSB::get_cby_unique_block_instance_coord(
cby_unique_module_id_[location_x][location_y];
if (unique_module_id_instance == unique_module_id) {
vtr::Point<size_t> instance_coord(location_x, location_y);
if (instance_coord != unique_block_coord){
if (instance_coord != unique_block_coord) {
instance_map.push_back(instance_coord);
}
}

View File

@ -197,21 +197,10 @@ int read_bin_unique_blocks(DeviceRRGSB& device_rr_gsb, const char* file_name,
if (root.hasAtomInfo()) {
auto block_list = root.getAtomInfo();
for (auto unqiue_block : block_list) {
auto block_info = unique_block.getBlockInfo();
std::string type = block_info.getType().Cstr();
int block_x = block_info.getX();
int block_y = block_info.getY();
vtr::Point<size_t> block_coordinate(block_x, block_y);
if (unique_block.hasInstanceList()) {
auto instance_list = unique_block.getInstanceList();
std::vector<vtr::Point<size_t>> instance_coords;
for (auto instance : instance_list) {
int instance_x = instance.getX();
int instance_y = instance.getY();
vtr::Point<size_t> instance_coordinate(instance_x, instance_y);
instance_coords.push_back(instance_coordinate);
}
}
vtr::Point<size_t> block_coordinate =
read_bin_unique_block_coord(unique_block);
std::vector<vtr::Point<size_t>> instance_coords =
read_bin_unique_instance_coords(unique_block);
/* get block coordinate and instance coordinate, try to setup
* device_rr_gsb */
if (type == "sb") {

View File

@ -43,7 +43,7 @@ vtr::Point<size_t> read_bin_unique_block_coord(
const uniqueblockcap::BlockInfo::Reader& unique_block);
int read_bin_unique_blocks(DeviceRRGSB& device_rr_gsb, const char* file_name,
bool verbose_output)
bool verbose_output);
} // namespace openfpga
#endif

View File

@ -57,7 +57,6 @@ int write_xml_atom_block(std::fstream& fp,
fp << "/>"
<< "\n";
}
openfpga::write_tab_to_file(fp, 1);
fp << "</block>"

View File

@ -25,9 +25,9 @@
#include "report_reference.h"
#include "vtr_log.h"
#include "vtr_time.h"
#include "write_unique_blocks.h"
#include "write_xml_fabric_pin_physical_location.h"
#include "write_xml_module_name_map.h"
#include "write_unique_blocks.h"
/* begin namespace openfpga */
namespace openfpga {