lib: xc7series: Fix frame address YAML decoding

Need to manually translate row_half from human-readable form in YAML
(top/bottom) to true/false.  Requesting a Node as a uint8_t returns the
first char in the YAML field rather than parsing the field as an
integer.  Just used unsigned ints and let the constructor force them to
smaller types.

Signed-off-by: Rick Altherr <kc8apf@kc8apf.net>
Signed-off-by: Tim 'mithro' Ansell <mithro@mithis.com>
This commit is contained in:
Rick Altherr 2017-12-15 17:27:16 -08:00 committed by Tim 'mithro' Ansell
parent 6a2fb25013
commit 92509c5043
1 changed files with 13 additions and 4 deletions

View File

@ -66,12 +66,21 @@ bool convert<xc7series::ConfigurationFrameAddress>::decode(
!node["column"] ||
!node["minor"]) return false;
bool row_half;
if (node["row_half"].as<std::string>() == "top") {
row_half = false;
} else if (node["row_half"].as<std::string>() == "bottom") {
row_half = true;
} else {
return false;
}
lhs = prjxray::xilinx::xc7series::ConfigurationFrameAddress(
node["block_type"].as<xc7series::BlockType>(),
node["row_half"].as<bool>(),
node["row"].as<uint8_t>(),
node["column"].as<uint32_t>(),
node["minor"].as<uint32_t>());
row_half,
node["row"].as<unsigned int>(),
node["column"].as<unsigned int>(),
node["minor"].as<unsigned int>());
return true;
}