dtim: Memory.MappedMemory @sysbus 0x0100000
    size: 0x2000

L2LIM: Memory.MappedMemory @sysbus 0x08000000
    size: 0x200000

plic:
    numberOfContexts: 4

rstgen: Python.PythonPeripheral @ sysbus 0x11840000
    size: 0x20
    initable: true
    script: '''
if request.IsInit:
    regs=[0xffffffff,
          0xffffffff,
          0xffffffff,
          0xffffffff]
    mask=[0xfffff3fb,
          0xffffffe7,
          0xfffffffe,
          0xffffffff]
elif request.IsRead:
    offset = (request.Offset//4) & 0x7
    if offset & 4 == 0:
        request.Value = regs[offset & 0x3] & 0xffffffff
    else:
        request.Value = (regs[offset & 0x3] ^ mask[offset & 0x3]) & 0xffffffff
elif request.IsWrite:
    offset = (request.Offset//4) & 0x3
    regs[offset] = request.Value
'''

audiorstgen: Python.PythonPeripheral @ sysbus 0x10490000
    size: 0x8
    initable: true
    script: '''
if request.IsInit:
    reg = 0xffffffff
elif request.IsRead:
    offset = request.Offset//4
    if offset == 0:
        request.Value = reg & 0xffffffff
    else:
        request.Value = ~reg & 0xffffffff
elif request.IsWrite:
    reg = request.Value
'''

voutsysrstgen: Python.PythonPeripheral @ sysbus 0x12250000
    size: 0x8
    initable: true
    script: '''
if request.IsInit:
    reg = 0xffffffff
elif request.IsRead:
    offset = request.Offset//4
    if offset == 0:
        request.Value = reg & 0xffffffff
    else:
        request.Value = ~reg & 0xffffffff
elif request.IsWrite:
    reg = request.Value
'''

pwm0: HiFive_PWM @sysbus 0x12490000

gpio: GPIOPort.SiFive_GPIO @sysbus 0x1191000

SoCSRAM: Memory.MappedMemory @sysbus 0x18000000
    size: 0x20000

spi2: SPI.DesignWare_SPI@sysbus 0x12410000
    transmitDepth: 128
    receiveDepth: 128
    IRQ -> plic@70

ethernet: Network.SynopsysEthernetMAC @sysbus 0x10020000
    IRQ -> plic@6

phy: Network.EthernetPhysicalLayer @ethernet 7
    BasicControl: 0x0880
    Id1: 0x0022
    Id2: 0x1620
    AutoNegotiationAdvertisement: 0x00A1
    AutoNegotiationLinkPartnerBasePageAbility: 0x0000

sysbus:
    init add:
        SilenceRange <0x02010000 0x1000>
        Tag <0x10000000 0x10000> "SDIO"
        Tag <0x104C0000 0x40000> "USB30"
        Tag <0x11860000 0x10000> "QSPI"
        Tag <0x118B0000 0x10000> "I2C0"
        Tag <0x118C0000 0x10000> "I2C1"
        Tag <0x12450000 0x10000> "I2C1"
        Tag <0x100b0000 0x10000> "sgdam2"
        Tag <0x10500000 0x10000> "sgdam1"
        Tag <0x11910000 0x10000> "GPIO"
        Tag <0x11800000 0x10000> "CLKGEN_CSR"
        Tag <0x11850000 0x10000> "SYSCTRL"
        Tag <0x118D0000 0x10000> "TRNG"
        Tag <0x10480000 0x30000> "DOM_AUDIO"
        Tag <0x12240000 0x30000> "VOUT"
