Skip to content

Commit

Permalink
Tryout windows error
Browse files Browse the repository at this point in the history
  • Loading branch information
chungshien committed Aug 29, 2023
1 parent 28ca63c commit 4206748
Showing 1 changed file with 31 additions and 37 deletions.
68 changes: 31 additions & 37 deletions src/ConfigurationRS/BitAssembler/BitAssembler_ocla.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,34 @@ struct BitAssembler_IP_MODULE {
instantiations.pop_back();
}
}
void update_param(std::string param, BitAssembler_OCLA_REPORT& report) {
write_report(" Param: %s\n", param.c_str());
std::vector<std::string> words = CFG_split_string(param, "=");
if (words.size() == 2) {
if (value_maps.find(words[0]) != value_maps.end()) {
write_report(" Supported\n");
uint32_t* value_ptr = value_maps[words[0]];
std::vector<std::string> values = CFG_split_string(words[1], "'");
bool status = true;
uint64_t temp = 0;
std::string vstr = "";
if (values.size() == 1) {
vstr = values[0];
} else {
vstr = values[1];
}
temp = CFG_convert_string_to_u64(vstr, true, &status);
if (status) {
backup_values[words[0]] = *value_ptr;
*value_ptr = (uint32_t)(temp);
write_report(" Overwrite to 0x%08X\n", temp);
} else {
write_report(" Invalid number conversion\n");
CFG_POST_WARNING("Invalid number conversion - %s", param.c_str());
}
}
}
}
void backup_param() {
for (auto& param : backup_values) {
*value_maps[param.first] = param.second;
Expand Down Expand Up @@ -167,39 +195,7 @@ struct BitAssembler_OCLA_INSTANCE {
param_string.c_str());
std::vector<std::string> params = CFG_split_string(param_string, ",");
for (std::string& param : params) {
write_report(" Param: %s\n", param.c_str());
std::vector<std::string> words = CFG_split_string(param, "=");
if (words.size() == 2) {
if (ocla->value_maps.find(words[0]) != ocla->value_maps.end()) {
write_report(" Supported\n");
uint32_t* value_ptr = ocla->value_maps[words[0]];
std::vector<std::string> values = CFG_split_string(words[1], "'");
bool status = true;
if (values.size() == 1) {
uint32_t temp = (uint32_t)(CFG_convert_string_to_u64(
values[0], true, &status));
if (status) {
ocla->backup_values[words[0]] = *value_ptr;
*value_ptr = temp;
write_report(" Overwrite to 0x%08X\n", temp);
} else {
CFG_POST_WARNING("Invalid number conversion - %s",
param.c_str());
}
} else {
uint32_t temp = (uint32_t)(CFG_convert_string_to_u64(
values[1], true, &status));
if (status) {
ocla->backup_values[words[0]] = *value_ptr;
*value_ptr = temp;
write_report(" Overwrite to 0x%08X\n", temp);
} else {
CFG_POST_WARNING("Invalid number conversion - %s",
param.c_str());
}
}
}
}
ocla->update_param(param, report);
}
}
}
Expand Down Expand Up @@ -485,9 +481,8 @@ bool BitAssembler_OCLA::get_module_instantiations(BitAssembler_IP_MODULE*& ip,
if (hier.contains("hierTree") && hier["hierTree"].is_array() &&
hier["hierTree"].size() == 1 && hier["hierTree"][0].is_object()) {
nlohmann::json& top = hier["hierTree"][0];
status =
get_module_instantiations(ip, hier["hierTree"][0], true, "top_level",
"topModule", hier["fileIDs"]);
status = get_module_instantiations(ip, top, true, "top_level",
"topModule", hier["fileIDs"]);
} else {
CFG_POST_WARNING("Could not detect top level module - hierTree");
}
Expand Down Expand Up @@ -732,7 +727,6 @@ bool BitAssembler_OCLA::get_modules(
const std::vector<std::string>& modules,
std::vector<std::pair<std::string, std::string>>& cells,
const std::string& rtlilPath, BitAssembler_OCLA_REPORT& report) {
bool status = true;
// Read text line by line
std::ifstream file(rtlilPath.c_str());
CFG_ASSERT_MSG(file.is_open(), "Fail to open %s", rtlilPath.c_str());
Expand Down

0 comments on commit 4206748

Please sign in to comment.