lib: xc7series: config packet subclass that owns the payload

Signed-off-by: Rick Altherr <kc8apf@kc8apf.net>
This commit is contained in:
Rick Altherr 2018-02-01 12:20:02 -08:00
parent 43b70caf03
commit 2a1154ec16
1 changed files with 33 additions and 0 deletions

View File

@ -0,0 +1,33 @@
#ifndef PRJXRAY_LIB_XILINX_XC7SERIES_g_CONFIGURATION_PACKET_WITH_PAYLOAD_H
#define PRJXRAY_LIB_XILINX_XC7SERIES_g_CONFIGURATION_PACKET_WITH_PAYLOAD_H
#include <memory>
#include <absl/types/span.h>
#include <prjxray/bit_ops.h>
#include <prjxray/xilinx/xc7series/configuration_packet.h>
#include <prjxray/xilinx/xc7series/configuration_register.h>
namespace prjxray {
namespace xilinx {
namespace xc7series {
template <int Words>
class ConfigurationPacketWithPayload : public ConfigurationPacket {
public:
ConfigurationPacketWithPayload(
Opcode op,
ConfigurationRegister reg,
const std::array<uint32_t, Words>& payload)
: ConfigurationPacket(1, op, reg, absl::Span<uint32_t>(payload_)),
payload_(std::move(payload)) {}
private:
std::array<uint32_t, Words> payload_;
}; // namespace xc7series
} // namespace xc7series
} // namespace xilinx
} // namespace prjxray
#endif // PRJXRAY_LIB_XILINX_XC7SERIES_g_CONFIGURATION_PACKET_WITH_PAYLOAD_H