| Copyright | (C) 2015-2016 University of Twente 2017 Myrtle Software Ltd Google Inc. |
|---|---|
| License | BSD2 (see the file LICENSE) |
| Maintainer | Christiaan Baaij <christiaan.baaij@gmail.com> |
| Safe Haskell | None |
| Language | Haskell2010 |
Clash.Backend
Description
Synopsis
- type ModName = String
- data Usage
- class Backend state where
- nestM :: Modifier -> Modifier -> Maybe Modifier
- escapeTemplate :: Identifier -> Identifier
Documentation
Is a type used for internal or external use
Minimal complete definition
initBackend, hdlKind, primDirs, name, extension, extractTypes, genHDL, mkTyPackage, hdlType, hdlTypeErrValue, hdlTypeMark, hdlRecSel, hdlSig, genStmt, inst, expr, iwWidth, toBV, fromBV, hdlSyn, mkIdentifier, extendIdentifier, setModName, setSrcSpan, getSrcSpan, blockDecl, unextend, addInclude, addLibraries, addImports
Methods
initBackend :: Int -> HdlSyn -> state #
Initial state for state monad
What HDL is the backend generating
primDirs :: state -> IO [FilePath] #
Location for the primitive definitions
Name of backend, used for directory to put output files in. Should be | constant function / ignore argument.
extension :: state -> String #
File extension for target langauge
extractTypes :: state -> HashSet HWType #
Get the set of types out of state
genHDL :: String -> SrcSpan -> Component -> Mon (State state) ((String, Doc), [(String, Doc)]) #
Generate HDL for a Netlist component
mkTyPackage :: String -> [HWType] -> Mon (State state) [(String, Doc)] #
Generate a HDL package containing type definitions for the given HWTypes
hdlType :: Usage -> HWType -> Mon (State state) Doc #
Convert a Netlist HWType to a target HDL type
hdlTypeErrValue :: HWType -> Mon (State state) Doc #
Convert a Netlist HWType to an HDL error value for that type
hdlTypeMark :: HWType -> Mon (State state) Doc #
Convert a Netlist HWType to the root of a target HDL type
hdlRecSel :: HWType -> Int -> Mon (State state) Doc #
Create a record selector
hdlSig :: Text -> HWType -> Mon (State state) Doc #
Create a signal declaration from an identifier (Text) and Netlist HWType
genStmt :: Bool -> State state Doc #
Create a generative block statement marker
inst :: Declaration -> Mon (State state) (Maybe Doc) #
Turn a Netlist Declaration to a HDL concurrent block
expr :: Bool -> Expr -> Mon (State state) Doc #
Turn a Netlist expression into a HDL expression
Bit-width of IntWordInteger
toBV :: HWType -> Text -> Mon (State state) Doc #
Convert to a bit-vector
fromBV :: HWType -> Text -> Mon (State state) Doc #
Convert from a bit-vector
hdlSyn :: State state HdlSyn #
Synthesis tool we're generating HDL for
mkIdentifier :: State state (IdType -> Identifier -> Identifier) #
mkIdentifier
extendIdentifier :: State state (IdType -> Identifier -> Identifier -> Identifier) #
mkIdentifier
setModName :: ModName -> state -> state #
setModName
setSrcSpan :: SrcSpan -> State state () #
setSrcSpan
getSrcSpan :: State state SrcSpan #
getSrcSpan
blockDecl :: Text -> [Declaration] -> Mon (State state) Doc #
Block of declarations
unextend :: State state (Identifier -> Identifier) #
unextend/unescape identifier
addInclude :: (String, Doc) -> State state () #
addLibraries :: [Text] -> State state () #
addImports :: [Text] -> State state () #
Instances
nestM :: Modifier -> Modifier -> Maybe Modifier #
Try to merge nested modifiers into a single modifier, needed by the VHDL and SystemVerilog backend.
escapeTemplate :: Identifier -> Identifier #
Replace a normal HDL template placeholder with an unescaped/unextended template placeholder.
Needed when the the place-holder is filled with an escaped/extended identifier inside an escaped/extended identifier and we want to strip the escape /extension markers. Otherwise we end up with illegal identifiers.