Safe Haskell | None |
---|---|
Language | Haskell2010 |
The Fabric module is used for generating a top-level VHDL entity for a Lava circuit, with inputs and outputs.
- data Fabric a = Fabric {}
- data Pad
- runFabric :: Fabric a -> [(String, Pad)] -> (a, [(String, Pad)])
- inStdLogic :: (Rep a, Show a, W a ~ X1) => String -> Fabric (Seq a)
- inStdLogicVector :: forall a. (Rep a, Show a, Size (W a)) => String -> Fabric (Seq a)
- inGeneric :: String -> Fabric Integer
- outStdLogic :: (Rep a, Show a, W a ~ X1) => String -> Seq a -> Fabric ()
- outStdLogicVector :: forall a. (Rep a, Show a, Size (W a)) => String -> Seq a -> Fabric ()
- padStdLogicType :: Pad -> StdLogicType
- theClk :: String -> Fabric ()
- theRst :: String -> Fabric ()
- theClkEn :: String -> Fabric ()
- reifyFabric :: Fabric () -> IO KLEG
- runFabricWithResult :: Fabric a -> [(String, Pad)] -> a
- runFabricWithDriver :: Fabric () -> Fabric a -> a
Documentation
The Fabric
structure, which is also a monad.
fabric_example :: Fabric () fabric_example = do i0 <- inStdLogic "i0" i1 <- inStdLogic "i1" let (c,s) = halfAdder i0 i1 outStdLogic "carry" c outStdLogic "sum" s where halfAdder :: Seq Bool -> Seq Bool -> (Seq Bool,Seq Bool) halfAdder a b = (carry,sum_) where carry = and2 a b sum_ = xor2 a b
A Fabric consists of a list of input ports, and yields a list of output ports and generics.
A Pad represents the type of a top-level input/output port.
runFabric :: Fabric a -> [(String, Pad)] -> (a, [(String, Pad)]) Source #
Reify a fabric, returning the output ports and the result of the Fabric monad.
inStdLogic :: (Rep a, Show a, W a ~ X1) => String -> Fabric (Seq a) Source #
Generate a named std_logic input port.
inStdLogicVector :: forall a. (Rep a, Show a, Size (W a)) => String -> Fabric (Seq a) Source #
Generate a named std_logic_vector port input.
outStdLogic :: (Rep a, Show a, W a ~ X1) => String -> Seq a -> Fabric () Source #
Generate a named std_logic output port, given a Lava circuit.
outStdLogicVector :: forall a. (Rep a, Show a, Size (W a)) => String -> Seq a -> Fabric () Source #
Generate a named std_logic_vector output port, given a Lava circuit.
padStdLogicType :: Pad -> StdLogicType Source #
Get the type of a pad.
theRst :: String -> Fabric () Source #
theRst gives the external name for the reset signal [default = low].
theClkEn :: String -> Fabric () Source #
theClkEn gives the external name for the clock enable signal [default = high].
reifyFabric :: Fabric () -> IO KLEG Source #
reifyFabric
does reification of a 'Fabric ()' into a KLEG
.
runFabricWithResult :: Fabric a -> [(String, Pad)] -> a Source #
runFabric
runs a Fabric a with arguments, and gives a value result.
must have no (monadic) outputs.
runFabricWithDriver :: Fabric () -> Fabric a -> a Source #
runFabricWithDriver
runs a Fabric () using a driver Fabric.