@classmethod
def from_device_info(cls, parent, device_name, device_info, memorymap_dict,
    legacy_reg_map=True):
    """
        Process device info and the memory map to get all necessary info
        and return a Hmc instance.
        :param parent: the CasperFpga that hosts this HMC
        :param device_name: the unique device name
        :param device_info: information about this device
        :param memorymap_dict: a dictionary containing the device memory map
        :return: a Hmc object
        """
    address, length_bytes = -1, -1
    for mem_name in memorymap_dict.keys():
        if mem_name == device_name:
            address = memorymap_dict[mem_name]['address']
            length_bytes = memorymap_dict[mem_name]['bytes']
            try:
                mezzanine_site = int(device_info['mez'])
            except KeyError:
                mezzanine_site = 0
            break
    if address == -1 or length_bytes == -1:
        raise RuntimeError('Could not find address or length for Hmc %s' %
            device_name)
    return cls(parent, device_name, address, length_bytes, mezzanine_site,
        device_info, legacy_reg_map=legacy_reg_map)
