lib: xc7series: convience constructor for Configuration

Configuration's original constructor expects Span<uint32_t>s as part of
the map to avoid copying the actual frame data.  In tests or any other
place that needs to directly construct a Configuration, the caller will
already have a map with vector<uint32_t> to hold the actual frame data.
This new constructor just wraps those vectors in Spans.

Signed-off-by: Rick Altherr <kc8apf@kc8apf.net>
This commit is contained in:
Rick Altherr 2018-01-16 16:11:08 -08:00
parent 850539927f
commit 5749352937
1 changed files with 10 additions and 0 deletions

View File

@ -6,6 +6,7 @@
#include <absl/types/span.h>
#include <prjxray/bit_ops.h>
#include <prjxray/xilinx/xc7series/bitstream_reader.h>
#include <prjxray/xilinx/xc7series/configuration_packet.h>
#include <prjxray/xilinx/xc7series/frame_address.h>
#include <prjxray/xilinx/xc7series/part.h>
@ -22,6 +23,15 @@ class Configuration {
const Part& part,
Collection& packets);
Configuration(const Part& part,
std::map<FrameAddress, std::vector<uint32_t>>* frames)
: part_(part) {
for (auto& frame : *frames) {
frames_[frame.first] =
absl::Span<uint32_t>(frame.second);
}
}
Configuration(const Part& part, const FrameMap& frames)
: part_(part), frames_(std::move(frames)) {}