def generate_ethmac(peripheral, **kwargs):
    """ Generates definition of 'ethmac' peripheral.

    Args:
        peripheral (dict): peripheral description
        kwargs (dict): additional parameters, including 'buffer'

    Returns:
        string: repl definition of the peripheral
    """
    buf = kwargs['buffer']()

    result = """
ethmac: Network.LiteX_Ethernet @ {{
    sysbus <{}, +0x100>;
    sysbus new Bus.BusMultiRegistration {{ address: {}; size: {}; region: "buffer" }}
}}
""".format(peripheral['address'], buf['address'], buf['size'])

    if 'interrupt' in peripheral['constants']:
        result += '    -> cpu@{}\n'.format(peripheral['constants']['interrupt'])

    return result