| Copyright | (c) Matthew Naylor 2019 (c) Alexandre Joannou 2019-2021 |
|---|---|
| License | MIT |
| Maintainer | mattfn@gmail.com |
| Stability | experimental |
| Safe Haskell | Safe-Inferred |
| Language | GHC2021 |
Blarney.Core.Interface
Description
Rather than flattening the entire design hierarchy down to a single netlist, we
want to maintain the modular structure when generating external modules.
Interface allows Blarney functions to be turned into external
modules, and external modules to be instantiated in a Blarney description.
Synopsis
- class Interface a where
- data IfcTerm
- data IfcType
- toIfcTerm :: Interface a => a -> IfcTerm
- fromIfcTerm :: Interface a => IfcTerm -> a
- toIfcType :: Interface a => a -> IfcType
- toPorts :: ToPorts a => a
- fromPorts :: FromPorts a b => IfcTerm -> a -> b
- data PortInfo = PortInfo {
- name :: String
- argNames :: [String]
- alwaysEnabled :: Bool
- skipName :: Bool
- enableName :: String
- portEmpty :: PortInfo
- portName :: String -> PortInfo
- portMethod :: String -> [String] -> PortInfo
- portMethodEn :: String -> String -> [String] -> PortInfo
- portMethodAlwaysEn :: String -> [String] -> PortInfo
- portSkipName :: PortInfo
- class Method a where
- toMethodTerm :: a -> IfcTerm
- fromMethodTerm :: IfcTerm -> a
- toMethodType :: a -> IfcType
- class Modular a where
- makeMod :: Int -> a -> Declare ()
- makeInst :: String -> InstanceInfo -> Int -> Declare () -> Maybe CustomNetlist -> a
- data InstanceInfo = InstanceInfo {}
- makeModule :: Modular a => a -> Module ()
- makeInstanceWithInfo :: Modular a => String -> InstanceInfo -> Maybe CustomNetlist -> a
- makeInstance :: Modular a => String -> a
- makeBoundaryWithInfo :: Modular a => InstanceInfo -> String -> a -> a
- makeBoundary :: Modular a => String -> a -> a
- makeBoundaryWithClockAndReset :: Modular a => (Clock, Reset) -> String -> a -> a
Documentation
class Interface a where Source #
Minimal complete definition
Nothing
Instances
Constructors
| IfcTermUnit | |
| IfcTermBV BV | |
| IfcTermAction (Action IfcTerm) | |
| IfcTermProduct IfcTerm IfcTerm | |
| IfcTermFun (IfcTerm -> IfcTerm) |
fromIfcTerm :: Interface a => IfcTerm -> a Source #
The user can request certain properties, e.g. names, in a generated flat interface (e.g. Verilog). Such properties are captured per-port as:
Constructors
| PortInfo | |
Fields
| |
portMethod :: String -> [String] -> PortInfo Source #
Name a method port, i.e. the method and its args
portMethodEn :: String -> String -> [String] -> PortInfo Source #
Name a method port and its enable wire
portSkipName :: PortInfo Source #
Skip name augmentation for a port
This class defines which functions make a valid Interface.
Specifially, a Method is any function returning an Action
whose arguments are in Interface and Bits. Note that
we don't actually use the Bits dictionary, but it captures at
the type level the restriction that method arguments must be
assignable at the circuit level.
Methods
toMethodTerm :: a -> IfcTerm Source #
fromMethodTerm :: IfcTerm -> a Source #
toMethodType :: a -> IfcType Source #
Instances
| Interface a => Method (Action a) # | |
Defined in Blarney.Core.Interface Methods toMethodTerm :: Action a -> IfcTerm Source # fromMethodTerm :: IfcTerm -> Action a Source # toMethodType :: Action a -> IfcType Source # | |
| (Interface a, Bits a, Method b) => Method (a -> b) # | |
Defined in Blarney.Core.Interface Methods toMethodTerm :: (a -> b) -> IfcTerm Source # fromMethodTerm :: IfcTerm -> a -> b Source # toMethodType :: (a -> b) -> IfcType Source # | |
class Modular a where Source #
Methods
makeMod :: Int -> a -> Declare () Source #
makeInst :: String -> InstanceInfo -> Int -> Declare () -> Maybe CustomNetlist -> a Source #
Instances
| Interface a => Modular a # | |
Defined in Blarney.Core.Interface | |
| Interface a => Modular (Module a) # | |
Defined in Blarney.Core.Interface | |
| (Interface a, Modular m) => Modular (a -> m) # | |
Defined in Blarney.Core.Interface | |
data InstanceInfo Source #
Constructors
| InstanceInfo | |
Fields
| |
makeModule :: Modular a => a -> Module () Source #
Arguments
| :: Modular a | |
| => String | Name of component being instantiated |
| -> InstanceInfo | Instance information |
| -> Maybe CustomNetlist | Optional netlist for component |
| -> a |
makeInstance :: Modular a => String -> a Source #
makeBoundaryWithInfo :: Modular a => InstanceInfo -> String -> a -> a Source #
Make a named synthesis boundary around the given module. Note that it is possible for the supplied module to capture data that is independent of the module's inputs; this may or may not be desirable, so take care.
makeBoundary :: Modular a => String -> a -> a Source #