diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 85023a91..1a0bec1b 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -16,8 +16,8 @@ target_link_libraries(gen_part_base_yaml absl::span libprjxray yaml-cpp + gflags ) - add_executable(xc7patch xc7patch.cc) target_link_libraries(xc7patch absl::strings diff --git a/tools/gen_part_base_yaml.cc b/tools/gen_part_base_yaml.cc index 9767bce2..a215e639 100644 --- a/tools/gen_part_base_yaml.cc +++ b/tools/gen_part_base_yaml.cc @@ -6,8 +6,10 @@ #include #include +#include #include #include +#include #include #include #include @@ -15,9 +17,15 @@ #include #include +DEFINE_bool(f, false, "Use FAR registers instead of LOUT ones"); + namespace xc7series = prjxray::xilinx::xc7series; int main(int argc, char* argv[]) { + gflags::SetUsageMessage( + absl::StrCat("Usage: ", argv[0], " [bitfile] [options]")); + gflags::ParseCommandLineFlags(&argc, &argv, true); + if (argc < 2) { std::cerr << "ERROR: no input specified" << std::endl; std::cerr << "Usage: " << basename(argv[0]) << " " @@ -59,8 +67,15 @@ int main(int argc, char* argv[]) { } else if (found_fdri_write && (packet.address() == xc7series::ConfigurationRegister::LOUT) && - packet.data().size() == 1) { + (packet.data().size() == 1) && FLAGS_f == false) { frame_addresses.push_back(packet.data()[0]); + found_fdri_write = false; + } else if (found_fdri_write && + (packet.address() == + xc7series::ConfigurationRegister::FAR) && + (packet.data().size() == 1) && FLAGS_f == true) { + frame_addresses.push_back(packet.data()[0]); + found_fdri_write = false; } } @@ -70,8 +85,9 @@ int main(int argc, char* argv[]) { } if (frame_addresses.empty()) { - std::cerr << "No LOUT writes found. Was " - << "BITSTREAM.GENERAL.DEBUGBITSTREAM set to YES?" + std::cerr << "No LOUT or FAR writes found. Was " + << "BITSTREAM.GENERAL.DEBUGBITSTREAM or " + << "BITSTREAM.GENERAL.PERFRAMECRC set to YES?" << std::endl; return 1; }