lib: xc7series: ostream operator for ConfigurationFrameAddress

Writes a decoded version of the address to the stream.  Handy for logging.

Signed-off-by: Rick Altherr <kc8apf@kc8apf.net>
This commit is contained in:
Rick Altherr 2018-01-04 14:58:57 -08:00
parent a4858be23a
commit 0d2c33bf0f
2 changed files with 27 additions and 0 deletions

View File

@ -2,6 +2,7 @@
#define PRJXRAY_LIB_XILINX_XC7SERIES_CONFIGURATION_FRAME_ADDRESS_H_
#include <cstdint>
#include <ostream>
#include <prjxray/xilinx/xc7series/block_type.h>
#include <yaml-cpp/yaml.h>
@ -34,6 +35,9 @@ class ConfigurationFrameAddress {
uint32_t address_;
};
std::ostream &operator<<(
std::ostream &o, const ConfigurationFrameAddress& addr);
} // namespace xc7series
} // namespace xilinx
} // namespace prjxray

View File

@ -1,5 +1,7 @@
#include <prjxray/xilinx/xc7series/configuration_frame_address.h>
#include <iomanip>
#include <prjxray/bit_ops.h>
namespace prjxray {
@ -37,6 +39,27 @@ uint8_t ConfigurationFrameAddress::minor_address() const {
return bit_field_get(address_, 6, 0);
}
std::ostream &operator<<(
std::ostream &o, const ConfigurationFrameAddress& addr) {
o << "["
<< std::hex << std::showbase << std::setw(10)
<< static_cast<uint32_t>(addr)
<< "] "
<< (addr.is_bottom_half_rows() ? "BOTTOM" : "TOP")
<< " Row="
<< std::setw(2) << std::dec
<< static_cast<unsigned int>(addr.row_address())
<< " Column="
<< std::setw(2) << std::dec
<< addr.column_address()
<< " Minor="
<< std::setw(2) << std::dec
<< static_cast<unsigned int>(addr.minor_address())
<< " Type="
<< addr.block_type();
return o;
}
} // namespace xc7series
} // namespace xilinx
} // namespace prjxray