def print_best_design(opt_design, hw_info=None):
    """ Pretty print the best design.

    Parameters
    ----------
    opt_design: dict
        Optimal design.

    Returns
    -------
    ret: str
        Printed design in a string.
    """
    ret = (
        f"\n======== Best design ========\n"
        f"Latency(Cycle): {int(opt_design['latency'])}\n"
        f"Power(W): {opt_design['power']}\n"
        f"Resource:\n"
    )

    if 'FF' in opt_design['resource']:
        ret += f"\tFF: {int(opt_design['resource']['FF'])}"
        if hw_info:
            ratio = float(opt_design['resource']['FF']) / hw_info['FF']
            ret += f" ({ratio:.2f})"
        ret += "\n"
    if 'LUT' in opt_design['resource']:
        ret += f"\tLUT: {int(opt_design['resource']['LUT'])}"
        if hw_info:
            ratio = float(opt_design['resource']['LUT']) / hw_info['LUT']
            ret += f" ({ratio:.2f})"
        ret += "\n"
    if 'BRAM18K' in opt_design['resource']:
        ret += f"\tBRAM18K: {int(opt_design['resource']['BRAM18K'])}"
        if hw_info:
            ratio = float(opt_design['resource']['BRAM18K']) / hw_info['BRAM18K']
            ret += f" ({ratio:.2f})"
        ret += "\n"
    if 'URAM' in opt_design['resource']:
        ret += f"\tURAM: {int(opt_design['resource']['URAM'])}"
        if hw_info:
            ratio = float(opt_design['resource']['URAM']) / hw_info['URAM']
            ret += f" ({ratio:.2f})"
        ret += "\n"
    if 'DSP' in opt_design['resource']:
        ret += f"\tDSP: {int(opt_design['resource']['DSP'])}"
        if hw_info:
            ratio = float(opt_design['resource']['DSP']) / hw_info['DSP']
            ret += f" ({ratio:.2f})"
        ret += "\n"
    ret += f"============================="

    return ret