-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Types and a small DSL for working with netlistsvg
--
-- Please see the README on GitHub at
-- https://github.com/isovector/circus#readme
@package circus
@version 0.1.0.0
module Circus.Types
-- | A collection of modules.
newtype Schema
Schema :: Map ModuleName Module -> Schema
[schemaModules] :: Schema -> Map ModuleName Module
data Module
Module :: Map PortName Port -> Map CellName Cell -> Module
-- | Inputs and outputs
[modulePorts] :: Module -> Map PortName Port
-- | Components
[moduleCells] :: Module -> Map CellName Cell
newtype ModuleName
ModuleName :: Text -> ModuleName
[getModuleName] :: ModuleName -> Text
newtype PortName
PortName :: Text -> PortName
[getPortName] :: PortName -> Text
newtype CellName
CellName :: Text -> CellName
[getCellName] :: CellName -> Text
data Port
Port :: Direction -> [Bit] -> Port
-- | Whether this port is an input or an output
[portDirection] :: Port -> Direction
-- | The individual wires connected to this port. They are numbered in the
-- same order they are described here.
[portBits] :: Port -> [Bit]
-- | A single wire. Bits are defined implicitly by a unique ID. Every
-- component that references the bit will be connected with a common
-- node.
newtype Bit
Bit :: Int -> Bit
[getBit] :: Bit -> Int
data Cell
Cell :: CellType -> Map Parameter Int -> Map Text Value -> Map PortName Direction -> Map PortName [Bit] -> Cell
-- | The symbol to use when drawing this cell.
[cellType] :: Cell -> CellType
[cellParameters] :: Cell -> Map Parameter Int
[cellAttributes] :: Cell -> Map Text Value
-- | Which ports are inputs and outputs.
[cellPortDirections] :: Cell -> Map PortName Direction
-- | What are the ports connected to? Each port may connect to several
-- bits, but make sure you set the Width cell Parameter if
-- this is the case.
[cellConnections] :: Cell -> Map PortName [Bit]
data Parameter
-- | How many bits wide is the given Port?
Width :: PortName -> Parameter
-- | Is the given Port signed?
Signed :: PortName -> Parameter
data Direction
Input :: Direction
Output :: Direction
-- | Master list of cells, and their associated names is available here:
--
--
-- https://raw.githubusercontent.com/nturley/netlistsvg/master/lib/default.svg?sanitize=true
data CellType
CellGeneric :: Text -> CellType
pattern CellMux :: CellType
pattern CellMuxBus :: CellType
pattern CellTribuf :: CellType
pattern CellAnd :: CellType
pattern CellOr :: CellType
pattern CellNand :: CellType
pattern CellNor :: CellType
pattern CellXor :: CellType
pattern CellXnor :: CellType
pattern CellNot :: CellType
pattern CellAdd :: CellType
pattern CellEq :: CellType
pattern CellDff :: CellType
pattern CellDffn :: CellType
pattern CellLt :: CellType
pattern CellGe :: CellType
pattern CellConstant :: CellType
renderModuleBS :: Module -> ByteString
renderModuleString :: Module -> String
-- | Helper function for constructing Cells.
mkCell :: CellType -> Map PortName (Direction, [Bit]) -> Cell
-- | Helper function for constructing Cells with explicit
-- attributes.
mkCell' :: CellType -> Map Text Value -> Map PortName (Direction, [Bit]) -> Cell
instance Data.Aeson.Types.ToJSON.ToJSON Circus.Types.Schema
instance Data.Aeson.Types.FromJSON.FromJSON Circus.Types.Schema
instance Data.Aeson.Types.ToJSON.ToJSON Circus.Types.Module
instance Data.Aeson.Types.FromJSON.FromJSON Circus.Types.Module
instance Data.Aeson.Types.ToJSON.ToJSON Circus.Types.Port
instance Data.Aeson.Types.FromJSON.FromJSON Circus.Types.Port
instance Data.Aeson.Types.ToJSON.ToJSON Circus.Types.Cell
instance Data.Aeson.Types.FromJSON.FromJSON Circus.Types.Cell
instance Data.Aeson.Types.ToJSON.ToJSON Circus.Types.ModuleName
instance Data.Aeson.Types.FromJSON.FromJSON Circus.Types.ModuleName
instance Data.Aeson.Types.FromJSON.FromJSONKey Circus.Types.ModuleName
instance Data.Aeson.Types.ToJSON.ToJSONKey Circus.Types.ModuleName
instance Data.String.IsString Circus.Types.ModuleName
instance GHC.Show.Show Circus.Types.ModuleName
instance GHC.Classes.Ord Circus.Types.ModuleName
instance GHC.Classes.Eq Circus.Types.ModuleName
instance Data.Data.Data Circus.Types.ModuleName
instance Data.Aeson.Types.ToJSON.ToJSON Circus.Types.PortName
instance Data.Aeson.Types.FromJSON.FromJSON Circus.Types.PortName
instance Data.Aeson.Types.FromJSON.FromJSONKey Circus.Types.PortName
instance Data.Aeson.Types.ToJSON.ToJSONKey Circus.Types.PortName
instance Data.String.IsString Circus.Types.PortName
instance GHC.Show.Show Circus.Types.PortName
instance GHC.Classes.Ord Circus.Types.PortName
instance GHC.Classes.Eq Circus.Types.PortName
instance Data.Data.Data Circus.Types.PortName
instance Data.Aeson.Types.ToJSON.ToJSON Circus.Types.CellName
instance Data.Aeson.Types.FromJSON.FromJSON Circus.Types.CellName
instance Data.Aeson.Types.FromJSON.FromJSONKey Circus.Types.CellName
instance Data.Aeson.Types.ToJSON.ToJSONKey Circus.Types.CellName
instance Data.String.IsString Circus.Types.CellName
instance GHC.Show.Show Circus.Types.CellName
instance GHC.Classes.Ord Circus.Types.CellName
instance GHC.Classes.Eq Circus.Types.CellName
instance Data.Data.Data Circus.Types.CellName
instance Data.Aeson.Types.FromJSON.FromJSON Circus.Types.Bit
instance Data.Aeson.Types.ToJSON.ToJSON Circus.Types.Bit
instance GHC.Num.Num Circus.Types.Bit
instance Data.Data.Data Circus.Types.Bit
instance GHC.Show.Show Circus.Types.Bit
instance GHC.Classes.Ord Circus.Types.Bit
instance GHC.Classes.Eq Circus.Types.Bit
instance Data.Aeson.Types.ToJSON.ToJSON Circus.Types.Parameter
instance Data.Aeson.Types.FromJSON.FromJSON Circus.Types.Parameter
instance Data.Data.Data Circus.Types.Parameter
instance GHC.Generics.Generic Circus.Types.Parameter
instance GHC.Show.Show Circus.Types.Parameter
instance GHC.Classes.Ord Circus.Types.Parameter
instance GHC.Classes.Eq Circus.Types.Parameter
instance Data.Data.Data Circus.Types.Direction
instance GHC.Enum.Bounded Circus.Types.Direction
instance GHC.Enum.Enum Circus.Types.Direction
instance GHC.Read.Read Circus.Types.Direction
instance GHC.Show.Show Circus.Types.Direction
instance GHC.Classes.Ord Circus.Types.Direction
instance GHC.Classes.Eq Circus.Types.Direction
instance Data.Data.Data Circus.Types.Port
instance GHC.Show.Show Circus.Types.Port
instance GHC.Classes.Eq Circus.Types.Port
instance Data.Data.Data Circus.Types.CellType
instance GHC.Show.Show Circus.Types.CellType
instance GHC.Classes.Ord Circus.Types.CellType
instance GHC.Classes.Eq Circus.Types.CellType
instance Data.Data.Data Circus.Types.Cell
instance GHC.Show.Show Circus.Types.Cell
instance GHC.Classes.Eq Circus.Types.Cell
instance Data.Data.Data Circus.Types.Module
instance GHC.Show.Show Circus.Types.Module
instance GHC.Classes.Eq Circus.Types.Module
instance GHC.Base.Monoid Circus.Types.Schema
instance GHC.Base.Semigroup Circus.Types.Schema
instance Data.Data.Data Circus.Types.Schema
instance GHC.Show.Show Circus.Types.Schema
instance GHC.Classes.Eq Circus.Types.Schema
instance GHC.Base.Semigroup Circus.Types.Module
instance GHC.Base.Monoid Circus.Types.Module
instance Data.Aeson.Types.ToJSON.ToJSON Circus.Types.CellType
instance Data.Aeson.Types.FromJSON.FromJSON Circus.Types.CellType
instance Data.Aeson.Types.ToJSON.ToJSON Circus.Types.Direction
instance Data.Aeson.Types.FromJSON.FromJSON Circus.Types.Direction
instance Data.Aeson.Types.ToJSON.ToJSONKey Circus.Types.Parameter
instance Data.Aeson.Types.FromJSON.FromJSONKey Circus.Types.Parameter
module Circus.Simplify
-- | Recursively delete cells that output only bits which are unused in the
-- circuit.
simplify :: Module -> Module
module Circus.DSL
data GraphState
GraphState :: Bit -> Module -> GraphState
[gs_next_port] :: GraphState -> Bit
[gs_module] :: GraphState -> Module
-- | Synthesize a fresh Bit, suitable for connecting Cells
-- together.
freshBit :: MonadState GraphState m => m Bit
-- | Add a Cell to the Module under construction.
addCell :: MonadState GraphState m => Cell -> m ()
-- | Like unifyBits, but works in pure contexts.
unifyBitsPure :: Data a => Map Bit Bit -> a -> a
-- | Given a mapping from source Bits to target Bits, replace
-- all occurences of the source bits in the Module with the target
-- bits.
--
-- This function allows you to call addCell as you go, and create
-- feedback loops later without needing to know about them in advance.
unifyBits :: MonadState GraphState m => Map Bit Bit -> m ()
instance GHC.Generics.Generic Circus.DSL.GraphState
instance GHC.Base.Semigroup Circus.DSL.GraphState
instance GHC.Base.Monoid Circus.DSL.GraphState