libriscv-0.1.0.0: A versatile, flexible and executable formal model for the RISC-V architecture.
Safe HaskellSafe-Inferred
LanguageHaskell2010

LibRISCV.Effects.Expressions.Expr

Description

Defines the expression abstraction to express arithmetic and logic operations within the formal description of RISC-V instructions. The abstraction is just a non-monadic algebraic data type called Expr. In addition to the the data type definition, this module also provides several smart constructors for utilzing the expression lanuage, these are generated using template-haskell.

Synopsis

Documentation

data Expr a Source #

Constructors

FromImm a

Create a new Expr from a given immediate value.

FromInt Int Integer

Create an expression from a concrete Integer, treating it as a fixed-width two's complement value of the size (in bits) specified by the first argument to the constructor.

ZExt Int (Expr a)

Zero extend an expression by adding the given amount of bits to it, for example, an 8-bit value can be zero-extended to 32-bit by passing 24 as the first argument.

SExt Int (Expr a)

Same as ZExt but performs sign-extension instead of zero-extension.

Extract Int Int (Expr a)

Extract a specified amount of bits from an expression. The first argument specifies the first bit which should be extracted, the second specifies the amount of bits to extract.

Add (Expr a) (Expr a) 
Sub (Expr a) (Expr a) 
Eq (Expr a) (Expr a) 
Slt (Expr a) (Expr a) 
Sge (Expr a) (Expr a) 
Ult (Expr a) (Expr a) 
Uge (Expr a) (Expr a) 
And (Expr a) (Expr a) 
Or (Expr a) (Expr a) 
Xor (Expr a) (Expr a) 
LShl (Expr a) (Expr a) 
LShr (Expr a) (Expr a) 
AShr (Expr a) (Expr a) 
Mul (Expr a) (Expr a) 
UDiv (Expr a) (Expr a) 
SDiv (Expr a) (Expr a) 
URem (Expr a) (Expr a) 
SRem (Expr a) (Expr a) 

and :: a -> a -> Expr a Source #

or :: a -> a -> Expr a Source #

xor :: a -> a -> Expr a Source #

slt :: a -> a -> Expr a Source #

sge :: a -> a -> Expr a Source #

sdiv :: a -> a -> Expr a Source #

srem :: a -> a -> Expr a Source #

ashr :: a -> a -> Expr a Source #

eq :: a -> a -> Expr a Source #

add :: a -> a -> Expr a Source #

mul :: a -> a -> Expr a Source #

regShamt :: Int -> Expr a -> Expr a Source #

Extract shamt value from an expression (lower 5 bits).

zextImm :: Int -> a -> Expr a Source #

sextImm :: Int -> a -> Expr a Source #

addImm :: a -> a -> Expr a Source #

subImm :: a -> a -> Expr a Source #

eqImm :: a -> a -> Expr a Source #

sltImm :: a -> a -> Expr a Source #

sgeImm :: a -> a -> Expr a Source #

ultImm :: a -> a -> Expr a Source #

ugeImm :: a -> a -> Expr a Source #

andImm :: a -> a -> Expr a Source #

orImm :: a -> a -> Expr a Source #

xorImm :: a -> a -> Expr a Source #

lshlImm :: a -> a -> Expr a Source #

lshrImm :: a -> a -> Expr a Source #

ashrImm :: a -> a -> Expr a Source #

mulImm :: a -> a -> Expr a Source #

udivImm :: a -> a -> Expr a Source #

sdivImm :: a -> a -> Expr a Source #

uremImm :: a -> a -> Expr a Source #

sremImm :: a -> a -> Expr a Source #

sub :: a -> a -> Expr a Source #

ult :: a -> a -> Expr a Source #

uge :: a -> a -> Expr a Source #

lshl :: a -> a -> Expr a Source #

lshr :: a -> a -> Expr a Source #

udiv :: a -> a -> Expr a Source #

urem :: a -> a -> Expr a Source #