mirror of https://github.com/openXC7/prjxray.git
Tool to decode xc7series frame addresses
Signed-off-by: Rick Altherr <kc8apf@kc8apf.net> Signed-off-by: Tim 'mithro' Ansell <mithro@mithis.com>
This commit is contained in:
parent
fd3a5d8bab
commit
bd9338da4a
|
|
@ -6,3 +6,6 @@ target_link_libraries(segmatch libprjxray gflags absl::strings)
|
|||
|
||||
add_executable(bittool bittool.cc)
|
||||
target_link_libraries(bittool libprjxray gflags absl::strings absl::span)
|
||||
|
||||
add_executable(frame_address_decoder frame_address_decoder.cc)
|
||||
target_link_libraries(frame_address_decoder libprjxray)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,43 @@
|
|||
#include <fstream>
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
|
||||
#include <prjxray/xilinx/xc7series/configuration_frame_address.h>
|
||||
|
||||
namespace xc7series = prjxray::xilinx::xc7series;
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
std::istream * input_stream = &std::cin;
|
||||
if (argc > 1) {
|
||||
auto file_stream = std::ifstream(argv[1]);
|
||||
if (file_stream) {
|
||||
input_stream = &file_stream;
|
||||
}
|
||||
}
|
||||
|
||||
for (uint32_t frame_address_raw;
|
||||
(*input_stream) >> std::hex >> frame_address_raw;
|
||||
) {
|
||||
xc7series::ConfigurationFrameAddress frame_address(frame_address_raw);
|
||||
std::cout << "["
|
||||
<< std::hex << std::showbase << std::setw(10)
|
||||
<< frame_address_raw
|
||||
<< "] "
|
||||
<< (frame_address.is_bottom_half_rows() ?
|
||||
"BOTTOM" : "TOP")
|
||||
<< " Row="
|
||||
<< std::setw(2) << std::dec
|
||||
<< static_cast<unsigned int>(frame_address.row_address())
|
||||
<< " Column="
|
||||
<< std::setw(2) << std::dec
|
||||
<< frame_address.column_address()
|
||||
<< " Minor="
|
||||
<< std::setw(2) << std::dec
|
||||
<< static_cast<unsigned int>(frame_address.minor_address())
|
||||
<< " Type="
|
||||
<< frame_address.block_type()
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
Loading…
Reference in New Issue