src/base/chunk_generator.hh
/**
     * Constructor.
     * @param _startAddr The starting address of the region.
     * @param totalSize The total size of the region.
     * @param _chunkSize The size/alignment of chunks into which
     *    the region should be decomposed.
     *
     * @ingroup api_chunk_generator
     */
Constructor.
@param _startAddr The starting address of the region.
@param totalSize The total size of the region.
@param _chunkSize The size/alignment of chunks into which
the region should be decomposed.


Constructor . @param _startAddr The starting address of the region . @param totalSize The total size of the region . @param _chunkSize The size / alignment of chunks into which the region should be decomposed .
ChunkGenerator(Addr _startAddr, Addr totalSize, Addr _chunkSize) :
        startAddr(_startAddr), chunkSize(_chunkSize)
    {
        assert(chunkSize == 0 || isPowerOf2(chunkSize));
        curAddr = startAddr;
        if (chunkSize == 0) { 
            nextAddr = startAddr + totalSize;
        } else {
            nextAddr = roundUp(startAddr, chunkSize);
            if (curAddr == nextAddr) {
                nextAddr += chunkSize;
            }
            nextAddr = std::min(nextAddr, startAddr + totalSize);
        }
        curSize = nextAddr - curAddr;
        sizeLeft = totalSize - curSize;
        nextSize = std::min(sizeLeft, chunkSize);
    }
ChunkGenerator ( Addr _startAddr , Addr totalSize , Addr _chunkSize ) : startAddr ( _startAddr ) , chunkSize ( _chunkSize ) { assert ( chunkSize == 0 || isPowerOf2 ( chunkSize ) ) ; curAddr = startAddr ; if ( chunkSize == 0 ) { nextAddr = startAddr + totalSize ; } else { nextAddr = roundUp ( startAddr , chunkSize ) ; if ( curAddr == nextAddr ) { nextAddr += chunkSize ; } nextAddr = std :: min ( nextAddr , startAddr + totalSize ) ; } curSize = nextAddr - curAddr ; sizeLeft = totalSize - curSize ; nextSize = std :: min ( sizeLeft , chunkSize ) ; }
Constructor.
Constructor .
// chunkSize must be a power of two // set up initial chunk. // Special Case, if we see 0, assume no chunking. // nextAddr should be *next* chunk start. // ... even if startAddr is already chunk-aligned // How many bytes are left between curAddr and the end of this chunk?