projects
/
matthijs
/
master-project
/
cλash.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Extract entities from the session and return them in the design file.
[matthijs/master-project/cλash.git]
/
FlattenTypes.hs
diff --git
a/FlattenTypes.hs
b/FlattenTypes.hs
index 49ca8c04533cbeab1616846c7ff1e5c1da2ac1bb..7838dcdcbc28563fa7f77d54063e21183b9a3cd6 100644
(file)
--- a/
FlattenTypes.hs
+++ b/
FlattenTypes.hs
@@
-75,8
+75,8
@@
data CondDef sigid = CondDef {
} deriving (Show, Eq)
-- | Information on a signal definition
} deriving (Show, Eq)
-- | Information on a signal definition
-data Signal
sigid = Signal
{
- id :: sigid
+data Signal
Info = SignalInfo
{
+ name :: Maybe String
} deriving (Eq, Show)
-- | A flattened function
} deriving (Eq, Show)
-- | A flattened function
@@
-85,7
+85,7
@@
data FlatFunction' sigid = FlatFunction {
res :: SignalMap sigid,
apps :: [FApp sigid],
conds :: [CondDef sigid],
res :: SignalMap sigid,
apps :: [FApp sigid],
conds :: [CondDef sigid],
- sigs :: [
Signal sigid
]
+ sigs :: [
(sigid, SignalInfo)
]
} deriving (Show, Eq)
-- | A flat function that does not have its signals named
} deriving (Show, Eq)
-- | A flat function that does not have its signals named
@@
-104,24
+104,25
@@
type BindMap = [(
)]
-- | The state during the flattening of a single function
)]
-- | The state during the flattening of a single function
-type FlattenState = State.State ([FApp UnnamedSignal], [CondDef UnnamedSignal], UnnamedSignal)
+type FlattenState = State.State ([FApp UnnamedSignal], [CondDef UnnamedSignal],
[(UnnamedSignal, SignalInfo)],
UnnamedSignal)
-- | Add an application to the current FlattenState
addApp :: (FApp UnnamedSignal) -> FlattenState ()
addApp a = do
-- | Add an application to the current FlattenState
addApp :: (FApp UnnamedSignal) -> FlattenState ()
addApp a = do
- (apps, conds, n) <- State.get
- State.put (a:apps, conds, n)
+ (apps, conds,
sigs,
n) <- State.get
+ State.put (a:apps, conds,
sigs,
n)
-- | Add a conditional definition to the current FlattenState
addCondDef :: (CondDef UnnamedSignal) -> FlattenState ()
addCondDef c = do
-- | Add a conditional definition to the current FlattenState
addCondDef :: (CondDef UnnamedSignal) -> FlattenState ()
addCondDef c = do
- (apps, conds, n) <- State.get
- State.put (apps, c:conds, n)
+ (apps, conds,
sigs,
n) <- State.get
+ State.put (apps, c:conds,
sigs,
n)
-- | Generates a new signal id, which is unique within the current flattening.
genSignalId :: FlattenState UnnamedSignal
genSignalId = do
-- | Generates a new signal id, which is unique within the current flattening.
genSignalId :: FlattenState UnnamedSignal
genSignalId = do
- (apps, conds, n) <- State.get
- State.put (apps, conds, n+1)
+ (apps, conds, sigs, n) <- State.get
+ -- Generate a new numbered but unnamed signal
+ let s = (n, SignalInfo Nothing)
+ State.put (apps, conds, s:sigs, n+1)
return n
return n
-