More haddock updates for function argument information.

This commit is contained in:
Kevin Quick 2019-02-27 11:35:20 -08:00
parent fcff1b7c3d
commit 60a3d39e98
No known key found for this signature in database
GPG Key ID: E6D7733599CC0A21

View File

@ -674,15 +674,22 @@ memValToCrucible memRep val =
traverse (memValToCrucible eltMemRepr) v traverse (memValToCrucible eltMemRepr) v
_ -> unexpectedMemVal _ -> unexpectedMemVal
-- | Given a Boolean condition and two symbolic values associated with a Macaw type, return -- | Given a Boolean condition and two symbolic values associated with
-- a value denoting the first value if condition is true and second value otherwise. -- a Macaw type, return a value denoting the first value if condition
-- is true and second value otherwise.
--
-- arg1 : Symbolic interface
-- arg2 : Description of memory layout of value
-- arg3 : Condition
-- arg4 : Value if condition is true
-- arg5 : Value if condition is false.
muxMemReprValue :: muxMemReprValue ::
IsSymInterface sym => IsSymInterface sym =>
sym -> -- ^ Symbolic interface. sym ->
MemRepr ty -> -- ^ Description of memory layout of value MemRepr ty ->
RegValue sym BoolType -> -- ^ Condition RegValue sym BoolType ->
RegValue sym (ToCrucibleType ty) -> -- ^ Value if condition is true RegValue sym (ToCrucibleType ty) ->
RegValue sym (ToCrucibleType ty) -> -- ^ Value if condition is false. RegValue sym (ToCrucibleType ty) ->
IO (RegValue sym (ToCrucibleType ty)) IO (RegValue sym (ToCrucibleType ty))
muxMemReprValue sym memRep cond x y = muxMemReprValue sym memRep cond x y =
case memRep of case memRep of
@ -738,15 +745,24 @@ doReadMem sym mem ptrWidth memRep ptr = hasPtrClass ptrWidth $
assert sym isValid (AssertFailureSimError "Invalid memory load") assert sym isValid (AssertFailureSimError "Invalid memory load")
return crucVal return crucVal
-- | Conditional memory read
--
-- arg1 : Symbolic Interface
-- arg2 : Memory implementation
-- arg3 : Width of ptr
-- arg4 : What/how we are reading
-- arg5 : Condition
-- arg6 : Address to read
-- arg7 : Default answer if condition is false
doCondReadMem :: doCondReadMem ::
IsSymInterface sym => IsSymInterface sym =>
sym -> sym ->
MemImpl sym -> MemImpl sym ->
M.AddrWidthRepr ptrW {- ^ Width of ptr -} -> M.AddrWidthRepr ptrW ->
MemRepr ty {- ^ What/how we are reading -} -> MemRepr ty ->
RegValue sym BoolType {- ^ Condition -} -> RegValue sym BoolType ->
LLVMPtr sym ptrW -> -- ^ Address to read LLVMPtr sym ptrW ->
RegValue sym (ToCrucibleType ty) {- ^ Answer is condition is false -} -> RegValue sym (ToCrucibleType ty) ->
IO (RegValue sym (ToCrucibleType ty)) IO (RegValue sym (ToCrucibleType ty))
doCondReadMem sym mem ptrWidth memRep cond ptr def = hasPtrClass ptrWidth $ doCondReadMem sym mem ptrWidth memRep cond ptr def = hasPtrClass ptrWidth $
do -- Check pointer is valid. do -- Check pointer is valid.
@ -781,15 +797,22 @@ doCondReadMem sym mem ptrWidth memRep cond ptr def = hasPtrClass ptrWidth $
assert sym grd (AssertFailureSimError (Mem.ptrMessage "Invalid memory read" ptr ty)) assert sym grd (AssertFailureSimError (Mem.ptrMessage "Invalid memory read" ptr ty))
muxMemReprValue sym memRep cond crucVal def muxMemReprValue sym memRep cond crucVal def
-- | Write a Macaw value to memory. -- | Write a Macaw value to memory.
--
-- arg1 : Symbolic Interface
-- arg2 : Heap prior to write
-- arg3 : Width of ptr
-- arg4 : What/how we are writing
-- arg5 : Address to write to
-- arg6 : Value to write
doWriteMem :: doWriteMem ::
IsSymInterface sym => IsSymInterface sym =>
sym -> sym ->
MemImpl sym -> -- ^ Heap prior to write MemImpl sym ->
M.AddrWidthRepr ptrW -> -- ^ Width of ptr M.AddrWidthRepr ptrW ->
MemRepr ty -> -- ^ What/how we are writing MemRepr ty ->
LLVMPtr sym ptrW -> -- ^ Address to write to LLVMPtr sym ptrW ->
RegValue sym (ToCrucibleType ty) -> -- ^ Value to write RegValue sym (ToCrucibleType ty) ->
IO (MemImpl sym) IO (MemImpl sym)
doWriteMem sym mem ptrWidth memRep ptr val = hasPtrClass ptrWidth $ doWriteMem sym mem ptrWidth memRep ptr val = hasPtrClass ptrWidth $
do ok <- isValidPtr sym mem ptrWidth ptr do ok <- isValidPtr sym mem ptrWidth ptr