1 {-# LANGUAGE TemplateHaskell, ScopedTypeVariables, NoImplicitPrelude #-}
3 module HighOrdAlu where
5 import qualified Prelude as P
6 import CLasH.HardwareTypes
7 import CLasH.Translator.Annotations
11 {-# ANN sim_input TestInput#-}
12 sim_input :: [(Opcode, Vector D4 (SizedInt D8), Vector D4 (SizedInt D8))]
13 sim_input = [ (High, $(vectorTH ([4,3,2,1]::[SizedInt D8])), $(vectorTH ([1,2,3,4]::[SizedInt D8])))
14 , (High, $(vectorTH ([4,3,2,1]::[SizedInt D8])), $(vectorTH ([1,2,3,4]::[SizedInt D8])))
15 , (Low, $(vectorTH ([4,3,2,1]::[SizedInt D8])), $(vectorTH ([1,2,3,4]::[SizedInt D8]))) ]
17 {-# ANN actual_alu InitState #-}
20 alu :: Op n e -> Op n e -> Opcode -> Vector n e -> Vector n e -> Vector n e
26 {-# ANN actual_alu TopEntity #-}
27 actual_alu :: (Opcode, Vector D4 (SizedInt D8), Vector D4 (SizedInt D8)) -> Vector D4 (SizedInt D8)
28 --actual_alu = alu (constant Low) andop
29 actual_alu (opc, a, b) = alu (anyset (+) (0 :: SizedInt D8)) (andop (-)) opc a b
31 runalu = P.map actual_alu sim_input