wrench-0.0.6.3
Safe HaskellSafe-Inferred
LanguageHaskell2010

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

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.

lShiftR :: IsWord w => w -> w -> w Source #

lShiftL :: IsWord w => w -> w -> w Source #

data Ext a Source #

Constructors

Ext 

Fields

Instances

Instances details
Show a => Show (Ext a) Source # 
Instance details

Defined in Wrench.Machine.Word

Methods

showsPrec :: Int -> Ext a -> ShowS #

show :: Ext a -> String #

showList :: [Ext a] -> ShowS #

Eq a => Eq (Ext a) Source # 
Instance details

Defined in Wrench.Machine.Word

Methods

(==) :: Ext a -> Ext a -> Bool #

(/=) :: Ext a -> Ext a -> Bool #

addExt :: IsWord w => w -> w -> Ext w Source #

subExt :: IsWord w => w -> w -> Ext w Source #

mulExt :: IsWord w => w -> w -> Ext w Source #

b8 :: IsWord w => (Text -> Text) -> w -> Either Text w Source #

Any pattern a byte can spell, read as signed or unsigned -- the range the .byte directive accepts, so a byte-wide immediate and a byte of data agree on what fits.

u5 :: IsWord w => (Text -> Text) -> w -> Either Text w Source #

u8 :: IsWord w => (Text -> Text) -> w -> Either Text w Source #

u16 :: IsWord w => (Text -> Text) -> w -> Either Text w Source #

u20 :: IsWord w => (Text -> Text) -> w -> Either Text w Source #

i8 :: IsWord w => (Text -> Text) -> w -> Either Text w Source #

i10 :: IsWord w => (Text -> Text) -> w -> Either Text w Source #

i12 :: IsWord w => (Text -> Text) -> w -> Either Text w Source #

i13 :: IsWord w => (Text -> Text) -> w -> Either Text w Source #

i15 :: IsWord w => (Text -> Text) -> w -> Either Text w Source #

i16 :: IsWord w => (Text -> Text) -> w -> Either Text w Source #

i17 :: IsWord w => (Text -> Text) -> w -> Either Text w Source #

i20 :: IsWord w => (Text -> Text) -> w -> Either Text w Source #

i21 :: IsWord w => (Text -> Text) -> w -> Either Text w Source #