[refinement] implement getBlock block lookup function.

This commit is contained in:
Kevin Quick 2019-01-31 17:44:43 -08:00
parent bd0e57cfc1
commit 5c2e0edeaa
No known key found for this signature in database
GPG Key ID: E6D7733599CC0A21
2 changed files with 16 additions and 8 deletions

View File

@ -62,10 +62,15 @@ funIncludesBlock :: BlockIdentifier arch
funIncludesBlock blkID (Some fi) =
isJust ((fi ^. parsedBlocks) Map.!? blkID)
-- | Returns the actual block (if it exists) from the Discovery State
-- (in the first function for which it exists).
getBlock :: DiscoveryState arch
-> BlockIdentifier arch
-> Some (ParsedBlock arch)
getBlock ds blkID = undefined
-> Maybe (Some (ParsedBlock arch))
getBlock ds blkID =
case filter (funIncludesBlock blkID) (ds ^. funInfo ^.. folded) of
((Some fi):_) -> Some <$> (fi ^. parsedBlocks) Map.!? blkID
[] -> Nothing
-- | This function identifies the possible target addresses (of other
-- blocks within this function) from the terminal statement in the

View File

@ -284,12 +284,15 @@ type Solution arch = [ArchSegmentOff arch] -- identified transfers
equationFor :: DiscoveryState arch -> FuncBlockPath arch -> Equation arch
equationFor inpDS (Path bid anc _loop) =
let curBlk = getBlock inpDS bid
in if null anc
then Equation inpDS curBlk
else undefined
-- Should linearly combine the anc statements with the
-- current block's statements and asserts that state that
-- the IP from one to the next is expected.
in case curBlk of
Nothing -> error "did not find requested block in discovery results!" -- internal
Just b ->
if null anc
then Equation inpDS b
else undefined
-- Should linearly combine the anc statements with the
-- current block's statements and asserts that state that
-- the IP from one to the next is expected.
solve :: ( MS.SymArchConstraints arch
, 16 <= MC.ArchAddrWidth arch