blarney
Copyright(c) Matthew Naylor 2019
(c) Alexandre Joannou 2019-2021
LicenseMIT
Maintainermattfn@gmail.com
Stabilityexperimental
Safe HaskellSafe-Inferred

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

Documentation

class Interface a where Source #

Minimal complete definition

Nothing

Methods

toIfc :: a -> (IfcTerm, IfcType) Source #

For generic deriving

default toIfc :: (Generic a, GInterface (Rep a)) => a -> (IfcTerm, IfcType) Source #

fromIfc :: IfcTerm -> a Source #

default fromIfc :: (Generic a, GInterface (Rep a)) => IfcTerm -> a Source #

Instances

Instances details
Interface Clock # 
Instance details

Defined in Blarney.Core.Interface

Interface Reset # 
Instance details

Defined in Blarney.Core.Interface

Interface PulseReg # 
Instance details

Defined in Blarney.PulseReg

Interface PulseWire # 
Instance details

Defined in Blarney.PulseWire

Interface () # 
Instance details

Defined in Blarney.Core.Interface

Methods

toIfc :: () -> (IfcTerm, IfcType) Source #

fromIfc :: IfcTerm -> () Source #

KnownNat n => Interface (Bit n) # 
Instance details

Defined in Blarney.Core.Interface

KnownNat n => Interface (Signed n) # 
Instance details

Defined in Blarney.Core.Interface

Interface a => Interface (Action a) # 
Instance details

Defined in Blarney.Core.Interface

(Interface a, Bits a) => Interface (ReadWrite a) # 
Instance details

Defined in Blarney.Core.Interface

(Interface a, Bits a) => Interface (Reg a) # 
Instance details

Defined in Blarney.Core.Interface

(Interface a, Bits a) => Interface (Wire a) # 
Instance details

Defined in Blarney.Core.Interface

(Interface a, Bits a) => Interface (WriteOnly a) # 
Instance details

Defined in Blarney.Core.Interface

Interface t => Interface (Option t) # 
Instance details

Defined in Blarney.Option

(Interface a, Bits a) => Interface (Queue a) # 
Instance details

Defined in Blarney.Queue

(Interface t, Bits t) => Interface (Sink t) # 
Instance details

Defined in Blarney.SourceSink

Interface t => Interface (Source t) # 
Instance details

Defined in Blarney.SourceSink

(Interface a, Bits a) => Interface (Stack a) # 
Instance details

Defined in Blarney.Stack

IsTaggedUnion (TaggedUnion members) => Interface (TaggedUnion members) # 
Instance details

Defined in Blarney.TaggedUnion

Methods

toIfc :: TaggedUnion members -> (IfcTerm, IfcType) Source #

fromIfc :: IfcTerm -> TaggedUnion members Source #

(Interface req_t, Interface resp_t, Bits resp_t) => Interface (Client req_t resp_t) # 
Instance details

Defined in Blarney.ClientServer

Methods

toIfc :: Client req_t resp_t -> (IfcTerm, IfcType) Source #

fromIfc :: IfcTerm -> Client req_t resp_t Source #

(Bits req_t, Interface req_t, Interface resp_t) => Interface (Server req_t resp_t) # 
Instance details

Defined in Blarney.ClientServer

Methods

toIfc :: Server req_t resp_t -> (IfcTerm, IfcType) Source #

fromIfc :: IfcTerm -> Server req_t resp_t Source #

(KnownNat n, Interface a) => Interface (Vec n a) # 
Instance details

Defined in Blarney.Vector

Methods

toIfc :: Vec n a -> (IfcTerm, IfcType) Source #

fromIfc :: IfcTerm -> Vec n a Source #

(Interface a, Bits a, Method b) => Interface (a -> b) # 
Instance details

Defined in Blarney.Core.Interface

Methods

toIfc :: (a -> b) -> (IfcTerm, IfcType) Source #

fromIfc :: IfcTerm -> a -> b Source #

(Interface a, Interface b) => Interface (a, b) # 
Instance details

Defined in Blarney.Core.Interface

Methods

toIfc :: (a, b) -> (IfcTerm, IfcType) Source #

fromIfc :: IfcTerm -> (a, b) Source #

(Interface a, Interface b, Interface c) => Interface (a, b, c) # 
Instance details

Defined in Blarney.Core.Interface

Methods

toIfc :: (a, b, c) -> (IfcTerm, IfcType) Source #

fromIfc :: IfcTerm -> (a, b, c) Source #

(Interface a, Interface b, Interface c, Interface d) => Interface (a, b, c, d) # 
Instance details

Defined in Blarney.Core.Interface

Methods

toIfc :: (a, b, c, d) -> (IfcTerm, IfcType) Source #

fromIfc :: IfcTerm -> (a, b, c, d) Source #

(Interface a, Interface b, Interface c, Interface d, Interface e) => Interface (a, b, c, d, e) # 
Instance details

Defined in Blarney.Core.Interface

Methods

toIfc :: (a, b, c, d, e) -> (IfcTerm, IfcType) Source #

fromIfc :: IfcTerm -> (a, b, c, d, e) Source #

(Interface a, Interface b, Interface c, Interface d, Interface e, Interface f) => Interface (a, b, c, d, e, f) # 
Instance details

Defined in Blarney.Core.Interface

Methods

toIfc :: (a, b, c, d, e, f) -> (IfcTerm, IfcType) Source #

fromIfc :: IfcTerm -> (a, b, c, d, e, f) Source #

(Interface a, Interface b, Interface c, Interface d, Interface e, Interface f, Interface g) => Interface (a, b, c, d, e, f, g) # 
Instance details

Defined in Blarney.Core.Interface

Methods

toIfc :: (a, b, c, d, e, f, g) -> (IfcTerm, IfcType) Source #

fromIfc :: IfcTerm -> (a, b, c, d, e, f, g) Source #

toPorts :: ToPorts a => a Source #

fromPorts :: FromPorts a b => IfcTerm -> a -> b Source #

data PortInfo 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

  • name :: String

    Desired field name

  • argNames :: [String]

    Desired method argument names

  • alwaysEnabled :: Bool

    Avoid generation of method enable wire

  • skipName :: Bool

    Do not generate a name for this port. Useful when we are only intested in a method's arguments. Use with care; this can introduce ambiguous names in generated interface.

  • enableName :: String

    Name extension for a method's enable wire

portEmpty :: PortInfo Source #

Empty information about a port

portName :: String -> PortInfo Source #

Name a port

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

portMethodAlwaysEn :: String -> [String] -> PortInfo Source #

Name an always-enabled method port

portSkipName :: PortInfo Source #

Skip name augmentation for a port

class Method a where Source #

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.

Instances

Instances details
Interface a => Method (Action a) # 
Instance details

Defined in Blarney.Core.Interface

(Interface a, Bits a, Method b) => Method (a -> b) # 
Instance details

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

Instances details
Interface a => Modular a # 
Instance details

Defined in Blarney.Core.Interface

Methods

makeMod :: Int -> a -> Declare () Source #

makeInst :: String -> InstanceInfo -> Int -> Declare () -> Maybe CustomNetlist -> a Source #

Interface a => Modular (Module a) # 
Instance details

Defined in Blarney.Core.Interface

Methods

makeMod :: Int -> Module a -> Declare () Source #

makeInst :: String -> InstanceInfo -> Int -> Declare () -> Maybe CustomNetlist -> Module a Source #

(Interface a, Modular m) => Modular (a -> m) # 
Instance details

Defined in Blarney.Core.Interface

Methods

makeMod :: Int -> (a -> m) -> Declare () Source #

makeInst :: String -> InstanceInfo -> Int -> Declare () -> Maybe CustomNetlist -> a -> m Source #

makeModule :: Modular a => a -> Module () Source #

makeInstanceWithInfo Source #

Arguments

:: Modular a 
=> String

Name of component being instantiated

-> InstanceInfo

Instance information

-> Maybe CustomNetlist

Optional netlist for component

-> a 

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 #