packages feed

kansas-lava 0.2.4.3 → 0.2.4.4

raw patch · 5 files changed

+32/−20 lines, 5 filesdep ~basedep ~bytestringdep ~cmdargs

Dependency ranges changed: base, bytestring, cmdargs, containers, data-default, directory, dotgen, filepath, netlist, netlist-to-vhdl, process, random, strict, template-haskell

Files

Language/KansasLava/Netlist/Inst.hs view
@@ -8,6 +8,7 @@ import Language.Netlist.Util import Language.KansasLava.Rep import qualified Data.Map as M+import Data.Bits  import Data.List import Data.Reify.Graph (Unique)@@ -847,7 +848,9 @@                   (GreaterThan,S x,S y) -> mkBool (resign x il > resign y ir)                   (Minus,U x,U y)       | x == y && il >= ir                                        -> toStdLogicExpr fTy (il - ir)-                  other -> error $ show ("mkSpecialBinary (constant)",il,ir,other)+                  (And,U x,U y)         | x == y+                                       -> toStdLogicExpr fTy (il .&. ir)+                  other -> error $ show ("mkSpecialBinary (constant)",op,il,ir,other)         _ -> coerceR fTy (ExprBinary op (coerceF lty l)(coerceF rty r))     binop op _ _ = error $ "Binary op " ++ show op ++ " must have exactly 2 arguments" 
Language/KansasLava/Netlist/Utils.hs view
@@ -73,12 +73,18 @@ 	     B   -> ExprLit Nothing (ExprBit (b (fromInteger i))) 	     V n -> ExprLit (Just n) (ExprNum i) 	     GenericTy   -> ExprLit Nothing  (ExprNum i)-	     _ -> error "fromIntegerToExpr: was expecting B or V from normalized number"+	     ty -> error $ unwords ["fromIntegerToExpr: was expecting B or V from normalized number:", show ty, show i]   where b :: Int -> Bit         b 0 = F         b 1 = T         b _ = error "fromIntegerExpr: bit not of a value 0 or 1" +fromBoolToExpr :: Type -> Bool -> Expr+fromBoolToExpr t b =+	case toStdLogicTy t of+	     B   -> ExprLit Nothing (ExprBit (if b then T else F))+	     _ -> error "fromBoolToExpr: was expecting B from normalized number"+ instance ToTypedExpr RepValue where 	-- From a literal into a typed Expr 	-- NOTE: We use Integer here as a natural, and assume overflow@@ -138,6 +144,9 @@ instance ToStdLogicExpr Integer where 	-- From a literal into a StdLogic Expr 	toStdLogicExpr = fromIntegerToExpr++instance ToStdLogicExpr Bool where+	toStdLogicExpr = fromBoolToExpr  instance ToStdLogicExpr RepValue where 	toStdLogicExpr t r = toTypedExpr t (fromRepToInteger r)
Language/KansasLava/Protocols/Patch.hs view
@@ -3,7 +3,7 @@ {-# LANGUAGE NoMonomorphismRestriction #-} {-# LANGUAGE FlexibleContexts, FlexibleInstances #-} {-# LANGUAGE UndecidableInstances, TypeSynonymInstances #-}-{-# LANGUAGE RankNTypes, ImpredicativeTypes #-}+{-# LANGUAGE RankNTypes #-} {-# LANGUAGE TypeFamilies, GADTs #-} {-# LANGUAGE ParallelListComp, TypeOperators #-} module Language.KansasLava.Protocols.Patch@@ -180,16 +180,16 @@ 	 => (forall clk' . Signal clk' a -> Signal clk' b) 	 -> Patch (sig (Enabled a)) (sig (Enabled b)) 	   	  (ack)		    (ack)-mapP = forwardP . mapEnabled+mapP f = forwardP (mapEnabled f)  ------------------------------------------------ -- Unit ------------------------------------------------  -- | An instance of the Unit type contains a value that carries no information.-class Unit unit where+class Unit a where   -- | The name of the specific value.-  unit :: unit+  unit :: a   unUnit :: (Unit unit) => unit -> ()
Language/KansasLava/Rep/TH.hs view
@@ -14,25 +14,25 @@ repIntegral :: Name -> KLT.Type -> Q [Dec] repIntegral tyName tyType = do    x <- newName "x"-   sequence [ instanceD +   sequence [ instanceD 		(return []) 		(appT (conT ''Rep) (conT tyName)) 		[ tySynInstD ''W (tySynEqn [conT tyName] (conT (mkName xSize))) 		, dataInstD  (return [])-		 	     ''X [conT tyName]+		 	     ''X [conT tyName] Nothing 				[ normalC xConsName 					  [ strictType notStrict (appT (conT ''Maybe) (conT tyName)) ] 				]-				[]+				(return []) 		, funD 'optX-		  	[clause [varP x] +		  	[clause [varP x] 				      (normalB 					 (appE (conE xConsName) 					      (varE x))) 		 		      [] 			] 		, funD 'unX-		  	[clause [conP xConsName [varP x]] +		  	[clause [conP xConsName [varP x]] 				      (normalB 					 (varE x)) 		 		      []@@ -51,7 +51,7 @@ 		, valD (varP 'showRep) 		       (normalB (varE 'showRepDefault)) 		       []-		] +		] 	]   where 	strName	  = nameBase tyName@@ -63,25 +63,25 @@ repBitRep :: Name -> Int -> Q [Dec] repBitRep tyName width = do -- tyType = do    x <- newName "x"-   sequence [ instanceD +   sequence [ instanceD 		(return []) 		(appT (conT ''Rep) (conT tyName)) 		[ tySynInstD ''W (tySynEqn [conT tyName] (conT (mkName xSize))) 		, dataInstD  (return [])-		 	     ''X [conT tyName]+		 	     ''X [conT tyName] Nothing 				[ normalC xConsName 					  [ strictType notStrict (appT (conT ''Maybe) (conT tyName)) ] 				]-				[]+				(return []) 		, funD 'optX-		  	[clause [varP x] +		  	[clause [varP x] 				      (normalB 					 (appE (conE xConsName) 					      (varE x))) 		 		      [] 			] 		, funD 'unX-		  	[clause [conP xConsName [varP x]] +		  	[clause [conP xConsName [varP x]] 				      (normalB 					 (varE x)) 		 		      []@@ -102,7 +102,7 @@ 		, valD (varP 'showRep) 		       (normalB (varE 'showRepDefault)) 		       []-		] +		] 	]   where 	strName	  = nameBase tyName
kansas-lava.cabal view
@@ -1,5 +1,5 @@ Name:               kansas-lava-Version:            0.2.4.3+Version:            0.2.4.4 Synopsis:           Kansas Lava is a hardware simulator and VHDL generator.  Description: @@ -53,7 +53,7 @@         process,         netlist >= 0.3.1,         netlist-to-vhdl >= 0.3.1,-        template-haskell, +        template-haskell >= 2.11 && < 2.12,         bytestring,         data-reify == 0.6   Exposed-modules: