Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Shorten generated ADT names

  • Loading branch information...
commit a4455ed047c277f823a9df9671f4ebd958faaa2d 1 parent 5172288
@christiaanb authored
View
2  clash/CLasH/Translator.hs
@@ -110,7 +110,7 @@ runTranslatorSession session = do
-- a unique supply anywhere.
uniqSupply <- UniqSupply.mkSplitUniqSupply 'z'
let init_typedecls = map (mktydecl . (Maybe.fromMaybe (error "Translator.runTranslatorSession: No builtin type found")) . snd) $ Map.toList builtin_types
- let init_typestate = TypeState builtin_types init_typedecls Map.empty Map.empty
+ let init_typestate = TypeState builtin_types init_typedecls Map.empty Map.empty 0
let init_state = TranslatorState uniqSupply init_typestate Map.empty Map.empty 0 Map.empty Map.empty Map.empty 0 Map.empty Map.empty
return $ State.evalState session init_state
View
3  clash/CLasH/Translator/TranslatorTypes.hs
@@ -81,8 +81,9 @@ data TypeState = TypeState {
tsTypeDecls_ :: [Maybe AST.PackageDecItem],
-- | A map of vector Core type -> VHDL type function
tsTypeFuns_ :: TypeFunMap,
- tsTfpInts_ :: TfpIntMap
+ tsTfpInts_ :: TfpIntMap,
-- tsHscEnv_ :: HscTypes.HscEnv
+ tsTypeCnt_ :: Integer
}
-- Derive accessors
View
3  clash/CLasH/VHDL/VHDLTools.hs
@@ -486,7 +486,8 @@ mkTyconTy htype =
let reclabelss = map (map mkVHDLBasicId) labelss
let elemss = zipWith (zipWith AST.ElementDec) reclabelss elem_tyss
let elem_names = concatMap (concatMap prettyShow) elem_tyss
- let ty_id = mkVHDLExtId $ name ++ elem_names
+ tyCnt <- MonadState.getAndModify tsTypeCnt (+1)
+ let ty_id = mkVHDLExtId $ name ++ "_" ++ (show tyCnt)-- elem_names
-- Find out if we need to add an extra field at the start of
-- the record type containing the constructor (only needed
-- when there's more than one constructor).
Please sign in to comment.
Something went wrong with that request. Please try again.