X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=Alu.hs;h=7171a6549d4a216f7ffb876eacdc4d8db5e22571;hb=82a01c9291c350ee8aeae80d62d6a45f7fb50940;hp=edb4d1a7440d63b9447ec7264fdc2595700cdd8a;hpb=26fa82ed9c6c355343972ff1ca254b2cb4931b06;p=matthijs%2Fmaster-project%2Fc%CE%BBash.git diff --git a/Alu.hs b/Alu.hs index edb4d1a..7171a65 100644 --- a/Alu.hs +++ b/Alu.hs @@ -30,6 +30,7 @@ type RegAddr = Bit type RegisterBankState = State (Word, Word) --data RegisterBankState = Regs { r0, r1 :: Bit} deriving (Show) +{-# NOINLINE register_bank #-} register_bank :: RegAddr -- ^ Address -> Bit -- ^ Write Enable @@ -61,8 +62,8 @@ alu :: AluOp -> Word -> Word -> Word {-# NOINLINE alu #-} --alu High a b = a `hwand` b --alu Low a b = a `hwor` b -alu High a b = a P.+ b -alu Low a b = a P.- b +alu High a b = a + b +alu Low a b = a - b type ExecState = State (RegisterBankState, Word, Word) exec :: (RegAddr, Bit, AluOp) -> ExecState -> (ExecState, Word)