mirror of https://github.com/openXC7/prjxray.git
lib: xc7series: shorten ConfigurationFrameAddress to FrameAddress
Frame addresses are only used in the context of configuration frames. Remove the prefix to reduce typing that does not improve clarity. Signed-off-by: Rick Altherr <kc8apf@kc8apf.net>
This commit is contained in:
parent
6222be77d3
commit
5a664c04ec
|
|
@ -4,7 +4,7 @@ add_library(libprjxray
|
||||||
segbits_file_reader.cc
|
segbits_file_reader.cc
|
||||||
xilinx/xc7series/bitstream_reader.cc
|
xilinx/xc7series/bitstream_reader.cc
|
||||||
xilinx/xc7series/block_type.cc
|
xilinx/xc7series/block_type.cc
|
||||||
xilinx/xc7series/configuration_frame_address.cc
|
xilinx/xc7series/frame_address.cc
|
||||||
xilinx/xc7series/configuration_frame_range.cc
|
xilinx/xc7series/configuration_frame_range.cc
|
||||||
xilinx/xc7series/configuration_packet.cc
|
xilinx/xc7series/configuration_packet.cc
|
||||||
xilinx/xc7series/configuration_register.cc
|
xilinx/xc7series/configuration_register.cc
|
||||||
|
|
@ -50,12 +50,12 @@ if (PRJXRAY_BUILD_TESTING)
|
||||||
add_test(NAME xilinx_xc7series_block_type_test
|
add_test(NAME xilinx_xc7series_block_type_test
|
||||||
COMMAND xilinx_xc7series_block_type_test)
|
COMMAND xilinx_xc7series_block_type_test)
|
||||||
|
|
||||||
add_executable(xilinx_xc7series_configuration_frame_address_test
|
add_executable(xilinx_xc7series_frame_address_test
|
||||||
xilinx/xc7series/configuration_frame_address_test.cc)
|
xilinx/xc7series/frame_address_test.cc)
|
||||||
target_link_libraries(xilinx_xc7series_configuration_frame_address_test
|
target_link_libraries(xilinx_xc7series_frame_address_test
|
||||||
libprjxray gtest_main absl::span)
|
libprjxray gtest_main absl::span)
|
||||||
add_test(NAME xilinx_xc7series_configuration_frame_address_test
|
add_test(NAME xilinx_xc7series_frame_address_test
|
||||||
COMMAND xilinx_xc7series_configuration_frame_address_test)
|
COMMAND xilinx_xc7series_frame_address_test)
|
||||||
|
|
||||||
add_executable(xilinx_xc7series_configuration_test
|
add_executable(xilinx_xc7series_configuration_test
|
||||||
xilinx/xc7series/configuration_test.cc)
|
xilinx/xc7series/configuration_test.cc)
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
#include <absl/types/span.h>
|
#include <absl/types/span.h>
|
||||||
#include <prjxray/bit_ops.h>
|
#include <prjxray/bit_ops.h>
|
||||||
#include <prjxray/xilinx/xc7series/bitstream_reader.h>
|
#include <prjxray/xilinx/xc7series/bitstream_reader.h>
|
||||||
#include <prjxray/xilinx/xc7series/configuration_frame_address.h>
|
#include <prjxray/xilinx/xc7series/frame_address.h>
|
||||||
#include <prjxray/xilinx/xc7series/part.h>
|
#include <prjxray/xilinx/xc7series/part.h>
|
||||||
|
|
||||||
namespace prjxray {
|
namespace prjxray {
|
||||||
|
|
@ -15,7 +15,7 @@ namespace xc7series {
|
||||||
|
|
||||||
class Configuration {
|
class Configuration {
|
||||||
public:
|
public:
|
||||||
using FrameMap = std::map<ConfigurationFrameAddress,
|
using FrameMap = std::map<FrameAddress,
|
||||||
absl::Span<uint32_t>>;
|
absl::Span<uint32_t>>;
|
||||||
|
|
||||||
template<typename Collection>
|
template<typename Collection>
|
||||||
|
|
@ -46,7 +46,7 @@ absl::optional<Configuration> Configuration::InitWithPackets(
|
||||||
|
|
||||||
// Internal state machine for writes.
|
// Internal state machine for writes.
|
||||||
bool start_new_write = false;
|
bool start_new_write = false;
|
||||||
ConfigurationFrameAddress current_frame_address = 0;
|
FrameAddress current_frame_address = 0;
|
||||||
|
|
||||||
Configuration::FrameMap frames;
|
Configuration::FrameMap frames;
|
||||||
for (auto packet : packets) {
|
for (auto packet : packets) {
|
||||||
|
|
@ -119,8 +119,7 @@ absl::optional<Configuration> Configuration::InitWithPackets(
|
||||||
packet.data().subspan(
|
packet.data().subspan(
|
||||||
ii, kWordsPerFrame);
|
ii, kWordsPerFrame);
|
||||||
|
|
||||||
auto next_address =
|
auto next_address = part.GetNextFrameAddress(
|
||||||
part.GetNextConfigurationFrameAddress(
|
|
||||||
current_frame_address);
|
current_frame_address);
|
||||||
if (!next_address) break;
|
if (!next_address) break;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,53 +0,0 @@
|
||||||
#ifndef PRJXRAY_LIB_XILINX_XC7SERIES_CONFIGURATION_FRAME_ADDRESS_H_
|
|
||||||
#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>
|
|
||||||
|
|
||||||
namespace prjxray {
|
|
||||||
namespace xilinx {
|
|
||||||
namespace xc7series {
|
|
||||||
|
|
||||||
class ConfigurationFrameAddress {
|
|
||||||
public:
|
|
||||||
ConfigurationFrameAddress()
|
|
||||||
: address_(0) {}
|
|
||||||
|
|
||||||
ConfigurationFrameAddress(uint32_t address)
|
|
||||||
: address_(address) {};
|
|
||||||
|
|
||||||
ConfigurationFrameAddress(
|
|
||||||
BlockType block_type, bool is_bottom_half_rows,
|
|
||||||
uint8_t row, uint16_t column, uint8_t minor);
|
|
||||||
|
|
||||||
operator uint32_t() const { return address_; }
|
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
private:
|
|
||||||
uint32_t address_;
|
|
||||||
};
|
|
||||||
|
|
||||||
std::ostream &operator<<(
|
|
||||||
std::ostream &o, const ConfigurationFrameAddress& addr);
|
|
||||||
|
|
||||||
} // namespace xc7series
|
|
||||||
} // namespace xilinx
|
|
||||||
} // namespace prjxray
|
|
||||||
|
|
||||||
namespace YAML {
|
|
||||||
template<>
|
|
||||||
struct convert<prjxray::xilinx::xc7series::ConfigurationFrameAddress> {
|
|
||||||
static Node encode(const prjxray::xilinx::xc7series::ConfigurationFrameAddress &rhs);
|
|
||||||
static bool decode(const Node& node,
|
|
||||||
prjxray::xilinx::xc7series::ConfigurationFrameAddress &lhs);
|
|
||||||
};
|
|
||||||
} // namespace YAML
|
|
||||||
#endif // PRJXRAY_LIB_XILINX_XC7SERIES_CONFIGURATION_FRAME_ADDRESS_H_
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
#include <prjxray/xilinx/xc7series/configuration_frame_address.h>
|
#include <prjxray/xilinx/xc7series/frame_address.h>
|
||||||
#include <yaml-cpp/yaml.h>
|
#include <yaml-cpp/yaml.h>
|
||||||
|
|
||||||
namespace prjxray {
|
namespace prjxray {
|
||||||
|
|
@ -14,21 +14,20 @@ class ConfigurationFrameRange {
|
||||||
public:
|
public:
|
||||||
ConfigurationFrameRange() : begin_(0), end_(0) {}
|
ConfigurationFrameRange() : begin_(0), end_(0) {}
|
||||||
|
|
||||||
ConfigurationFrameRange(ConfigurationFrameAddress begin,
|
ConfigurationFrameRange(FrameAddress begin, FrameAddress end)
|
||||||
ConfigurationFrameAddress end)
|
|
||||||
: begin_(begin), end_(end) {};
|
: begin_(begin), end_(end) {};
|
||||||
|
|
||||||
ConfigurationFrameAddress begin() const { return begin_; }
|
FrameAddress begin() const { return begin_; }
|
||||||
ConfigurationFrameAddress end() const { return end_; }
|
FrameAddress end() const { return end_; }
|
||||||
|
|
||||||
size_t size() const { return end_ - begin_; }
|
size_t size() const { return end_ - begin_; }
|
||||||
bool empty() const { return size() == 0; }
|
bool empty() const { return size() == 0; }
|
||||||
|
|
||||||
bool Contains(ConfigurationFrameAddress address) const;
|
bool Contains(FrameAddress address) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ConfigurationFrameAddress begin_;
|
FrameAddress begin_;
|
||||||
ConfigurationFrameAddress end_;
|
FrameAddress end_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace xc7series
|
} // namespace xc7series
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,50 @@
|
||||||
|
#ifndef PRJXRAY_LIB_XILINX_XC7SERIES_FRAME_ADDRESS_H_
|
||||||
|
#define PRJXRAY_LIB_XILINX_XC7SERIES_FRAME_ADDRESS_H_
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
#include <ostream>
|
||||||
|
|
||||||
|
#include <prjxray/xilinx/xc7series/block_type.h>
|
||||||
|
#include <yaml-cpp/yaml.h>
|
||||||
|
|
||||||
|
namespace prjxray {
|
||||||
|
namespace xilinx {
|
||||||
|
namespace xc7series {
|
||||||
|
|
||||||
|
class FrameAddress {
|
||||||
|
public:
|
||||||
|
FrameAddress() : address_(0) {}
|
||||||
|
|
||||||
|
FrameAddress(uint32_t address)
|
||||||
|
: address_(address) {};
|
||||||
|
|
||||||
|
FrameAddress(BlockType block_type, bool is_bottom_half_rows,
|
||||||
|
uint8_t row, uint16_t column, uint8_t minor);
|
||||||
|
|
||||||
|
operator uint32_t() const { return address_; }
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
private:
|
||||||
|
uint32_t address_;
|
||||||
|
};
|
||||||
|
|
||||||
|
std::ostream &operator<<(std::ostream &o, const FrameAddress& addr);
|
||||||
|
|
||||||
|
} // namespace xc7series
|
||||||
|
} // namespace xilinx
|
||||||
|
} // namespace prjxray
|
||||||
|
|
||||||
|
namespace YAML {
|
||||||
|
template<>
|
||||||
|
struct convert<prjxray::xilinx::xc7series::FrameAddress> {
|
||||||
|
static Node encode(const prjxray::xilinx::xc7series::FrameAddress &rhs);
|
||||||
|
static bool decode(const Node& node,
|
||||||
|
prjxray::xilinx::xc7series::FrameAddress &lhs);
|
||||||
|
};
|
||||||
|
} // namespace YAML
|
||||||
|
#endif // PRJXRAY_LIB_XILINX_XC7SERIES_FRAME_ADDRESS_H_
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <absl/types/optional.h>
|
#include <absl/types/optional.h>
|
||||||
#include <prjxray/xilinx/xc7series/configuration_frame_address.h>
|
#include <prjxray/xilinx/xc7series/frame_address.h>
|
||||||
#include <prjxray/xilinx/xc7series/configuration_frame_range.h>
|
#include <prjxray/xilinx/xc7series/configuration_frame_range.h>
|
||||||
|
|
||||||
namespace prjxray {
|
namespace prjxray {
|
||||||
|
|
@ -28,9 +28,8 @@ class Part {
|
||||||
const std::vector<ConfigurationFrameRange>&
|
const std::vector<ConfigurationFrameRange>&
|
||||||
configuration_frame_ranges() const { return frame_ranges_; }
|
configuration_frame_ranges() const { return frame_ranges_; }
|
||||||
|
|
||||||
absl::optional<ConfigurationFrameAddress>
|
absl::optional<FrameAddress>
|
||||||
GetNextConfigurationFrameAddress(
|
GetNextFrameAddress(FrameAddress address) const;
|
||||||
ConfigurationFrameAddress address) const;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint32_t idcode_;
|
uint32_t idcode_;
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,7 @@ namespace prjxray {
|
||||||
namespace xilinx {
|
namespace xilinx {
|
||||||
namespace xc7series {
|
namespace xc7series {
|
||||||
|
|
||||||
bool ConfigurationFrameRange::Contains(
|
bool ConfigurationFrameRange::Contains(FrameAddress address) const {
|
||||||
ConfigurationFrameAddress address) const {
|
|
||||||
return address >= begin_ && address < end_;
|
return address >= begin_ && address < end_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -34,8 +33,8 @@ bool convert<xc7series::ConfigurationFrameRange>::decode(
|
||||||
!node["end"]) return false;
|
!node["end"]) return false;
|
||||||
|
|
||||||
lhs = xc7series::ConfigurationFrameRange(
|
lhs = xc7series::ConfigurationFrameRange(
|
||||||
node["begin"].as<xc7series::ConfigurationFrameAddress>(),
|
node["begin"].as<xc7series::FrameAddress>(),
|
||||||
node["end"].as<xc7series::ConfigurationFrameAddress>());
|
node["end"].as<xc7series::FrameAddress>());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#include <prjxray/xilinx/xc7series/configuration_frame_address.h>
|
#include <prjxray/xilinx/xc7series/frame_address.h>
|
||||||
|
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
|
|
||||||
|
|
@ -8,10 +8,8 @@ namespace prjxray {
|
||||||
namespace xilinx {
|
namespace xilinx {
|
||||||
namespace xc7series {
|
namespace xc7series {
|
||||||
|
|
||||||
|
FrameAddress::FrameAddress(BlockType block_type, bool is_bottom_half_rows,
|
||||||
ConfigurationFrameAddress::ConfigurationFrameAddress(
|
uint8_t row, uint16_t column, uint8_t minor) {
|
||||||
BlockType block_type, bool is_bottom_half_rows,
|
|
||||||
uint8_t row, uint16_t column, uint8_t minor) {
|
|
||||||
address_ = bit_field_set(0, 25, 23, block_type);
|
address_ = bit_field_set(0, 25, 23, block_type);
|
||||||
address_ = bit_field_set(address_, 22, 22, is_bottom_half_rows);
|
address_ = bit_field_set(address_, 22, 22, is_bottom_half_rows);
|
||||||
address_ = bit_field_set(address_, 21, 17, row);
|
address_ = bit_field_set(address_, 21, 17, row);
|
||||||
|
|
@ -19,28 +17,27 @@ ConfigurationFrameAddress::ConfigurationFrameAddress(
|
||||||
address_ = bit_field_set(address_, 6, 0, minor);
|
address_ = bit_field_set(address_, 6, 0, minor);
|
||||||
}
|
}
|
||||||
|
|
||||||
BlockType ConfigurationFrameAddress::block_type() const {
|
BlockType FrameAddress::block_type() const {
|
||||||
return static_cast<BlockType>(bit_field_get(address_, 25, 23));
|
return static_cast<BlockType>(bit_field_get(address_, 25, 23));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ConfigurationFrameAddress::is_bottom_half_rows() const {
|
bool FrameAddress::is_bottom_half_rows() const {
|
||||||
return bit_field_get(address_, 22, 22);
|
return bit_field_get(address_, 22, 22);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t ConfigurationFrameAddress::row_address() const {
|
uint8_t FrameAddress::row_address() const {
|
||||||
return bit_field_get(address_, 21, 17);
|
return bit_field_get(address_, 21, 17);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t ConfigurationFrameAddress::column_address() const {
|
uint16_t FrameAddress::column_address() const {
|
||||||
return bit_field_get(address_, 16, 7);
|
return bit_field_get(address_, 16, 7);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t ConfigurationFrameAddress::minor_address() const {
|
uint8_t FrameAddress::minor_address() const {
|
||||||
return bit_field_get(address_, 6, 0);
|
return bit_field_get(address_, 6, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::ostream &operator<<(
|
std::ostream &operator<<(std::ostream &o, const FrameAddress& addr) {
|
||||||
std::ostream &o, const ConfigurationFrameAddress& addr) {
|
|
||||||
o << "["
|
o << "["
|
||||||
<< std::hex << std::showbase << std::setw(10)
|
<< std::hex << std::showbase << std::setw(10)
|
||||||
<< static_cast<uint32_t>(addr)
|
<< static_cast<uint32_t>(addr)
|
||||||
|
|
@ -68,10 +65,10 @@ namespace YAML {
|
||||||
|
|
||||||
namespace xc7series = prjxray::xilinx::xc7series;
|
namespace xc7series = prjxray::xilinx::xc7series;
|
||||||
|
|
||||||
Node convert<xc7series::ConfigurationFrameAddress>::encode(
|
Node convert<xc7series::FrameAddress>::encode(
|
||||||
const xc7series::ConfigurationFrameAddress &rhs) {
|
const xc7series::FrameAddress &rhs) {
|
||||||
Node node;
|
Node node;
|
||||||
node.SetTag("xilinx/xc7series/configuration_frame_address");
|
node.SetTag("xilinx/xc7series/frame_address");
|
||||||
node["block_type"] = rhs.block_type();
|
node["block_type"] = rhs.block_type();
|
||||||
node["row_half"] = (rhs.is_bottom_half_rows() ? "bottom" : "top");
|
node["row_half"] = (rhs.is_bottom_half_rows() ? "bottom" : "top");
|
||||||
node["row"] = static_cast<unsigned int>(rhs.row_address());
|
node["row"] = static_cast<unsigned int>(rhs.row_address());
|
||||||
|
|
@ -80,9 +77,10 @@ Node convert<xc7series::ConfigurationFrameAddress>::encode(
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool convert<xc7series::ConfigurationFrameAddress>::decode(
|
bool convert<xc7series::FrameAddress>::decode(
|
||||||
const Node &node, xc7series::ConfigurationFrameAddress &lhs) {
|
const Node &node, xc7series::FrameAddress &lhs) {
|
||||||
if (node.Tag() != "xilinx/xc7series/configuration_frame_address" ||
|
if (!(node.Tag() == "xilinx/xc7series/frame_address" ||
|
||||||
|
node.Tag() == "xilinx/xc7series/configuration_frame_address") ||
|
||||||
!node["block_type"] ||
|
!node["block_type"] ||
|
||||||
!node["row_half"] ||
|
!node["row_half"] ||
|
||||||
!node["row"] ||
|
!node["row"] ||
|
||||||
|
|
@ -98,7 +96,7 @@ bool convert<xc7series::ConfigurationFrameAddress>::decode(
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
lhs = prjxray::xilinx::xc7series::ConfigurationFrameAddress(
|
lhs = prjxray::xilinx::xc7series::FrameAddress(
|
||||||
node["block_type"].as<xc7series::BlockType>(),
|
node["block_type"].as<xc7series::BlockType>(),
|
||||||
row_half,
|
row_half,
|
||||||
node["row"].as<unsigned int>(),
|
node["row"].as<unsigned int>(),
|
||||||
|
|
@ -1,17 +1,16 @@
|
||||||
#include <prjxray/xilinx/xc7series/configuration_frame_address.h>
|
#include <prjxray/xilinx/xc7series/frame_address.h>
|
||||||
|
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
namespace xc7series = prjxray::xilinx::xc7series;
|
namespace xc7series = prjxray::xilinx::xc7series;
|
||||||
|
|
||||||
TEST(ConfigurationFrameAddressTest, YamlEncode) {
|
TEST(FrameAddressTest, YamlEncode) {
|
||||||
xc7series::ConfigurationFrameAddress address(
|
xc7series::FrameAddress address(xc7series::BlockType::BLOCK_RAM,
|
||||||
xc7series::BlockType::BLOCK_RAM,
|
false, 10, 0, 5);
|
||||||
false, 10, 0, 5);
|
|
||||||
|
|
||||||
YAML::Node node(address);
|
YAML::Node node(address);
|
||||||
|
|
||||||
EXPECT_EQ(node.Tag(), "xilinx/xc7series/configuration_frame_address");
|
EXPECT_EQ(node.Tag(), "xilinx/xc7series/frame_address");
|
||||||
EXPECT_EQ(node["block_type"].as<std::string>(), "BLOCK_RAM");
|
EXPECT_EQ(node["block_type"].as<std::string>(), "BLOCK_RAM");
|
||||||
EXPECT_EQ(node["row_half"].as<std::string>(), "top");
|
EXPECT_EQ(node["row_half"].as<std::string>(), "top");
|
||||||
EXPECT_EQ(node["row"].as<std::string>(), "10");
|
EXPECT_EQ(node["row"].as<std::string>(), "10");
|
||||||
|
|
@ -19,17 +18,17 @@ TEST(ConfigurationFrameAddressTest, YamlEncode) {
|
||||||
EXPECT_EQ(node["minor"].as<std::string>(), "5");
|
EXPECT_EQ(node["minor"].as<std::string>(), "5");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(ConfigurationFrameAddressTest, YamlDecode) {
|
TEST(FrameAddressTest, YamlDecode) {
|
||||||
YAML::Node node;
|
YAML::Node node;
|
||||||
node.SetTag("xilinx/xc7series/configuration_frame_address");
|
node.SetTag("xilinx/xc7series/frame_address");
|
||||||
node["block_type"] = "BLOCK_RAM";
|
node["block_type"] = "BLOCK_RAM";
|
||||||
node["row_half"] = "bottom";
|
node["row_half"] = "bottom";
|
||||||
node["row"] = "0";
|
node["row"] = "0";
|
||||||
node["column"] = "5";
|
node["column"] = "5";
|
||||||
node["minor"] = "11";
|
node["minor"] = "11";
|
||||||
|
|
||||||
xc7series::ConfigurationFrameAddress address =
|
xc7series::FrameAddress address =
|
||||||
node.as<xc7series::ConfigurationFrameAddress>();
|
node.as<xc7series::FrameAddress>();
|
||||||
EXPECT_EQ(address.block_type(), xc7series::BlockType::BLOCK_RAM);
|
EXPECT_EQ(address.block_type(), xc7series::BlockType::BLOCK_RAM);
|
||||||
EXPECT_TRUE(address.is_bottom_half_rows());
|
EXPECT_TRUE(address.is_bottom_half_rows());
|
||||||
EXPECT_EQ(address.row_address(), 0);
|
EXPECT_EQ(address.row_address(), 0);
|
||||||
|
|
@ -16,16 +16,16 @@ absl::optional<Part> Part::FromFile(const std::string &path) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
absl::optional<ConfigurationFrameAddress>
|
absl::optional<FrameAddress>
|
||||||
Part::GetNextConfigurationFrameAddress(ConfigurationFrameAddress address) const {
|
Part::GetNextFrameAddress(FrameAddress address) const {
|
||||||
// Start with the next linear address.
|
// Start with the next linear address.
|
||||||
ConfigurationFrameAddress target_address(address + 1);
|
FrameAddress target_address(address + 1);
|
||||||
|
|
||||||
// The address space is non-continguous. If the next linear address
|
// The address space is non-continguous. If the next linear address
|
||||||
// happens to fall in a valid range, that's the next address.
|
// happens to fall in a valid range, that's the next address.
|
||||||
// Otherwise, find the closest valid range and use it's beginning
|
// Otherwise, find the closest valid range and use it's beginning
|
||||||
// address.
|
// address.
|
||||||
absl::optional<ConfigurationFrameAddress> closest_address;
|
absl::optional<FrameAddress> closest_address;
|
||||||
int32_t closest_distance;
|
int32_t closest_distance;
|
||||||
for (auto iter = frame_ranges_.begin();
|
for (auto iter = frame_ranges_.begin();
|
||||||
iter != frame_ranges_.end();
|
iter != frame_ranges_.end();
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ TEST(PartTest, GetNextAddressWhereNextIsInValidRange) {
|
||||||
|
|
||||||
xc7series::Part part(0x1234, ranges);
|
xc7series::Part part(0x1234, ranges);
|
||||||
|
|
||||||
auto next_address = part.GetNextConfigurationFrameAddress(0x4);
|
auto next_address = part.GetNextFrameAddress(0x4);
|
||||||
EXPECT_TRUE(next_address);
|
EXPECT_TRUE(next_address);
|
||||||
EXPECT_EQ(static_cast<uint32_t>(0x5), *next_address);
|
EXPECT_EQ(static_cast<uint32_t>(0x5), *next_address);
|
||||||
}
|
}
|
||||||
|
|
@ -23,7 +23,7 @@ TEST(PartTest, GetNextAddressWhereNextIsBetweenRanges) {
|
||||||
|
|
||||||
xc7series::Part part(0x1234, ranges);
|
xc7series::Part part(0x1234, ranges);
|
||||||
|
|
||||||
auto next_address = part.GetNextConfigurationFrameAddress(0xF);
|
auto next_address = part.GetNextFrameAddress(0xF);
|
||||||
EXPECT_TRUE(next_address);
|
EXPECT_TRUE(next_address);
|
||||||
EXPECT_EQ(static_cast<uint32_t>(0x20), *next_address);
|
EXPECT_EQ(static_cast<uint32_t>(0x20), *next_address);
|
||||||
}
|
}
|
||||||
|
|
@ -35,6 +35,6 @@ TEST(PartTest, GetNextAddressWhereNextWouldBePastLastRange) {
|
||||||
|
|
||||||
xc7series::Part part(0x1234, ranges);
|
xc7series::Part part(0x1234, ranges);
|
||||||
|
|
||||||
auto next_address = part.GetNextConfigurationFrameAddress(0x2F);
|
auto next_address = part.GetNextFrameAddress(0x2F);
|
||||||
EXPECT_FALSE(next_address);
|
EXPECT_FALSE(next_address);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include <prjxray/xilinx/xc7series/configuration_frame_address.h>
|
#include <prjxray/xilinx/xc7series/frame_address.h>
|
||||||
|
|
||||||
namespace xc7series = prjxray::xilinx::xc7series;
|
namespace xc7series = prjxray::xilinx::xc7series;
|
||||||
|
|
||||||
|
|
@ -18,7 +18,7 @@ int main(int argc, char *argv[]) {
|
||||||
for (uint32_t frame_address_raw;
|
for (uint32_t frame_address_raw;
|
||||||
(*input_stream) >> std::setbase(0) >> frame_address_raw;
|
(*input_stream) >> std::setbase(0) >> frame_address_raw;
|
||||||
) {
|
) {
|
||||||
xc7series::ConfigurationFrameAddress frame_address(frame_address_raw);
|
xc7series::FrameAddress frame_address(frame_address_raw);
|
||||||
std::cout << "["
|
std::cout << "["
|
||||||
<< std::hex << std::showbase << std::setw(10)
|
<< std::hex << std::showbase << std::setw(10)
|
||||||
<< frame_address_raw
|
<< frame_address_raw
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@
|
||||||
#include <absl/types/span.h>
|
#include <absl/types/span.h>
|
||||||
#include <prjxray/memory_mapped_file.h>
|
#include <prjxray/memory_mapped_file.h>
|
||||||
#include <prjxray/xilinx/xc7series/bitstream_reader.h>
|
#include <prjxray/xilinx/xc7series/bitstream_reader.h>
|
||||||
#include <prjxray/xilinx/xc7series/configuration_frame_address.h>
|
|
||||||
#include <prjxray/xilinx/xc7series/configuration_frame_range.h>
|
#include <prjxray/xilinx/xc7series/configuration_frame_range.h>
|
||||||
#include <prjxray/xilinx/xc7series/part.h>
|
#include <prjxray/xilinx/xc7series/part.h>
|
||||||
#include <yaml-cpp/yaml.h>
|
#include <yaml-cpp/yaml.h>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue