mirror of https://github.com/openXC7/prjxray.git
lib: xc7series: shorten accessor names
_address suffix on accessors is unnecessary and somewhat inaccurate. The returned values are indices rather than frame addresses. Signed-off-by: Rick Altherr <kc8apf@kc8apf.net>
This commit is contained in:
parent
17985d1934
commit
53d7f1f80b
|
|
@ -137,9 +137,8 @@ absl::optional<Configuration> Configuration::InitWithPackets(
|
|||
|
||||
// Bitstreams appear to have 2 frames of
|
||||
// padding between rows.
|
||||
if (next_address->row_address() !=
|
||||
current_frame_address
|
||||
.row_address()) {
|
||||
if (next_address->row() !=
|
||||
current_frame_address.row()) {
|
||||
ii += 2 * kWordsPerFrame;
|
||||
}
|
||||
current_frame_address = *next_address;
|
||||
|
|
|
|||
|
|
@ -27,9 +27,9 @@ class FrameAddress {
|
|||
|
||||
BlockType block_type() const;
|
||||
bool is_bottom_half_rows() const;
|
||||
uint8_t row_address() const;
|
||||
uint16_t column_address() const;
|
||||
uint8_t minor_address() const;
|
||||
uint8_t row() const;
|
||||
uint16_t column() const;
|
||||
uint8_t minor() const;
|
||||
|
||||
private:
|
||||
uint32_t address_;
|
||||
|
|
|
|||
|
|
@ -28,15 +28,15 @@ bool FrameAddress::is_bottom_half_rows() const {
|
|||
return bit_field_get(address_, 22, 22);
|
||||
}
|
||||
|
||||
uint8_t FrameAddress::row_address() const {
|
||||
uint8_t FrameAddress::row() const {
|
||||
return bit_field_get(address_, 21, 17);
|
||||
}
|
||||
|
||||
uint16_t FrameAddress::column_address() const {
|
||||
uint16_t FrameAddress::column() const {
|
||||
return bit_field_get(address_, 16, 7);
|
||||
}
|
||||
|
||||
uint8_t FrameAddress::minor_address() const {
|
||||
uint8_t FrameAddress::minor() const {
|
||||
return bit_field_get(address_, 6, 0);
|
||||
}
|
||||
|
||||
|
|
@ -45,10 +45,9 @@ std::ostream& operator<<(std::ostream& o, const FrameAddress& addr) {
|
|||
<< 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())
|
||||
<< static_cast<unsigned int>(addr.row()) << " Column=" << std::setw(2)
|
||||
<< std::dec << addr.column() << " Minor=" << std::setw(2) << std::dec
|
||||
<< static_cast<unsigned int>(addr.minor())
|
||||
<< " Type=" << addr.block_type();
|
||||
return o;
|
||||
}
|
||||
|
|
@ -67,9 +66,9 @@ Node convert<xc7series::FrameAddress>::encode(
|
|||
node.SetTag("xilinx/xc7series/frame_address");
|
||||
node["block_type"] = rhs.block_type();
|
||||
node["row_half"] = (rhs.is_bottom_half_rows() ? "bottom" : "top");
|
||||
node["row"] = static_cast<unsigned int>(rhs.row_address());
|
||||
node["column"] = static_cast<unsigned int>(rhs.column_address());
|
||||
node["minor"] = static_cast<unsigned int>(rhs.minor_address());
|
||||
node["row"] = static_cast<unsigned int>(rhs.row());
|
||||
node["column"] = static_cast<unsigned int>(rhs.column());
|
||||
node["minor"] = static_cast<unsigned int>(rhs.minor());
|
||||
return node;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ TEST(FrameAddressTest, YamlDecode) {
|
|||
xc7series::FrameAddress address = node.as<xc7series::FrameAddress>();
|
||||
EXPECT_EQ(address.block_type(), xc7series::BlockType::BLOCK_RAM);
|
||||
EXPECT_TRUE(address.is_bottom_half_rows());
|
||||
EXPECT_EQ(address.row_address(), 0);
|
||||
EXPECT_EQ(address.column_address(), 5);
|
||||
EXPECT_EQ(address.minor_address(), 11);
|
||||
EXPECT_EQ(address.row(), 0);
|
||||
EXPECT_EQ(address.column(), 5);
|
||||
EXPECT_EQ(address.minor(), 11);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -159,11 +159,11 @@ int main(int argc, char** argv) {
|
|||
static_cast<uint32_t>(it.first),
|
||||
static_cast<unsigned int>(it.first.block_type()),
|
||||
it.first.is_bottom_half_rows() ? 1 : 0,
|
||||
it.first.row_address(), it.first.column_address(),
|
||||
it.first.minor_address());
|
||||
it.first.row(), it.first.column(),
|
||||
it.first.minor());
|
||||
|
||||
if (FLAGS_p) {
|
||||
if (it.first.minor_address() == 0 && !pgmdata.empty())
|
||||
if (it.first.minor() == 0 && !pgmdata.empty())
|
||||
pgmsep.push_back(pgmdata.size());
|
||||
|
||||
pgmdata.push_back(std::vector<bool>());
|
||||
|
|
@ -195,12 +195,9 @@ int main(int argc, char** argv) {
|
|||
it.first.is_bottom_half_rows()
|
||||
? 1
|
||||
: 0,
|
||||
it.first
|
||||
.row_address(),
|
||||
it.first
|
||||
.column_address(),
|
||||
it.first
|
||||
.minor_address());
|
||||
it.first.row(),
|
||||
it.first.column(),
|
||||
it.first.minor());
|
||||
else
|
||||
fprintf(f,
|
||||
"bit_%08x_%03d_"
|
||||
|
|
|
|||
|
|
@ -18,17 +18,18 @@ int main(int argc, char* argv[]) {
|
|||
for (uint32_t frame_address_raw;
|
||||
(*input_stream) >> std::setbase(0) >> frame_address_raw;) {
|
||||
xc7series::FrameAddress 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;
|
||||
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())
|
||||
<< " Column=" << std::setw(2) << std::dec
|
||||
<< frame_address.column() << " Minor=" << std::setw(2)
|
||||
<< std::dec
|
||||
<< static_cast<unsigned int>(frame_address.minor())
|
||||
<< " Type=" << frame_address.block_type()
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue