Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Provides a polymorphic implementation of a register file. This module is
intended to be used internally by interpreters for the
Operations
effect. This register file
implementation also provides facilities for storing a concrete program
counter.
Synopsis
- data RegisterFile t a = RegisterFile {}
- mkRegFile :: MArray t a IO => a -> IO (RegisterFile t a)
- dumpRegs :: MArray t a IO => (a -> ShowS) -> RegisterFile t a -> IO String
- readRegister :: MArray t a IO => RegisterFile t a -> RegIdx -> IO a
- writeRegister :: MArray t a IO => RegisterFile t a -> RegIdx -> a -> IO ()
- readPC :: RegisterFile t a -> IO Word32
- writePC :: RegisterFile t a -> Word32 -> IO ()
Documentation
data RegisterFile t a Source #
mkRegFile :: MArray t a IO => a -> IO (RegisterFile t a) Source #
Create a new register file, initializing all registers with the given default value. This value must represent the zero value in the chosen value type.
dumpRegs :: MArray t a IO => (a -> ShowS) -> RegisterFile t a -> IO String Source #
Dump the current register file state as a String
.
readRegister :: MArray t a IO => RegisterFile t a -> RegIdx -> IO a Source #
writeRegister :: MArray t a IO => RegisterFile t a -> RegIdx -> a -> IO () Source #
Write register at given register index. Writes to the Zero
register are ignored.