RegFileΒΆ

RegFiles are on-chip arrays of registers with fixed size. RegFiles currently can be specified as one or two dimensional. Like other memories in Spatial, the contents of RegFiles are persistent across loop iterations, even when they are declared in an inner scope.

Using the <<= operator, RegFiles can be used as shift registers. 2-dimensional RegFiles must select a specific row or column before shifting using regfile(row, *) or regfile(*, col), respectively.


Static methods

object RegFile
def apply[T:Type:Bits](length: Index): RegFile1[T]
Allocates a 1-dimensional Regfile with specified length.
def apply[T:Type:Bits](length: Int, inits: List[T]): RegFile1[T]
Allocates a 1-dimensional RegFile with specified length and initial values inits.

The number of initial values must be the same as the total size of the RegFile.
def apply[T:Type:Bits](rows: Index, cols: Index): RegFile2[T]
Allocates a 2-dimensional RegFile with specified rows and cols.
def apply[T:Type:Bits](rows: Int, cols: Int, inits: List[T]): RegFile2[T]
Allocates a 2-dimensional RegFile with specified rows and cols and initial values inits.

The number of initial values must be the same as the total size of the RegFile
def apply[T:Type:Bits](dim0: Index, dim1: Index, dim2: Index): RegFile3[T]
Allocates a 3-dimensional RegFile with specified dimensions.
def apply[T:Type:Bits](dim0: Int, dim1: Int, dim2: Int, inits: List[T]): RegFile3[T]
Allocates a 3-dimensional RegFile with specified dimensions and initial values inits.

The number of initial values must be the same as the total size of the RegFile

Infix methods

abstract class RegFile[T]
def reset: Unit
Resets this RegFile to its initial values (or zeros, if unspecified).
def reset(cond: Bit): Unit
Conditionally resets this RegFile based on cond to its inital values (or zeros if unspecified).
class RegFile1[T] extends RegFile[T]
def apply(i: Index): T
Returns the value held by the register at address i.
def update(i: Index, data: T): Unit
Updates the register at address i to hold data.
def <<=(data: T): Unit
Shifts in data into the first register, shifting all other values over by one position.
def <<=(data: Vector[T]): Unit
Shifts in data into the first N registers, where N is the size of the given Vector.
All other elements are shifted by N positions.
def load(dram: DRAM1[T]): Unit
Creates a dense, burst load from the specified region of DRAM to this on-chip memory.
def load(dram: DRAMDenseTile1[T]): Unit
Creates a dense, burst load from the specified region of DRAM to this on-chip memory.
class RegFile2[T] extends RegFile[T]
def apply(r: Index, c: Index): T
Returns the value held by the register at row r, column c.
def update(r: Index, c: Index, data: T): Unit
Updates the register at row r, column c to hold the given data.
def apply(i: Index, y: Wildcard)
Returns a view of row i of this RegFile.
def apply(y: Wildcard, i: Index)
Returns a view of column i of this RegFile.
def load(dram: DRAM2[T]): Unit
Creates a dense, burst load from the specified region of DRAM to this on-chip memory.
def load(dram: DRAMDenseTile2[T]): Unit
Creates a dense, burst load from the specified region of DRAM to this on-chip memory.
class RegFile3[T] extends RegFile[T]
def apply(dim0: Index, dim1: Index, dim2: Index): T
Returns the value held by the register at the given 3-dimensional address.
def update(dim0: Index, dim1: Index, dim2: Index, data: T): Unit
Updates the register at the given 3-dimensional address to hold the given data.
def apply(i: Index, j: Index, y: Wildcard)
Returns a 1-dimensional view of part of this RegFile3.
def apply(i: Index, y: Wildcard, j: Index)
Returns a 1-dimensional view of part of this RegFile3.
def apply(y: Wildcard, i: Index, j: Index)
Returns a 1-dimensional view of part of this RegFile3.
def load(dram: DRAM3[T]): Unit
Creates a dense, burst load from the specified region of DRAM to this on-chip memory.
def load(dram: DRAMDenseTile3[T]): Unit
Creates a dense, burst load from the specified region of DRAM to this on-chip memory.