projects
/
matthijs
/
master-project
/
cλash.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Support stateful functions with no own state (only substate).
[matthijs/master-project/cλash.git]
/
Alu.hs
diff --git
a/Alu.hs
b/Alu.hs
index edb4d1a7440d63b9447ec7264fdc2595700cdd8a..7171a6549d4a216f7ffb876eacdc4d8db5e22571 100644
(file)
--- 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)
type RegisterBankState = State (Word, Word)
--data RegisterBankState = Regs { r0, r1 :: Bit} deriving (Show)
+{-# NOINLINE register_bank #-}
register_bank ::
RegAddr -- ^ Address
-> Bit -- ^ Write Enable
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
{-# 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)
type ExecState = State (RegisterBankState, Word, Word)
exec :: (RegAddr, Bit, AluOp) -> ExecState -> (ExecState, Word)