} deriving (Show, Eq)
-- | Information on a signal definition
-data Signal sigid = Signal {
- id :: sigid,
+data SignalInfo = SignalInfo {
name :: Maybe String
} deriving (Eq, Show)
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
)]
-- | The state during the flattening of a single function
-type FlattenState = State.State ([FApp UnnamedSignal], [CondDef UnnamedSignal], [Signal UnnamedSignal], UnnamedSignal)
+type FlattenState = State.State ([FApp UnnamedSignal], [CondDef UnnamedSignal], [(UnnamedSignal, SignalInfo)], UnnamedSignal)
-- | Add an application to the current FlattenState
addApp :: (FApp UnnamedSignal) -> FlattenState ()
genSignalId = do
(apps, conds, sigs, n) <- State.get
-- Generate a new numbered but unnamed signal
- let s = Signal n Nothing
+ let s = (n, SignalInfo Nothing)
State.put (apps, conds, s:sigs, n+1)
return n
instance Pretty id => Pretty (CondDef id) where
pPrint _ = text "TODO"
-instance Pretty id => Pretty (Signal id) where
- pPrint (Signal id Nothing) = pPrint id
- pPrint (Signal id (Just name)) = pPrint id <> text ":" <> text name
+instance Pretty SignalInfo where
+ pPrint (SignalInfo Nothing) = empty
+ pPrint (SignalInfo (Just name)) = text ":" <> text name
instance Pretty VHDLSession where
pPrint (VHDLSession mod nameCount funcs) =
-- Name the signals in all other functions
Just flatfunc ->
let s = sigs flatfunc in
- let s' = map (\(Signal id Nothing) -> Signal id (Just $ "sig_" ++ (show id))) s in
+ let s' = map (\(id, (SignalInfo Nothing)) -> (id, SignalInfo (Just $ "sig_" ++ (show id)))) s in
let flatfunc' = flatfunc { sigs = s' } in
fdata { flatFunc = Just flatfunc' }