cryptol-2.5.0: Cryptol: The Language of Cryptography

Copyright(c) 2013-2016 Galois Inc.
LicenseBSD3
Maintainercryptol@galois.com
Stabilityprovisional
Portabilityportable
Safe HaskellTrustworthy
LanguageHaskell98

Cryptol.Prims.Eval

Contents

Description

 

Synopsis

Documentation

ecDemoteV :: BitWord b w => GenValue b w Source #

Make a numeric constant.

modExp Source #

Arguments

:: Integer

bit size of the resulting word

-> BV

base

-> BV

exponent

-> Eval BV 

Create a packed word

doubleAndAdd Source #

Arguments

:: Integer

base

-> Integer

exponent mask

-> Integer

modulus

-> Integer 

type Binary b w = TValue -> GenValue b w -> GenValue b w -> Eval (GenValue b w) Source #

binary :: Binary b w -> GenValue b w Source #

type Unary b w = TValue -> GenValue b w -> Eval (GenValue b w) Source #

unary :: Unary b w -> GenValue b w Source #

liftBinArith :: (Integer -> Integer -> Integer) -> BinArith BV Source #

Turn a normal binop on Integers into one that can also deal with a bitsize.

liftDivArith :: (Integer -> Integer -> Integer) -> BinArith BV Source #

Turn a normal binop on Integers into one that can also deal with a bitsize. Generate a thunk that throws a divide by 0 error when forced if the second argument is 0.

type BinArith w = Integer -> w -> w -> Eval w Source #

arithBinary :: forall b w. BitWord b w => BinArith w -> Binary b w Source #

type UnaryArith w = Integer -> w -> Eval w Source #

arithUnary :: forall b w. BitWord b w => UnaryArith w -> Unary b w Source #

lexCompare :: String -> TValue -> Value -> Value -> Eval Ordering Source #

Lexicographic ordering on two values.

cmpOrder :: String -> (Ordering -> Bool) -> Binary Bool BV Source #

Process two elements based on their lexicographic ordering.

zeroV :: forall b w. BitWord b w => TValue -> GenValue b w Source #

joinWords :: forall b w. BitWord b w => Integer -> Integer -> SeqMap b w -> Eval (GenValue b w) Source #

joinSeq :: BitWord b w => Nat' -> Integer -> TValue -> SeqMap b w -> Eval (GenValue b w) Source #

joinV :: BitWord b w => Nat' -> Integer -> TValue -> GenValue b w -> Eval (GenValue b w) Source #

Join a sequence of sequences into a single sequence.

splitAtV :: BitWord b w => Nat' -> Nat' -> TValue -> GenValue b w -> Eval (GenValue b w) Source #

ecSplitV :: BitWord b w => GenValue b w Source #

Split implementation.

reverseV :: forall b w. BitWord b w => GenValue b w -> Eval (GenValue b w) Source #

transposeV :: BitWord b w => Nat' -> Nat' -> TValue -> GenValue b w -> Eval (GenValue b w) Source #

ccatV :: (Show b, Show w, BitWord b w) => Nat' -> Nat' -> TValue -> GenValue b w -> GenValue b w -> Eval (GenValue b w) Source #

wordValLogicOp :: BitWord b w => (b -> b -> b) -> (w -> w -> w) -> WordValue b w -> WordValue b w -> WordValue b w Source #

logicBinary :: forall b w. BitWord b w => (b -> b -> b) -> (w -> w -> w) -> Binary b w Source #

Merge two values given a binop. This is used for and, or and xor.

wordValUnaryOp :: BitWord b w => (b -> b) -> (w -> w) -> WordValue b w -> WordValue b w Source #

logicUnary :: forall b w. BitWord b w => (b -> b) -> (w -> w) -> Unary b w Source #

logicShift Source #

Arguments

:: (Integer -> Integer -> Integer -> Integer)

The function may assume its arguments are masked. It is responsible for masking its result if needed.

-> (Integer -> Seq (Eval Bool) -> Integer -> Seq (Eval Bool)) 
-> (Nat' -> TValue -> SeqValMap -> Integer -> SeqValMap) 
-> Value 

indexPrimOne :: BitWord b w => (Maybe Integer -> TValue -> SeqMap b w -> Seq b -> Eval (GenValue b w)) -> (Maybe Integer -> TValue -> SeqMap b w -> w -> Eval (GenValue b w)) -> GenValue b w Source #

Indexing operations that return one element.

indexPrimMany :: BitWord b w => (Maybe Integer -> TValue -> SeqMap b w -> Seq b -> Eval (GenValue b w)) -> (Maybe Integer -> TValue -> SeqMap b w -> w -> Eval (GenValue b w)) -> GenValue b w Source #

Indexing operations that return many elements.

updatePrim :: BitWord b w => (Nat' -> TValue -> Seq (Eval b) -> WordValue b w -> Eval (GenValue b w) -> Eval (Seq (Eval b))) -> (Nat' -> TValue -> SeqMap b w -> WordValue b w -> Eval (GenValue b w) -> Eval (SeqMap b w)) -> GenValue b w Source #

randomV :: TValue -> Integer -> Value Source #

Produce a random value with the given seed. If we do not support making values of the given type, return zero of that type. TODO: do better than returning zero

errorV :: forall b w. BitWord b w => TValue -> String -> Eval (GenValue b w) Source #

Orphan instances