1 {-# LANGUAGE TypeOperators, TemplateHaskell, TypeFamilies, ScopedTypeVariables, FlexibleContexts #-}
5 -- hide default prelude functions
6 import qualified Prelude as P
8 -- import CλaSH specific types
9 import CLasH.HardwareTypes
10 import CLasH.Translator.Annotations
12 type Word = Signed D16
14 foldl1 f xs = foldl f (head xs) (tail xs)
15 as ** bs = foldl1 (+) (zipWith (*) as bs)
17 {-# ANN mmult2x4_4x3 TopEntity #-}
18 mmult2x4_4x3 :: Vector D2 (Vector D4 Word) -> Vector D4 (Vector D3 Word) -> Vector D2 (Vector D3 Word)
19 mmult2x4_4x3 a b = mmult a b
21 mmult xss yss = map f xss
23 f xs = map (xs **) colsy
24 colsy = transpose yss (iterate (1+) 0)
29 ) => Vector s1 (Vector s2 a) ->
30 Vector s2 (Index s2) ->
31 Vector s2 (Vector s1 a)
32 transpose m ixs = map (\x-> map (!x) m) ixs