Preserve escaped names

This commit is contained in:
alaindargelas 2024-03-04 09:27:12 -08:00
parent deed17d736
commit a3d627b21f
1 changed files with 168 additions and 166 deletions

View File

@ -84,8 +84,8 @@ void print_verilog_testbench_fpga_instance(
module_manager.module_port(top_module, module_port_id); module_manager.module_port(top_module, module_port_id);
/* Bypass dummy port: the port does not exist at core module */ /* Bypass dummy port: the port does not exist at core module */
if (io_name_map.fpga_top_port_is_dummy(module_port)) { if (io_name_map.fpga_top_port_is_dummy(module_port)) {
ModulePortId core_module_port = ModulePortId core_module_port = module_manager.find_module_port(
module_manager.find_module_port(core_module, module_port.get_name()); core_module, module_port.get_name());
if (!module_manager.valid_module_port_id(core_module, if (!module_manager.valid_module_port_id(core_module,
core_module_port)) { core_module_port)) {
/* Print the wire for the dummy port */ /* Print the wire for the dummy port */
@ -132,7 +132,8 @@ void print_verilog_testbench_benchmark_instance(
const std::string& instance_name, const std::string& instance_name,
const std::string& module_input_port_postfix, const std::string& module_input_port_postfix,
const std::string& module_output_port_postfix, const std::string& module_output_port_postfix,
const std::string& input_port_postfix, const std::string& output_port_postfix, const std::string& input_port_postfix,
const std::string& output_port_postfix,
const std::vector<std::string>& clock_port_names, const std::vector<std::string>& clock_port_names,
const bool& include_clock_port_postfix, const AtomContext& atom_ctx, const bool& include_clock_port_postfix, const AtomContext& atom_ctx,
const VprNetlistAnnotation& netlist_annotation, const VprNetlistAnnotation& netlist_annotation,
@ -296,7 +297,8 @@ void print_verilog_testbench_benchmark_instance(
if (0 < pin_counter) { if (0 < pin_counter) {
fp << ", "; fp << ", ";
} }
std::string escapedName = bus_group.pin_name(pin) + output_port_postfix; std::string escapedName =
bus_group.pin_name(pin) + output_port_postfix;
escapedName = escapeNames(escapedName); escapedName = escapeNames(escapedName);
fp << escapedName; fp << escapedName;
pin_counter++; pin_counter++;
@ -653,8 +655,8 @@ void print_verilog_testbench_check(
print_verilog_comment( print_verilog_comment(
fp, std::string("----- Begin checking output vectors -------")); fp, std::string("----- Begin checking output vectors -------"));
std::vector<BasicPort> clock_ports = std::vector<BasicPort> clock_ports = generate_verilog_testbench_clock_port(
generate_verilog_testbench_clock_port(clock_port_names, default_clock_name); clock_port_names, default_clock_name);
print_verilog_comment(fp, print_verilog_comment(fp,
std::string("----- Skip the first falling edge of " std::string("----- Skip the first falling edge of "
@ -881,8 +883,8 @@ void print_verilog_testbench_random_stimuli(
/* TODO: find the clock inputs will be initialized later */ /* TODO: find the clock inputs will be initialized later */
if (AtomBlockType::INPAD == atom_ctx.nlist.block_type(atom_blk)) { if (AtomBlockType::INPAD == atom_ctx.nlist.block_type(atom_blk)) {
fp << "\t\t" << escapeNames(block_name + input_port_postfix) << " <= 1'b0;" fp << "\t\t" << escapeNames(block_name + input_port_postfix)
<< std::endl; << " <= 1'b0;" << std::endl;
} }
} }
@ -965,8 +967,8 @@ void print_verilog_testbench_random_stimuli(
/* TODO: find the clock inputs will be initialized later */ /* TODO: find the clock inputs will be initialized later */
if (AtomBlockType::INPAD == atom_ctx.nlist.block_type(atom_blk)) { if (AtomBlockType::INPAD == atom_ctx.nlist.block_type(atom_blk)) {
fp << "\t\t" << escapeNames(block_name + input_port_postfix) << " <= $random;" fp << "\t\t" << escapeNames(block_name + input_port_postfix)
<< std::endl; << " <= $random;" << std::endl;
} }
} }
@ -990,8 +992,8 @@ void print_verilog_testbench_shared_input_ports(
const PinConstraints& pin_constraints, const AtomContext& atom_ctx, const PinConstraints& pin_constraints, const AtomContext& atom_ctx,
const VprNetlistAnnotation& netlist_annotation, const VprNetlistAnnotation& netlist_annotation,
const std::vector<std::string>& clock_port_names, const std::vector<std::string>& clock_port_names,
const bool& include_clock_ports, const std::string& shared_input_port_postfix, const bool& include_clock_ports,
const bool& use_reg_port) { const std::string& shared_input_port_postfix, const bool& use_reg_port) {
/* Validate the file stream */ /* Validate the file stream */
valid_file_stream(fp); valid_file_stream(fp);