Really revert all of the recent rotating changes.
[matthijs/master-project/cλash.git] / HighOrdAluOps.hs
1 module HighOrdAluOps where
2
3 import qualified Prelude as P
4 import CLasH.HardwareTypes
5 import CLasH.Translator.Annotations
6
7 constant :: NaturalT n => e -> Op n e
8 constant e a b = copy e
9
10 invop :: Op n Bit
11 invop a b = map hwnot a
12
13 andop :: (e -> e -> e) -> Op n e
14 andop f a b = zipWith f a b
15
16 -- Is any bit set?
17 --anyset :: (PositiveT n) => Op n Bit
18 anyset :: NaturalT n => (e -> e -> e) -> e -> Op n e
19 --anyset a b = copy undefined (a' `hwor` b')
20 anyset f s a b = constant (f a' b') a b
21   where 
22     a' = foldl f s a
23     b' = foldl f s b
24
25 xhwor = hwor
26
27 type Op n e = (Vector n e -> Vector n e -> Vector n e)
28 type Opcode = Bit