read seemingly complete
This commit is contained in:
parent
ad751a5039
commit
b95b2b962a
4 changed files with 82 additions and 39 deletions
18
hs/Decode.hs
18
hs/Decode.hs
|
@ -30,17 +30,17 @@ decode (Fetch.InstructionException exception) =
|
|||
|
||||
insnToOpcode :: Insn -> Maybe Opcode
|
||||
insnToOpcode insn =
|
||||
decodeRType insn `orElse`
|
||||
decodeIType insn `orElse`
|
||||
decodeSType insn `orElse`
|
||||
decodeBType insn `orElse`
|
||||
decodeUType insn `orElse`
|
||||
decodeRType insn `chainAndTry`
|
||||
decodeIType insn `chainAndTry`
|
||||
decodeSType insn `chainAndTry`
|
||||
decodeBType insn `chainAndTry`
|
||||
decodeUType insn `chainAndTry`
|
||||
decodeJType insn
|
||||
where
|
||||
orElse :: Maybe Opcode -> Maybe Opcode -> Maybe Opcode
|
||||
orElse (Just left) _ = Just left
|
||||
orElse Nothing (Just right) = Just right
|
||||
orElse _ _ = Nothing
|
||||
chainAndTry :: Maybe Opcode -> Maybe Opcode -> Maybe Opcode
|
||||
chainAndTry (Just left) _ = Just left
|
||||
chainAndTry Nothing (Just right) = Just right
|
||||
chainAndTry _ _ = Nothing
|
||||
|
||||
decodeRType :: Insn -> Maybe Opcode
|
||||
decodeRType insn =
|
||||
|
|
Reference in a new issue