31 #ifndef __BASE__CHUNK_GENERATOR_HH__
32 #define __BASE__CHUNK_GENERATOR_HH__
106 curSize = std::min(totalSize, left_in_chunk);
152 #endif // __BASE__CHUNK_GENERATOR_HH__
bool next()
Advance generator to next chunk.
unsigned size() const
Return size in bytes of current chunk.
Addr curAddr
The starting address of the current chunk.
unsigned complete() const
Number of bytes we have already chunked up.
T roundUp(const T &val, const U &align)
unsigned curSize
The size of the current chunk (in bytes).
unsigned sizeLeft
The number of bytes remaining in the region after the current chunk.
This class takes an arbitrary memory region (address/length pair) and generates a series of appropria...
ChunkGenerator(Addr _startAddr, unsigned totalSize, unsigned _chunkSize)
Constructor.
const Addr startAddr
The start address so we can calculate offset in writing block.
bool last() const
Is this the last chunk?
bool isPowerOf2(const T &n)
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,16,32,64}_t.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Addr nextAddr
The starting address of the next chunk (after the current one).
bool done() const
Are we done? That is, did the last call to next() advance past the end of the region?
const unsigned chunkSize
The maximum chunk size, e.g., the cache block size or page size.
Addr addr() const
Return starting address of current chunk.