mirror of https://github.com/openXC7/prjxray.git
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:
parent
850539927f
commit
5749352937
|
|
@ -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)) {}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue