def METHOD_NAME(
        hardware_modules: Iterable[HardwareModule],
        bind_ops: Iterable[sv.BindOp],
        symbol_map: Dict[Any, MlirSymbol],
        basename: str,
        suffix: str,
):
    filename = pathlib.Path(f"{basename}.{suffix}")
    bound_module_to_filename = {}
    for hardware_module in hardware_modules:
        if hardware_module.hw_module is None:
            continue
        magma_defn_or_decl = hardware_module.magma_defn_or_decl
        if is_bound_module(magma_defn_or_decl):
            name = magma_defn_or_decl.name
            bound_module_to_filename[magma_defn_or_decl] = output_filename = (
                filename.parent / f"{name}.{suffix}"
            )
        else:
            output_filename = filename
        hardware_module.hw_module.attr_dict["output_file"] = (
            hw.OutputFileAttr(str(output_filename))
        )
    for bind_op in bind_ops:
        magma_inst = only(find_by_value(symbol_map, bind_op.instance.name))
        output_filename = bound_module_to_filename[type(magma_inst)]
        bind_op.attr_dict["output_file"] = (
            hw.OutputFileAttr(str(output_filename))
        )