mirror of https://github.com/openXC7/prjxray.git
Refactor Configuration::createType2ConfigurationPacketData template method
Signed-off-by: Tomasz Michalak <tmichalak@antmicro.com>
This commit is contained in:
parent
d91b0a5006
commit
170169b01c
|
|
@ -65,6 +65,35 @@ class Configuration {
|
|||
FrameMap frames_;
|
||||
};
|
||||
|
||||
template <typename ArchType>
|
||||
typename Configuration<ArchType>::PacketData
|
||||
Configuration<ArchType>::createType2ConfigurationPacketData(
|
||||
const typename Frames<ArchType>::Frames2Data& frames,
|
||||
absl::optional<typename ArchType::Part>& part) {
|
||||
PacketData packet_data;
|
||||
// Certain configuration frames blocks are separated by Zero Frames,
|
||||
// i.e. frames with words with all zeroes. For Series-7, US and US+
|
||||
// there zero frames separator consists of two frames.
|
||||
static const int kZeroFramesSeparatorWords =
|
||||
ArchType::words_per_frame * 2;
|
||||
for (auto& frame : frames) {
|
||||
std::copy(frame.second.begin(), frame.second.end(),
|
||||
std::back_inserter(packet_data));
|
||||
|
||||
auto next_address = part->GetNextFrameAddress(frame.first);
|
||||
if (next_address &&
|
||||
(next_address->block_type() != frame.first.block_type() ||
|
||||
next_address->is_bottom_half_rows() !=
|
||||
frame.first.is_bottom_half_rows() ||
|
||||
next_address->row() != frame.first.row())) {
|
||||
packet_data.insert(packet_data.end(),
|
||||
kZeroFramesSeparatorWords, 0);
|
||||
}
|
||||
}
|
||||
packet_data.insert(packet_data.end(), kZeroFramesSeparatorWords, 0);
|
||||
return packet_data;
|
||||
}
|
||||
|
||||
template <typename ArchType>
|
||||
template <typename Collection>
|
||||
absl::optional<Configuration<ArchType>>
|
||||
|
|
|
|||
|
|
@ -18,80 +18,6 @@
|
|||
namespace prjxray {
|
||||
namespace xilinx {
|
||||
|
||||
template <>
|
||||
Configuration<Series7>::PacketData
|
||||
Configuration<Series7>::createType2ConfigurationPacketData(
|
||||
const Frames<Series7>::Frames2Data& frames,
|
||||
absl::optional<Series7::Part>& part) {
|
||||
PacketData packet_data;
|
||||
for (auto& frame : frames) {
|
||||
std::copy(frame.second.begin(), frame.second.end(),
|
||||
std::back_inserter(packet_data));
|
||||
|
||||
auto next_address = part->GetNextFrameAddress(frame.first);
|
||||
if (next_address &&
|
||||
(next_address->block_type() != frame.first.block_type() ||
|
||||
next_address->is_bottom_half_rows() !=
|
||||
frame.first.is_bottom_half_rows() ||
|
||||
next_address->row() != frame.first.row())) {
|
||||
packet_data.insert(packet_data.end(), 202, 0);
|
||||
}
|
||||
}
|
||||
packet_data.insert(packet_data.end(), 202, 0);
|
||||
return packet_data;
|
||||
}
|
||||
|
||||
template <>
|
||||
Configuration<UltraScale>::PacketData
|
||||
Configuration<UltraScale>::createType2ConfigurationPacketData(
|
||||
const Frames<UltraScale>::Frames2Data& frames,
|
||||
absl::optional<UltraScale::Part>& part) {
|
||||
PacketData packet_data;
|
||||
for (auto& frame : frames) {
|
||||
std::copy(frame.second.begin(), frame.second.end(),
|
||||
std::back_inserter(packet_data));
|
||||
|
||||
auto next_address = part->GetNextFrameAddress(frame.first);
|
||||
if (next_address &&
|
||||
(next_address->block_type() != frame.first.block_type() ||
|
||||
next_address->is_bottom_half_rows() !=
|
||||
frame.first.is_bottom_half_rows() ||
|
||||
next_address->row() != frame.first.row())) {
|
||||
packet_data.insert(packet_data.end(),
|
||||
UltraScale::words_per_frame * 2, 0);
|
||||
}
|
||||
}
|
||||
packet_data.insert(packet_data.end(), UltraScale::words_per_frame * 2,
|
||||
0);
|
||||
return packet_data;
|
||||
}
|
||||
|
||||
template <>
|
||||
Configuration<UltraScalePlus>::PacketData
|
||||
Configuration<UltraScalePlus>::createType2ConfigurationPacketData(
|
||||
const Frames<UltraScalePlus>::Frames2Data& frames,
|
||||
absl::optional<UltraScalePlus::Part>& part) {
|
||||
PacketData packet_data;
|
||||
for (auto& frame : frames) {
|
||||
std::copy(frame.second.begin(), frame.second.end(),
|
||||
std::back_inserter(packet_data));
|
||||
|
||||
auto next_address = part->GetNextFrameAddress(frame.first);
|
||||
if (next_address &&
|
||||
(next_address->block_type() != frame.first.block_type() ||
|
||||
next_address->is_bottom_half_rows() !=
|
||||
frame.first.is_bottom_half_rows() ||
|
||||
next_address->row() != frame.first.row())) {
|
||||
packet_data.insert(packet_data.end(),
|
||||
UltraScalePlus::words_per_frame * 2,
|
||||
0);
|
||||
}
|
||||
}
|
||||
packet_data.insert(packet_data.end(),
|
||||
UltraScalePlus::words_per_frame * 2, 0);
|
||||
return packet_data;
|
||||
}
|
||||
|
||||
template <>
|
||||
void Configuration<Series7>::createConfigurationPackage(
|
||||
Series7::ConfigurationPackage& out_packets,
|
||||
|
|
|
|||
Loading…
Reference in New Issue