From 358a33adc0f4328d1908938952d2edef85e75546 Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Thu, 22 Jan 2009 20:32:18 +0100 Subject: [PATCH] Look up the port names in the session when generating an architecture. --- Translator.hs | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/Translator.hs b/Translator.hs index 94f99f8..c96bebc 100644 --- a/Translator.hs +++ b/Translator.hs @@ -205,17 +205,13 @@ getArchitecture sess (NonRec var expr) = -- Use unsafe for now, to prevent pulling in ForSyDe error handling (AST.NSimple (AST.unsafeVHDLBasicId name)) [] - (getInstantiations sess (Args inportnames) outport [] expr) + (getInstantiations sess (Args inports) outport [] expr) where name = (getOccString var) - ty = CoreUtils.exprType expr - (fargs, res) = Type.splitFunTys ty - --state = if length fargs == 1 then () else (last fargs) - ports = if length fargs == 1 then fargs else (init fargs) - inportnames = case ports of - [port] -> [getPortNameMapForTy "portin" port] - ps -> getPortNameMapForTys "portin" 0 ps - outport = getPortNameMapForTy "portout" res + hwfunc = Maybe.fromMaybe + (error $ "Function " ++ name ++ "is unknown? This should not happen!") + (lookup name (funcs sess)) + HWFunction (Args inports) outport = hwfunc data PortNameMap = Args [PortNameMap] -- Each of the submaps represent an argument to the -- 2.30.2