1 {-# LANGUAGE TemplateHaskell, TypeOperators, RecordWildCards, ScopedTypeVariables, TypeFamilies #-}
2 module MultiplyAccumulate where
4 import CLasH.HardwareTypes
5 import CLasH.Translator.Annotations
6 type Word = SizedInt D8
11 {-# ANN macc (InitState 'initacc) #-}
12 {-# ANN macc TopEntity #-}
13 macc :: (Word,Word) -> State Word -> (State Word, Word)
14 macc (x, y) (State acc) = (State u, u)
18 {-# ANN program TestInput #-}
19 program :: [(Word,Word)]
21 [ (4, 2) -- 4 * 2 + 0 = 8
22 , (1, 3) -- 1 * 3 + 8 = 11
23 , (2, 2) -- 2 * 2 + 11 = 15
27 run func state (i:input) = o:out
29 (state', o) = func i state
30 out = run func state' input