| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Wrench.Machine.Types
Synopsis
- data Trace st isa
- = TState {
- tInstructionCount :: !Int
- tPrevInstruction :: !(Maybe isa)
- tState :: !st
- | TError Text
- | TWarn Text
- = TState {
- class Machine st isa w | st -> isa w where
- instructionFetch :: State st (Either Text (Int, isa))
- instructionStep :: State st ()
- instructionExecute :: Int -> isa -> State st ()
- data Mem isa w = Mem {
- memorySize :: !Int
- memoryData :: !(IntMap (Cell isa w))
- data IoMem isa w = IoMem {
- mIoStreams :: IntMap ([w], [w])
- mIoCells :: Mem isa w
- mIoKeys :: [Int]
- mIoByteToWord :: IntMap Int
- mAccessSet :: !AccessSet
- mAccessCount :: !AccessCount
- mInstrFetchReads :: isa -> Int
- mkIoMem :: forall w isa. (ByteSize isa, ByteSizeT w) => IntMap ([w], [w]) -> Mem isa w -> IoMem isa w
- data Cell isa w
- = Instruction !isa
- | InstructionPart
- | Value !Word8
- class InitState st where
- class Inspectable st where
- data StateEnv st = StateEnv {}
- type family MemOf st
- newtype Intervals = Intervals {
- unIntervals :: IntervalSet Integer
- emptyIntervals :: Intervals
- recordRange :: Int -> Int -> Intervals -> Intervals
- renderIntervals :: Intervals -> Text
- renderIntervalsHex :: Intervals -> Text
- inIntervals :: Int -> Intervals -> Bool
- intervalsSize :: Intervals -> Int
- intervalsToList :: Intervals -> [(Int, Int)]
- intervalsRange :: Int -> Int -> Intervals
- intervalsIntersect :: Intervals -> Intervals -> Intervals
- intervalsUnion :: Intervals -> Intervals -> Intervals
- intervalsDifference :: Intervals -> Intervals -> Intervals
- data AccessLog = AccessLog {}
- emptyAccessLog :: AccessLog
- data AccessSet = AccessSet {}
- emptyAccessSet :: AccessSet
- toAccessLog :: AccessSet -> AccessLog
- data Touched
- emptyTouched :: Touched
- touch :: Int -> Int -> Touched -> Touched
- touchedIntervals :: Touched -> Intervals
- data AccessCount = AccessCount {}
- emptyAccessCount :: AccessCount
- acTotal :: AccessCount -> Int
- acSince :: AccessCount -> AccessCount -> AccessCount
- type IsWord w = (Bits w, FiniteBits w, ByteSize w, ByteSizeT w, Default w, Enum w, FromSign w, Num (Unsign w), Hashable w, Num w, Ord (Unsign w), Ord w, Read w, Show w, WordParts w, Integral w, FromSign w, Bounded w, Bounded (Unsign w))
- class (Bits (Unsign w), Bounded (Unsign w), Integral (Unsign w), Show (Unsign w)) => FromSign w where
- type RegisterId r = (Hashable r, Show r, Read r)
- class ByteSize t where
- class ByteSizeT t where
- class WordParts w where
- wordSplit :: w -> [Word8]
- wordCombine :: [Word8] -> w
- byteToWord :: Word8 -> w
- data RW
- bump :: RW -> AccessCount -> AccessCount
- halted :: Text
Documentation
Constructors
| TState | A captured machine state after executing |
Fields
| |
| TError Text | |
| TWarn Text | |
class Machine st isa w | st -> isa w where Source #
Minimal complete definition
Methods
instructionFetch :: State st (Either Text (Int, isa)) Source #
instructionStep :: State st () Source #
instructionExecute :: Int -> isa -> State st () Source #
Instances
| IsWord w => Machine (Acc32St w) (Acc32Isa w w) w Source # | |
| IsWord w => Machine (F32aSt w) (F32aIsa w w) w Source # | |
| IsWord w => Machine (M68kSt w) (M68kIsa w w) w Source # | |
| IsWord w => Machine (RiscIvSt w) (RiscIvIsa w w) w Source # | |
| IsWord w => Machine (VliwIvSt w) (VliwIvIsa w w) w Source # | |
| IsWord w => Machine (Wasm32St w) (Wasm32Isa w w) w Source # | |
Constructors
| Mem | |
Fields
| |
Instances
| Show isa => Show (Mem isa w) Source # | |
| Eq isa => Eq (Mem isa w) Source # | |
| (ByteSize isa, IsWord w) => Memory (Mem isa w) isa w Source # | |
Defined in Wrench.Machine.Memory Methods readInstruction :: Mem isa w -> Int -> Either Text (Mem isa w, isa) Source # readWord :: Mem isa w -> Int -> Either Text (Mem isa w, w) Source # readByte :: Mem isa w -> Int -> Either Text (Mem isa w, Word8) Source # writeWord :: Mem isa w -> Int -> w -> Either Text (Mem isa w) Source # writeByte :: Mem isa w -> Int -> Word8 -> Either Text (Mem isa w) Source # dumpCells :: Mem isa w -> IntMap (Cell isa w) Source # memCapacity :: Mem isa w -> Int Source # ioPorts :: Mem isa w -> [Int] Source # accessLog :: Mem isa w -> AccessLog Source # memAccessCount :: Mem isa w -> AccessCount Source # | |
Constructors
| IoMem | |
Fields
| |
Instances
| (Show isa, Show w) => Show (IoMem isa w) Source # | Every field but the |
| (ByteSize isa, IsWord w, Memory (Mem isa w) isa w) => Memory (IoMem isa w) isa w Source # | |
Defined in Wrench.Machine.Memory Methods readInstruction :: IoMem isa w -> Int -> Either Text (IoMem isa w, isa) Source # readWord :: IoMem isa w -> Int -> Either Text (IoMem isa w, w) Source # readByte :: IoMem isa w -> Int -> Either Text (IoMem isa w, Word8) Source # writeWord :: IoMem isa w -> Int -> w -> Either Text (IoMem isa w) Source # writeByte :: IoMem isa w -> Int -> Word8 -> Either Text (IoMem isa w) Source # dumpCells :: IoMem isa w -> IntMap (Cell isa w) Source # memCapacity :: IoMem isa w -> Int Source # ioPorts :: IoMem isa w -> [Int] Source # accessLog :: IoMem isa w -> AccessLog Source # memAccessCount :: IoMem isa w -> AccessCount Source # | |
mkIoMem :: forall w isa. (ByteSize isa, ByteSizeT w) => IntMap ([w], [w]) -> Mem isa w -> IoMem isa w Source #
Constructors
| Instruction !isa | |
| InstructionPart | |
| Value !Word8 |
class Inspectable st where Source #
Minimal complete definition
Methods
programCounter :: st -> Int Source #
memoryDump :: st -> MemOf st Source #
ioStreams :: st -> IntMap ([WordOf st], [WordOf st]) Source #
views :: [View (StateEnv st)] Source #
The ISA's own report views: registers, flags, stacks, run-wide stats.
isaStats :: [Stat (StateEnv st)] Source #
The ISA's run-wide stats, read from the final state; {isa-specific}
lists them.
Instances
What an ISA view sees.
Instances
| type MemOf (Acc32St w) Source # | |
Defined in Wrench.Isa.Acc32 | |
| type MemOf (F32aSt w) Source # | |
Defined in Wrench.Isa.F32a | |
| type MemOf (M68kSt w) Source # | |
Defined in Wrench.Isa.M68k | |
| type MemOf (RiscIvSt w) Source # | |
Defined in Wrench.Isa.RiscIv | |
| type MemOf (VliwIvSt w) Source # | |
Defined in Wrench.Isa.VliwIv | |
| type MemOf (Wasm32St w) Source # | |
Defined in Wrench.Isa.Wasm32.State | |
Sorted, non-overlapping integer address ranges with adjacency merging.
Backed by IntervalSet Integer from the data-interval package.
We store each access as the half-open interval [lo, hi+1) so that two
integer-adjacent accesses (one ending at N, the next starting at N+1)
share a boundary and get merged by insert. On render we convert
back to the inclusive "lo..hi" form by subtracting 1 from the upper.
Constructors
| Intervals | |
Fields
| |
recordRange :: Int -> Int -> Intervals -> Intervals Source #
Record an access spanning [addr .. addr+len-1]. Length must be ≥ 1.
renderIntervals :: Intervals -> Text Source #
Decimal-formatted ranges.
renderIntervalsHex :: Intervals -> Text Source #
intervalsSize :: Intervals -> Int Source #
Total number of bytes covered by all intervals.
intervalsToList :: Intervals -> [(Int, Int)] Source #
Convert intervals back to a list of inclusive (lo, hi) pairs in
ascending order.
intervalsRange :: Int -> Int -> Intervals Source #
Build an Intervals covering the inclusive range [lo, hi].
Runtime access ranges accumulated by IoMem while the program runs.
Constructors
| AccessLog | |
toAccessLog :: AccessSet -> AccessLog Source #
Addresses touched at runtime, cheap to extend on every access; turned
into Intervals only when a report asks (toAccessLog).
Disjoint, non-adjacent inclusive ranges, keyed by their low end.
Instances
touch :: Int -> Int -> Touched -> Touched Source #
Record an access spanning [addr .. addr+len-1]. Length must be ≥ 1.
touchedIntervals :: Touched -> Intervals Source #
data AccessCount Source #
Reads and writes served, counted once per operation.
Constructors
| AccessCount | |
Instances
| Show AccessCount Source # | |
Defined in Wrench.Machine.Types Methods showsPrec :: Int -> AccessCount -> ShowS # show :: AccessCount -> String # showList :: [AccessCount] -> ShowS # | |
| Eq AccessCount Source # | |
Defined in Wrench.Machine.Types | |
acTotal :: AccessCount -> Int Source #
Reads plus writes.
acSince :: AccessCount -> AccessCount -> AccessCount Source #
What happened between two counts.
type IsWord w = (Bits w, FiniteBits w, ByteSize w, ByteSizeT w, Default w, Enum w, FromSign w, Num (Unsign w), Hashable w, Num w, Ord (Unsign w), Ord w, Read w, Show w, WordParts w, Integral w, FromSign w, Bounded w, Bounded (Unsign w)) Source #
class (Bits (Unsign w), Bounded (Unsign w), Integral (Unsign w), Show (Unsign w)) => FromSign w where Source #
type RegisterId r = (Hashable r, Show r, Read r) Source #
class ByteSize t where Source #
Instances
| ByteSize Int32 Source # | |
| ByteSize Int8 Source # | |
| ByteSize Word32 Source # | |
| ByteSizeT w => ByteSize (DataValue w) Source # | |
| ByteSize (Acc32Isa w l) Source # | |
| ByteSize (F32aIsa w l) Source # | |
| ByteSizeT w => ByteSize (Argument w l) Source # | |
| ByteSizeT w => ByteSize (M68kIsa w l) Source # | |
| ByteSize (RiscIvIsa w l) Source # | |
| ByteSize (VliwIvIsa w l) Source # | |
| ByteSize (Wasm32Isa w l) Source # | |
| ByteSize isa => ByteSize (CodeToken isa l) Source # | |
| ByteSizeT w => ByteSize (DataToken w l) Source # | |
| (ByteSize isa, ByteSizeT w) => ByteSize (Section isa w l) Source # | |
class WordParts w where Source #
Methods
wordSplit :: w -> [Word8] Source #
wordCombine :: [Word8] -> w Source #
byteToWord :: Word8 -> w Source #
bump :: RW -> AccessCount -> AccessCount Source #