diff --git a/libopenfpga/libpcf/CMakeLists.txt b/libopenfpga/libpcf/CMakeLists.txt index 49314b259..5b1504de1 100644 --- a/libopenfpga/libpcf/CMakeLists.txt +++ b/libopenfpga/libpcf/CMakeLists.txt @@ -12,6 +12,8 @@ endif(CSV_CXX_STANDARD) option(BUILD_PYTHON "Build Python Binding" OFF) message("Building CSV library using C++${CMAKE_CXX_STANDARD}") +set(THREADS_PREFER_PTHREAD_FLAG TRUE) +find_package(Threads QUIET REQUIRED) # Defines CSV_HAS_CXX17 in compatibility.hpp if (CMAKE_VERSION VERSION_LESS "3.12.0") diff --git a/libopenfpga/libpcf/src/base/io_pin_table.cpp b/libopenfpga/libpcf/src/base/io_pin_table.cpp index 742e5cf32..94f47280d 100644 --- a/libopenfpga/libpcf/src/base/io_pin_table.cpp +++ b/libopenfpga/libpcf/src/base/io_pin_table.cpp @@ -22,7 +22,7 @@ IoPinTable::IoPinTable() { /************************************************************************ * Public Accessors : aggregates ***********************************************************************/ -IoPinTable::io_pin_table_range IoPinTable::internal_pins() const { +IoPinTable::io_pin_table_range IoPinTable::pins() const { return vtr::make_range(pin_ids_.begin(), pin_ids_.end()); } diff --git a/libopenfpga/libpcf/src/base/io_pin_table.h b/libopenfpga/libpcf/src/base/io_pin_table.h index 879e3f259..4b863530c 100644 --- a/libopenfpga/libpcf/src/base/io_pin_table.h +++ b/libopenfpga/libpcf/src/base/io_pin_table.h @@ -70,7 +70,7 @@ class IoPinTable { /* Walk through the internal pins. We do not walk through external pins because they are not unique in the table. * An external pin may be accessible by two internal pins */ - io_pin_table_range internal_pins() const; + io_pin_table_range pins() const; public: /* Public Accessors: Basic data query */ /* Get the basic information for a pin */ openfpga::BasicPort internal_pin(const IoPinTableId& pin_id) const; diff --git a/libopenfpga/libpcf/src/io/write_csv_io_pin_table.cpp b/libopenfpga/libpcf/src/io/write_csv_io_pin_table.cpp index eaf307ba3..c2dbed1be 100644 --- a/libopenfpga/libpcf/src/io/write_csv_io_pin_table.cpp +++ b/libopenfpga/libpcf/src/io/write_csv_io_pin_table.cpp @@ -45,16 +45,16 @@ int write_csv_io_pin_table(const char* fname, /* Print head row */ std::vector head_row_str({"orientation", "port_name", "mapped_pin", "direction"}); - writer << head_row_str << "\n"; + writer << head_row_str; /* Print data */ for (const IoPinTableId& pin_id : io_pin_table.pins()) { std::vector data_row_str; - data_row_str.append(SIDE_STRING[io_pin_table.pin_side(pin_id)]); - data_row_str.append(generate_xml_port_name(io_pin_table.internal_pin(pin_id))); - data_row_str.append(generate_xml_port_name(io_pin_table.external_pin(pin_id))); - data_row_str.append(IO_DIRECTION_STRING[io_pin_table.pin_direction(pin_id)]); - writer << data_row_str << "\n"; + data_row_str.push_back(SIDE_STRING[io_pin_table.pin_side(pin_id)]); + data_row_str.push_back(generate_xml_port_name(io_pin_table.internal_pin(pin_id))); + data_row_str.push_back(generate_xml_port_name(io_pin_table.external_pin(pin_id))); + data_row_str.push_back(IO_DIRECTION_STRING[io_pin_table.pin_direction(pin_id)]); + writer << data_row_str; } return 0; diff --git a/libopenfpga/libpcf/test/test_csv_io_pin_table.cpp b/libopenfpga/libpcf/test/test_csv_io_pin_table.cpp index bc45ffe34..ce6c31f67 100644 --- a/libopenfpga/libpcf/test/test_csv_io_pin_table.cpp +++ b/libopenfpga/libpcf/test/test_csv_io_pin_table.cpp @@ -16,7 +16,7 @@ int main(int argc, const char** argv) { VTR_ASSERT((2 == argc) || (3 == argc)); /* Parse the fabric key from an XML file */ - openfpga::IoPinTable io_pin_table = openfpga::read_csv_io_io_pin_table(argv[1]); + openfpga::IoPinTable io_pin_table = openfpga::read_csv_io_pin_table(argv[1]); VTR_LOG("Read the I/O pin table from a csv file: %s.\n", argv[1]); @@ -24,7 +24,7 @@ int main(int argc, const char** argv) { * This is optional only used when there is a second argument */ if (3 <= argc) { - write_csv_io_pin_table(std::string(argv[2]), io_pin_table); + write_csv_io_pin_table(argv[2], io_pin_table); VTR_LOG("Echo the I/O pin table to a csv file: %s.\n", argv[2]); }