X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=Adders.hs;h=6529642f4758ad640b1b93e736ef566e4b1f63eb;hb=63eb4d0050f202ee022c2d89c46a33f47c646d79;hp=c4389147c28726e1f1a9486f4cfe44f44a360309;hpb=2b5500197937305ce58080762d3b0f027850b663;p=matthijs%2Fmaster-project%2Fc%CE%BBash.git diff --git a/Adders.hs b/Adders.hs index c438914..6529642 100644 --- a/Adders.hs +++ b/Adders.hs @@ -1,3 +1,5 @@ +{-# LANGUAGE TemplateHaskell #-} + module Adders where import Bits import qualified Sim @@ -11,6 +13,8 @@ import Language.Haskell.Syntax import Types import Data.Param.TFVec import Data.RangedWord +import Data.SizedInt +import Data.SizedWord mainIO f = Sim.simulateIO (Sim.stateless f) () @@ -172,8 +176,18 @@ highordtest = \x -> in \c d -> op' d c -functiontest :: TFVec D4 Bit -> TFVec D5 Bit -> RangedWord D3 -> RangedWord D4 -> (Bit, Bit) -functiontest = \v1 v2 i1 i2 -> let r1 = v1!i1 ; r2 = v2!i2 in (r1,r2) +xand a b = hwand a b + +functiontest :: TFVec D3 (TFVec D4 Bit) -> TFVec D12 Bit +functiontest = \v -> let r = concat v in r + +functiontest2 :: SizedInt D8 -> SizedInt D7 +functiontest2 = \a -> let r = Data.SizedInt.resize a in r + +xhwnot x = hwnot x + +maptest :: TFVec D4 Bit -> TFVec D4 Bit +maptest = \v -> let r = map xhwnot v in r highordtest2 = \a b -> case a of