| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
LibRISCV.Effects.Operations.Default.Machine.Register
Description
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 :: Type -> Type -> Type) a = RegisterFile {}
- mkRegFile :: forall (t :: Type -> Type -> Type) a. MArray t a IO => a -> IO (RegisterFile t a)
- dumpRegs :: forall (t :: Type -> Type -> Type) a. MArray t a IO => (a -> ShowS) -> RegisterFile t a -> IO String
- readRegister :: forall (t :: Type -> Type -> Type) a. MArray t a IO => RegisterFile t a -> RegIdx -> IO a
- writeRegister :: forall (t :: Type -> Type -> Type) a. MArray t a IO => RegisterFile t a -> RegIdx -> a -> IO ()
- readPC :: forall (t :: Type -> Type -> Type) a. RegisterFile t a -> IO Word32
- writePC :: forall (t :: Type -> Type -> Type) a. RegisterFile t a -> Word32 -> IO ()
Documentation
mkRegFile :: forall (t :: Type -> Type -> Type) a. 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 :: forall (t :: Type -> Type -> Type) a. MArray t a IO => (a -> ShowS) -> RegisterFile t a -> IO String Source #
Dump the current register file state as a String.
readRegister :: forall (t :: Type -> Type -> Type) a. MArray t a IO => RegisterFile t a -> RegIdx -> IO a Source #
writeRegister :: forall (t :: Type -> Type -> Type) a. MArray t a IO => RegisterFile t a -> RegIdx -> a -> IO () Source #
Write register at given register index. Writes to the Zero register are ignored.