added basic decoding

This commit is contained in:
Yehowshua Immanuel 2025-02-19 01:21:02 -05:00
parent ef58d5b07e
commit 32932f4816
7 changed files with 289 additions and 61 deletions

View file

@ -4,13 +4,13 @@
module Fetch(fetchInstruction) where
import Clash.Prelude
import Types(Mem, Addr, FullWord)
import Types(Mem, Addr, Insn)
import Util(endianSwapWord)
data Insn = Instruction FullWord
| Misaligned Addr
data FetchResult = Instruction Insn
| Misaligned Addr
fetchInstruction :: KnownNat n => Mem n -> Addr -> Insn
fetchInstruction :: KnownNat n => Mem n -> Addr -> FetchResult
fetchInstruction mem addr =
let
isWordAligned = addr .&. 3 == 0