{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveLift #-}
{-# LANGUAGE TemplateHaskellQuotes #-}
{-# LANGUAGE Safe #-}
{-# OPTIONS_HADDOCK show-extensions #-}
module Clash.Annotations.TopEntity
(
TopEntity (..)
, PortName (..)
, defSyn
)
where
import GHC.Generics
import qualified Language.Haskell.TH as TH
import Language.Haskell.TH.Syntax (Lift(lift))
import Data.Data
data TopEntity
= Synthesize
{ TopEntity -> String
t_name :: String
, TopEntity -> [PortName]
t_inputs :: [PortName]
, TopEntity -> PortName
t_output :: PortName
}
| TestBench TH.Name
deriving (Typeable TopEntity
DataType
Constr
Typeable TopEntity =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TopEntity -> c TopEntity)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TopEntity)
-> (TopEntity -> Constr)
-> (TopEntity -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TopEntity))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TopEntity))
-> ((forall b. Data b => b -> b) -> TopEntity -> TopEntity)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TopEntity -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TopEntity -> r)
-> (forall u. (forall d. Data d => d -> u) -> TopEntity -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> TopEntity -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TopEntity -> m TopEntity)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TopEntity -> m TopEntity)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TopEntity -> m TopEntity)
-> Data TopEntity
TopEntity -> DataType
TopEntity -> Constr
(forall b. Data b => b -> b) -> TopEntity -> TopEntity
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TopEntity -> c TopEntity
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TopEntity
forall a.
Typeable a =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> TopEntity -> u
forall u. (forall d. Data d => d -> u) -> TopEntity -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TopEntity -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TopEntity -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TopEntity -> m TopEntity
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TopEntity -> m TopEntity
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TopEntity
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TopEntity -> c TopEntity
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TopEntity)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TopEntity)
$cTestBench :: Constr
$cSynthesize :: Constr
$tTopEntity :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> TopEntity -> m TopEntity
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TopEntity -> m TopEntity
gmapMp :: (forall d. Data d => d -> m d) -> TopEntity -> m TopEntity
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TopEntity -> m TopEntity
gmapM :: (forall d. Data d => d -> m d) -> TopEntity -> m TopEntity
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TopEntity -> m TopEntity
gmapQi :: Int -> (forall d. Data d => d -> u) -> TopEntity -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> TopEntity -> u
gmapQ :: (forall d. Data d => d -> u) -> TopEntity -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> TopEntity -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TopEntity -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TopEntity -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TopEntity -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TopEntity -> r
gmapT :: (forall b. Data b => b -> b) -> TopEntity -> TopEntity
$cgmapT :: (forall b. Data b => b -> b) -> TopEntity -> TopEntity
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TopEntity)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TopEntity)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c TopEntity)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TopEntity)
dataTypeOf :: TopEntity -> DataType
$cdataTypeOf :: TopEntity -> DataType
toConstr :: TopEntity -> Constr
$ctoConstr :: TopEntity -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TopEntity
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TopEntity
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TopEntity -> c TopEntity
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TopEntity -> c TopEntity
$cp1Data :: Typeable TopEntity
Data,Int -> TopEntity -> ShowS
[TopEntity] -> ShowS
TopEntity -> String
(Int -> TopEntity -> ShowS)
-> (TopEntity -> String)
-> ([TopEntity] -> ShowS)
-> Show TopEntity
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TopEntity] -> ShowS
$cshowList :: [TopEntity] -> ShowS
show :: TopEntity -> String
$cshow :: TopEntity -> String
showsPrec :: Int -> TopEntity -> ShowS
$cshowsPrec :: Int -> TopEntity -> ShowS
Show,(forall x. TopEntity -> Rep TopEntity x)
-> (forall x. Rep TopEntity x -> TopEntity) -> Generic TopEntity
forall x. Rep TopEntity x -> TopEntity
forall x. TopEntity -> Rep TopEntity x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TopEntity x -> TopEntity
$cfrom :: forall x. TopEntity -> Rep TopEntity x
Generic)
instance Lift TopEntity where
lift :: TopEntity -> Q Exp
lift (Synthesize name :: String
name inputs :: [PortName]
inputs output :: PortName
output) =
[Q Exp] -> Q Exp
TH.appsE
[ Name -> Q Exp
TH.conE 'Synthesize
, String -> Q Exp
forall t. Lift t => t -> Q Exp
lift String
name
, [PortName] -> Q Exp
forall t. Lift t => t -> Q Exp
lift [PortName]
inputs
, PortName -> Q Exp
forall t. Lift t => t -> Q Exp
lift PortName
output
]
lift (TestBench _) = String -> Q Exp
forall a. HasCallStack => String -> a
error "Cannot lift a TestBench"
data PortName
= PortName String
| PortProduct String [PortName]
deriving (Typeable PortName
DataType
Constr
Typeable PortName =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> PortName -> c PortName)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c PortName)
-> (PortName -> Constr)
-> (PortName -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c PortName))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c PortName))
-> ((forall b. Data b => b -> b) -> PortName -> PortName)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> PortName -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> PortName -> r)
-> (forall u. (forall d. Data d => d -> u) -> PortName -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> PortName -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> PortName -> m PortName)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> PortName -> m PortName)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> PortName -> m PortName)
-> Data PortName
PortName -> DataType
PortName -> Constr
(forall b. Data b => b -> b) -> PortName -> PortName
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> PortName -> c PortName
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c PortName
forall a.
Typeable a =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> PortName -> u
forall u. (forall d. Data d => d -> u) -> PortName -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> PortName -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> PortName -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> PortName -> m PortName
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> PortName -> m PortName
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c PortName
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> PortName -> c PortName
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c PortName)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c PortName)
$cPortProduct :: Constr
$cPortName :: Constr
$tPortName :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> PortName -> m PortName
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> PortName -> m PortName
gmapMp :: (forall d. Data d => d -> m d) -> PortName -> m PortName
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> PortName -> m PortName
gmapM :: (forall d. Data d => d -> m d) -> PortName -> m PortName
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> PortName -> m PortName
gmapQi :: Int -> (forall d. Data d => d -> u) -> PortName -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> PortName -> u
gmapQ :: (forall d. Data d => d -> u) -> PortName -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> PortName -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> PortName -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> PortName -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> PortName -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> PortName -> r
gmapT :: (forall b. Data b => b -> b) -> PortName -> PortName
$cgmapT :: (forall b. Data b => b -> b) -> PortName -> PortName
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c PortName)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c PortName)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c PortName)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c PortName)
dataTypeOf :: PortName -> DataType
$cdataTypeOf :: PortName -> DataType
toConstr :: PortName -> Constr
$ctoConstr :: PortName -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c PortName
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c PortName
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> PortName -> c PortName
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> PortName -> c PortName
$cp1Data :: Typeable PortName
Data,Int -> PortName -> ShowS
[PortName] -> ShowS
PortName -> String
(Int -> PortName -> ShowS)
-> (PortName -> String) -> ([PortName] -> ShowS) -> Show PortName
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PortName] -> ShowS
$cshowList :: [PortName] -> ShowS
show :: PortName -> String
$cshow :: PortName -> String
showsPrec :: Int -> PortName -> ShowS
$cshowsPrec :: Int -> PortName -> ShowS
Show,(forall x. PortName -> Rep PortName x)
-> (forall x. Rep PortName x -> PortName) -> Generic PortName
forall x. Rep PortName x -> PortName
forall x. PortName -> Rep PortName x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PortName x -> PortName
$cfrom :: forall x. PortName -> Rep PortName x
Generic,PortName -> Q Exp
(PortName -> Q Exp) -> Lift PortName
forall t. (t -> Q Exp) -> Lift t
lift :: PortName -> Q Exp
$clift :: PortName -> Q Exp
Lift)
defSyn :: String -> TopEntity
defSyn :: String -> TopEntity
defSyn name :: String
name = Synthesize :: String -> [PortName] -> PortName -> TopEntity
Synthesize
{ t_name :: String
t_name = String
name
, t_inputs :: [PortName]
t_inputs = []
, t_output :: PortName
t_output = String -> PortName
PortName ""
}