| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Wrench.Machine.Word
Description
Pure machine-word helpers: fixed-width truncation/sign handling and
arithmetic that also reports overflow and carry. These operate on any
IsWord and are shared across the ISA implementations.
Synopsis
- fitSigned :: IsWord w => Int -> w -> w
- lShiftR :: IsWord w => w -> w -> w
- lShiftL :: IsWord w => w -> w -> w
- data Ext a = Ext {}
- addExt :: IsWord w => w -> w -> Ext w
- subExt :: IsWord w => w -> w -> Ext w
- mulExt :: IsWord w => w -> w -> Ext w
- b8 :: IsWord w => (Text -> Text) -> w -> Either Text w
- u5 :: IsWord w => (Text -> Text) -> w -> Either Text w
- u8 :: IsWord w => (Text -> Text) -> w -> Either Text w
- u16 :: IsWord w => (Text -> Text) -> w -> Either Text w
- u20 :: IsWord w => (Text -> Text) -> w -> Either Text w
- i8 :: IsWord w => (Text -> Text) -> w -> Either Text w
- i10 :: IsWord w => (Text -> Text) -> w -> Either Text w
- i12 :: IsWord w => (Text -> Text) -> w -> Either Text w
- i13 :: IsWord w => (Text -> Text) -> w -> Either Text w
- i15 :: IsWord w => (Text -> Text) -> w -> Either Text w
- i16 :: IsWord w => (Text -> Text) -> w -> Either Text w
- i17 :: IsWord w => (Text -> Text) -> w -> Either Text w
- i20 :: IsWord w => (Text -> Text) -> w -> Either Text w
- i21 :: IsWord w => (Text -> Text) -> w -> Either Text w
Documentation
fitSigned :: IsWord w => Int -> w -> w Source #
Reduce a value to a fixed-width signed instruction field: keep the low n
bits and sign-extend from bit n-1 to the full machine word. Bits at or above
bit n are silently discarded, modelling an immediate/offset that does not
fit its encoding field.