Exemplo n.º 1
0
    def generateNcRamRegion(
        userProvidedConfig: Dict,
        prevKeySeq: Opt[List] = None,
    ) -> MemoryRegion:
        keyName = "NCRAM"
        prevKeySeq.append(keyName)

        ncramConfig: Opt[Dict] = util.getConfigurationParameter(
            data=userProvidedConfig,
            keySeq=[keyName],
            prevKeySeq=prevKeySeq[:-1],
            fail=False,
        )

        if ncramConfig:
            ncram = MemoryRegion.generateObject(ncramConfig, prevKeySeq)
        else:
            ncram = MemoryRegion(
                virtualStartAddr=0x0,
                physicalStartAddr=0x0,
                sizeInBytes=0,
                cacheable=False,
            )
        ncram.name = "NCRAM"
        ncram.oneLineDescription = "Non-Cacheable Random Access Memory"

        prevKeySeq.pop()
        return ncram
Exemplo n.º 2
0
    def generateMmioRegion(
        userProvidedConfig: Dict,
        prevKeySeq: Opt[List] = None,
    ) -> MemoryRegion:
        keyName = "MMIO"
        prevKeySeq.append(keyName)

        mmioConfig: Opt[Dict] = util.getConfigurationParameter(
            data=userProvidedConfig,
            keySeq=[keyName],
        )

        if mmioConfig:
            io = MemoryRegion.generateObject(mmioConfig, prevKeySeq)
        else:
            io = MemoryRegion(
                name="MMIO",
                oneLineDescription="Memory Mapped IO.",
                virtualStartAddr=0xFFFF0000,
                physicalStartAddr=0xFFFF0000,
                sizeInBytes=2**16,
            )

        prevKeySeq.pop()
        return io
Exemplo n.º 3
0
    def generateRamRegion(
        userProvidedConfig: Dict,
        prevKeySeq: Opt[List] = None,
    ) -> MemoryRegion:
        keyName = "RAM"
        prevKeySeq.append(keyName)

        ramConfig: Opt[Dict] = util.getConfigurationParameter(
            data=userProvidedConfig,
            keySeq=[keyName],
            prevKeySeq=prevKeySeq[:-1],
            fail=True,
        )

        if ramConfig:
            ram = MemoryRegion.generateObject(ramConfig, prevKeySeq)
        else:
            ram = MemoryRegion(
                name="RAM",
                oneLineDescription="Random Access Memory",
                virtualStartAddr=0x0,
                physicalStartAddr=0x0,
                sizeInBytes=0,
            )

        prevKeySeq.pop()
        return ram
Exemplo n.º 4
0
    def setMemoryRegion(
        self,
        region: common.MemoryRegion,
    ) -> None:
        if region.cacheable:
            self.cacheableRegion = region
            self.locksStartAddrCacheable = region.getFirstByteAddr()
        else:
            self.nonCacheableRegion = region
            self.locksStartAddr = region.getFirstByteAddr()

        self.checkInvariants(cacheable=region.cacheable)  # IMPORTANT
Exemplo n.º 5
0
 def setMemoryRegion(
     self,
     region: common.MemoryRegion,
 ) -> None:
     self.region = region
     self.headersStartAddr = region.getFirstByteAddr(virtualAddr=True)
     self.msgStartAddr = self.headersStartAddr + self.getTotalQueueHeadersSizeInBytes(
     )
Exemplo n.º 6
0
    def generateFlashRegion(
        userProvidedConfig: Dict,
        prevKeySeq: Opt[List] = None,
    ) -> MemoryRegion:
        keyName = "Flash"
        prevKeySeq.append(keyName)

        flashConfig: Opt[Dict] = util.getConfigurationParameter(
            data=userProvidedConfig,
            keySeq=[keyName],
            prevKeySeq=prevKeySeq[:-1],
        )

        if flashConfig:
            flash = MemoryRegion.generateObject(flashConfig, prevKeySeq)
        else:
            flash = MemoryRegion(
                name="Flash",
                oneLineDescription="Flash Memory",
                sizeInBytes=0,
            )

        prevKeySeq.pop()
        return flash
Exemplo n.º 7
0
    def generateMemoryRegionObject(
        userProvidedConfig: Dict,
        prevKeySeq: Opt[List] = None,
    ) -> MemoryRegion:
        keyName = "MemoryRegion"
        prevKeySeq.append(keyName)

        config: Opt[Dict] = util.getConfigurationParameter(
            data=userProvidedConfig,
            keySeq=[keyName],
            prevKeySeq=prevKeySeq[:-1],
            fail=True,
        )

        memoryRegion = MemoryRegion.generateObject(
            userProvidedConfig=config,
            prevKeySeq=prevKeySeq[:-1],
            initPageTableLevels=False,
        )
        prevKeySeq.pop()

        return memoryRegion