Using FosSyDe to translate haskell to VHDL.

Dear all, I have used ForSyDe to translate a Haskell script to VHDL for a while, and I have one problem by applying where-clause during the translation. I wrote a small function Plus2.hs which is implied as following addTwof :: ProcFun (Int32 -> Int32) addTwof = $(newProcFun [d|addTwof :: Int32 -> Int32 addTwof n = addOnef+1 where addOnef = n +1 |]) *Plus2> writeVHDL plus2SysDef *** Exception: VHDL Compilation Error: Untranslatable function: where constructs are not supported in functions: where addOnef_0 = n_1 GHC.Num.+ 1 in process function `addTwof' (created in Plus2) used by process `plus2Proc' belonging to system definition `plus2' (created in <unkown>) The compiling process was fine, but the script could not be translated into VHDL, like the error i mentioned above. Is there any way to solve this problem if a where-clause is a must. Thanks all. Hanyi _________________________________________________________________ Live Search视频搜索,快速检索视频的利器! http://www.live.com/?scope=video

Hi Hany,
*Plus2> writeVHDL plus2SysDef *** Exception: VHDL Compilation Error: Untranslatable function: where constructs are not supported in functions: where addOnef_0 = n_1 GHC.Num.+ 1 in process function `addTwof' (created in Plus2) used by process `plus2Proc' belonging to system definition `plus2' (created in <unkown>) I don't know much about ForSyDe, but it seems that where clauses simply aren't supported. Perhaps let expressions are?
The would mean something like the following: addTwof :: ProcFun (Int32 -> Int32) addTwof = $(newProcFun [d|addTwof :: Int32 -> Int32 let addOnef = n +1 in addTwof n = addOnef+1 |]) (Not sure if this is completely valid code, I'm not too familiar with TH..). Gr. Matthijs

Hey Matthijs Thanks for replying, and that might help. I will try with it to see if it works, and I am still looking for the answer myself. If there is anyone has worked with the Haskell to VHDL translater, plz let me know cause I have many to discuss. Thanks Hanyi
Date: Tue, 10 Mar 2009 20:23:57 +0100 From: matthijs@stdin.nl To: wanghanyi21@hotmail.com CC: haskell-cafe@haskell.org Subject: Re: [Haskell-cafe] Using FosSyDe to translate haskell to VHDL.
Hi Hany,
*Plus2> writeVHDL plus2SysDef *** Exception: VHDL Compilation Error: Untranslatable function: where constructs are not supported in functions: where addOnef_0 = n_1 GHC.Num.+ 1 in process function `addTwof' (created in Plus2) used by process `plus2Proc' belonging to system definition `plus2' (created in <unkown>) I don't know much about ForSyDe, but it seems that where clauses simply aren't supported. Perhaps let expressions are?
The would mean something like the following:
addTwof :: ProcFun (Int32 -> Int32) addTwof = $(newProcFun [d|addTwof :: Int32 -> Int32 let addOnef = n +1 in addTwof n = addOnef+1 |])
(Not sure if this is completely valid code, I'm not too familiar with TH..).
Gr.
Matthijs
_________________________________________________________________ MSN安全保护中心,免费修复系统漏洞,保护MSN安全! http://im.live.cn/safe/
participants (2)
-
Matthijs Kooijman
-
wanghanyi