[core] enable options in xml writers
This commit is contained in:
parent
ae63c9d441
commit
b07111497c
|
@ -81,6 +81,28 @@ size_t find_bitstream_manager_config_bit_index_in_parent_block(
|
||||||
return curr_index;
|
return curr_index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/********************************************************************
|
||||||
|
* Find the index of a configuration bit in the children bits of its grandparent
|
||||||
|
*block. We count the index from the parent of current parent block
|
||||||
|
*******************************************************************/
|
||||||
|
size_t find_bitstream_manager_config_bit_index_in_grandparent_block(
|
||||||
|
const BitstreamManager& bitstream_manager, const ConfigBitId& bit_id) {
|
||||||
|
size_t curr_index = 0;
|
||||||
|
ConfigBlockId parent_blk = bitstream_manager.bit_parent_block(bit_id);
|
||||||
|
ConfigBlockId grandparent_blk = bitstream_manager.block_parent(parent_blk);
|
||||||
|
for (const ConfigBlockId& cand_blk : bitstream_manager.block_children(grandparent_blk)) {
|
||||||
|
if (cand_blk != parent_blk) {
|
||||||
|
curr_index += bitstream_manager.block_bits(cand_blk).size();
|
||||||
|
} else {
|
||||||
|
curr_index += find_bitstream_manager_config_bit_index_in_parent_block(bitstream_manager, bit_id);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return curr_index;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/********************************************************************
|
/********************************************************************
|
||||||
* Find the total number of configuration bits under a block
|
* Find the total number of configuration bits under a block
|
||||||
* As configuration bits are stored only under the leaf blocks,
|
* As configuration bits are stored only under the leaf blocks,
|
||||||
|
|
|
@ -25,6 +25,9 @@ std::vector<ConfigBlockId> find_bitstream_manager_top_blocks(
|
||||||
size_t find_bitstream_manager_config_bit_index_in_parent_block(
|
size_t find_bitstream_manager_config_bit_index_in_parent_block(
|
||||||
const BitstreamManager& bitstream_manager, const ConfigBitId& bit_id);
|
const BitstreamManager& bitstream_manager, const ConfigBitId& bit_id);
|
||||||
|
|
||||||
|
size_t find_bitstream_manager_config_bit_index_in_grandparent_block(
|
||||||
|
const BitstreamManager& bitstream_manager, const ConfigBitId& bit_id);
|
||||||
|
|
||||||
size_t rec_find_bitstream_manager_block_sum_of_bits(
|
size_t rec_find_bitstream_manager_block_sum_of_bits(
|
||||||
const BitstreamManager& bitstream_manager, const ConfigBlockId& block);
|
const BitstreamManager& bitstream_manager, const ConfigBlockId& block);
|
||||||
|
|
||||||
|
|
|
@ -72,36 +72,51 @@ static int write_fabric_config_bit_to_xml_file(
|
||||||
std::fstream& fp, const BitstreamManager& bitstream_manager,
|
std::fstream& fp, const BitstreamManager& bitstream_manager,
|
||||||
const FabricBitstream& fabric_bitstream, const FabricBitId& fabric_bit,
|
const FabricBitstream& fabric_bitstream, const FabricBitId& fabric_bit,
|
||||||
const e_config_protocol_type& config_type, bool fast_xml,
|
const e_config_protocol_type& config_type, bool fast_xml,
|
||||||
const int& xml_hierarchy_depth, std::string& bl_addr, std::string& wl_addr) {
|
const int& xml_hierarchy_depth, std::string& bl_addr, std::string& wl_addr,
|
||||||
|
const BitstreamWriterOption& options) {
|
||||||
if (false == valid_file_stream(fp)) {
|
if (false == valid_file_stream(fp)) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
write_tab_to_file(fp, xml_hierarchy_depth);
|
write_tab_to_file(fp, xml_hierarchy_depth);
|
||||||
fp << "<bit id=\"" << size_t(fabric_bit) << "\"";
|
fp << "<bit id=\"" << size_t(fabric_bit) << "\"";
|
||||||
|
if (options.output_value() && !options.value_to_skip(bitstream_manager.bit_value(fabric_bitstream.config_bit(fabric_bit)))) {
|
||||||
fp << " value=\"";
|
fp << " value=\"";
|
||||||
fp << bitstream_manager.bit_value(fabric_bitstream.config_bit(fabric_bit));
|
fp << bitstream_manager.bit_value(fabric_bitstream.config_bit(fabric_bit));
|
||||||
fp << "\"";
|
fp << "\"";
|
||||||
|
}
|
||||||
|
|
||||||
/* Output hierarchy of this parent*/
|
/* Output hierarchy of this parent*/
|
||||||
const ConfigBitId& config_bit = fabric_bitstream.config_bit(fabric_bit);
|
const ConfigBitId& config_bit = fabric_bitstream.config_bit(fabric_bit);
|
||||||
const ConfigBlockId& config_block =
|
const ConfigBlockId& config_block =
|
||||||
bitstream_manager.bit_parent_block(config_bit);
|
bitstream_manager.bit_parent_block(config_bit);
|
||||||
|
|
||||||
|
if (options.output_path()) {
|
||||||
std::vector<ConfigBlockId> block_hierarchy =
|
std::vector<ConfigBlockId> block_hierarchy =
|
||||||
find_bitstream_manager_block_hierarchy(bitstream_manager, config_block);
|
find_bitstream_manager_block_hierarchy(bitstream_manager, config_block);
|
||||||
std::string hie_path;
|
std::string hie_path;
|
||||||
for (const ConfigBlockId& temp_block : block_hierarchy) {
|
for (size_t iblk = 0; iblk < block_hierarchy.size(); ++iblk) {
|
||||||
hie_path += bitstream_manager.block_name(temp_block);
|
/* If enabled, pop the last block name */
|
||||||
|
if (options.trim_path() && iblk == block_hierarchy.size() - 1) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
hie_path += bitstream_manager.block_name(block_hierarchy[iblk]);
|
||||||
hie_path += std::string(".");
|
hie_path += std::string(".");
|
||||||
}
|
}
|
||||||
hie_path += generate_configurable_memory_data_out_name();
|
hie_path += generate_configurable_memory_data_out_name();
|
||||||
hie_path += std::string("[");
|
hie_path += std::string("[");
|
||||||
|
size_t bit_idx_in_parent_block = find_bitstream_manager_config_bit_index_in_parent_block(
|
||||||
|
bitstream_manager, config_bit);
|
||||||
|
if (options.trim_path()) {
|
||||||
|
bit_idx_in_parent_block = find_bitstream_manager_config_bit_index_in_grandparent_block(
|
||||||
|
bitstream_manager, config_bit);
|
||||||
|
}
|
||||||
hie_path +=
|
hie_path +=
|
||||||
std::to_string(find_bitstream_manager_config_bit_index_in_parent_block(
|
std::to_string(bit_idx_in_parent_block);
|
||||||
bitstream_manager, config_bit));
|
|
||||||
hie_path += std::string("]");
|
hie_path += std::string("]");
|
||||||
|
|
||||||
fp << " path=\"" << hie_path << "\">\n";
|
fp << " path=\"" << hie_path << "\">\n";
|
||||||
|
}
|
||||||
|
|
||||||
switch (config_type) {
|
switch (config_type) {
|
||||||
case CONFIG_MEM_STANDALONE:
|
case CONFIG_MEM_STANDALONE:
|
||||||
|
@ -196,7 +211,8 @@ static int write_fabric_regional_config_bit_to_xml_file(
|
||||||
const FabricBitstream& fabric_bitstream,
|
const FabricBitstream& fabric_bitstream,
|
||||||
const FabricBitRegionId& fabric_region,
|
const FabricBitRegionId& fabric_region,
|
||||||
const e_config_protocol_type& config_type, bool fast_xml,
|
const e_config_protocol_type& config_type, bool fast_xml,
|
||||||
const int& xml_hierarchy_depth) {
|
const int& xml_hierarchy_depth,
|
||||||
|
const BitstreamWriterOption& options) {
|
||||||
if (false == valid_file_stream(fp)) {
|
if (false == valid_file_stream(fp)) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -228,7 +244,7 @@ static int write_fabric_regional_config_bit_to_xml_file(
|
||||||
fabric_bitstream.region_bits(fabric_region)) {
|
fabric_bitstream.region_bits(fabric_region)) {
|
||||||
status = write_fabric_config_bit_to_xml_file(
|
status = write_fabric_config_bit_to_xml_file(
|
||||||
fp, bitstream_manager, fabric_bitstream, fabric_bit, config_type,
|
fp, bitstream_manager, fabric_bitstream, fabric_bit, config_type,
|
||||||
fast_xml, xml_hierarchy_depth + 1, bl_addr, wl_addr);
|
fast_xml, xml_hierarchy_depth + 1, bl_addr, wl_addr, options);
|
||||||
if (1 == status) {
|
if (1 == status) {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
@ -296,7 +312,7 @@ int write_fabric_bitstream_to_xml_file(
|
||||||
fp, bitstream_manager, fabric_bitstream, region, config_protocol.type(),
|
fp, bitstream_manager, fabric_bitstream, region, config_protocol.type(),
|
||||||
BLWL_PROTOCOL_FLATTEN == config_protocol.bl_protocol_type() &&
|
BLWL_PROTOCOL_FLATTEN == config_protocol.bl_protocol_type() &&
|
||||||
BLWL_PROTOCOL_FLATTEN == config_protocol.wl_protocol_type(),
|
BLWL_PROTOCOL_FLATTEN == config_protocol.wl_protocol_type(),
|
||||||
xml_hierarchy_depth + 1);
|
xml_hierarchy_depth + 1, options);
|
||||||
if (1 == status) {
|
if (1 == status) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue