gen_part_base_yaml.cc: Added the possibility to read FAR registers

For xc7z boards the Debug bitstream is unavailable. To get the necessary
information we can use the FAR addresses present in the perframecrc
bitstream.
The gen_part_base_yaml tool has been modified to have the possibility to
read the FAR addresses depending on a flag setting.

Signed-off-by: Alessandro Comodi <acomodi@antmicro.com>
This commit is contained in:
Alessandro Comodi 2018-12-20 15:39:32 +01:00 committed by Karol Gugala
parent bc53d824fa
commit 8537b9c9a5
2 changed files with 20 additions and 4 deletions

View File

@ -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

View File

@ -6,8 +6,10 @@
#include <memory>
#include <vector>
#include <absl/strings/str_cat.h>
#include <absl/types/optional.h>
#include <absl/types/span.h>
#include <gflags/gflags.h>
#include <prjxray/memory_mapped_file.h>
#include <prjxray/xilinx/xc7series/bitstream_reader.h>
#include <prjxray/xilinx/xc7series/frame_address.h>
@ -15,9 +17,15 @@
#include <prjxray/xilinx/xc7series/part.h>
#include <yaml-cpp/yaml.h>
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]) << " <bit_file>"
@ -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;
}