gem5  v21.1.0.2
Public Member Functions | Private Attributes | List of all members
gem5::ChunkGenerator Class Reference

This class takes an arbitrary memory region (address/length pair) and generates a series of appropriately (e.g. More...

#include <chunk_generator.hh>

Public Member Functions

 ChunkGenerator (Addr _startAddr, Addr totalSize, Addr _chunkSize)
 Constructor. More...
 
Addr addr () const
 Return starting address of current chunk. More...
 
Addr size () const
 Return size in bytes of current chunk. More...
 
Addr complete () const
 Number of bytes we have already chunked up. More...
 
bool done () const
 Are we done? That is, did the last call to next() advance past the end of the region? More...
 
bool last () const
 Is this the last chunk? More...
 
void setNext (Addr next)
 Grow this chunk to cover additional bytes which are already handled. More...
 
bool next ()
 Advance generator to next chunk. More...
 

Private Attributes

Addr curAddr
 The starting address of the current chunk. More...
 
Addr nextAddr
 The starting address of the next chunk (after the current one). More...
 
Addr curSize
 The size of the current chunk (in bytes). More...
 
Addr nextSize
 The size of the next chunk (in bytes). More...
 
Addr sizeLeft
 The number of bytes remaining in the region after the current chunk. More...
 
const Addr startAddr
 The start address so we can calculate offset in writing block. More...
 
const Addr chunkSize
 The maximum chunk size, e.g., the cache block size or page size. More...
 

Detailed Description

This class takes an arbitrary memory region (address/length pair) and generates a series of appropriately (e.g.

block- or page-) aligned chunks covering the same region.

Example usage:

for (ChunkGenerator gen(addr, size, chunkSize); !gen.done(); gen.next()) {
doSomethingChunky(gen.addr(), gen.size());
}

Definition at line 59 of file chunk_generator.hh.

Member Data Documentation

◆ chunkSize

const Addr gem5::ChunkGenerator::chunkSize
private

The maximum chunk size, e.g., the cache block size or page size.

Definition at line 75 of file chunk_generator.hh.

Referenced by ChunkGenerator(), next(), and setNext().

◆ curAddr

Addr gem5::ChunkGenerator::curAddr
private

The starting address of the current chunk.

Definition at line 63 of file chunk_generator.hh.

Referenced by addr(), ChunkGenerator(), complete(), and next().

◆ curSize

Addr gem5::ChunkGenerator::curSize
private

The size of the current chunk (in bytes).

Definition at line 67 of file chunk_generator.hh.

Referenced by ChunkGenerator(), done(), next(), setNext(), and size().

◆ nextAddr

Addr gem5::ChunkGenerator::nextAddr
private

The starting address of the next chunk (after the current one).

Definition at line 65 of file chunk_generator.hh.

Referenced by ChunkGenerator(), next(), and setNext().

◆ nextSize

Addr gem5::ChunkGenerator::nextSize
private

The size of the next chunk (in bytes).

Definition at line 69 of file chunk_generator.hh.

Referenced by ChunkGenerator(), next(), and setNext().

◆ sizeLeft

Addr gem5::ChunkGenerator::sizeLeft
private

The number of bytes remaining in the region after the current chunk.

Definition at line 71 of file chunk_generator.hh.

Referenced by ChunkGenerator(), last(), next(), and setNext().

◆ startAddr

const Addr gem5::ChunkGenerator::startAddr
private

The start address so we can calculate offset in writing block.

Definition at line 73 of file chunk_generator.hh.

Referenced by ChunkGenerator(), and complete().


The documentation for this class was generated from the following file:
gem5::ChunkGenerator::chunkSize
const Addr chunkSize
The maximum chunk size, e.g., the cache block size or page size.
Definition: chunk_generator.hh:75
gem5::ChunkGenerator::size
Addr size() const
Return size in bytes of current chunk.
Definition: chunk_generator.hh:125
gem5::ChunkGenerator::ChunkGenerator
ChunkGenerator(Addr _startAddr, Addr totalSize, Addr _chunkSize)
Constructor.
Definition: chunk_generator.hh:87
gem5::ChunkGenerator::addr
Addr addr() const
Return starting address of current chunk.
Definition: chunk_generator.hh:119

Generated on Tue Sep 21 2021 12:27:23 for gem5 by doxygen 1.8.17