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
Limit flattenLets to non-recursive lets only.
[matthijs/master-project/cλash.git]
/
cλash
/
CLasH
/
VHDL
/
Testbench.hs
diff --git
a/cλash/CLasH/VHDL/Testbench.hs
b/cλash/CLasH/VHDL/Testbench.hs
index 4f20f6cf9c90470aa92b1dafd1167b56fb2eba5d..84f550aaf7da15fcaef1cd9cc7a508845a9eecc3 100644
(file)
--- a/
cλash/CLasH/VHDL/Testbench.hs
+++ b/
cλash/CLasH/VHDL/Testbench.hs
@@
-1,3
+1,4
@@
+--
-- Functions to create a VHDL testbench from a list of test input.
--
module CLasH.VHDL.Testbench where
-- Functions to create a VHDL testbench from a list of test input.
--
module CLasH.VHDL.Testbench where
@@
-81,7
+82,7
@@
createTestbenchArch mCycles stimuli top testent= do
let finalIDecs = iDecs ++
[AST.SigDec clockId std_logicTM (Just $ AST.PrimLit "'0'"),
AST.SigDec resetId std_logicTM (Just $ AST.PrimLit "'0'")]
let finalIDecs = iDecs ++
[AST.SigDec clockId std_logicTM (Just $ AST.PrimLit "'0'"),
AST.SigDec resetId std_logicTM (Just $ AST.PrimLit "'0'")]
-
portmaps <-
mkAssocElems (map idToVHDLExpr iIds) (AST.NSimple oId) signature
+
let portmaps =
mkAssocElems (map idToVHDLExpr iIds) (AST.NSimple oId) signature
let mIns = mkComponentInst "totest" entId portmaps
(stimuliAssigns, stimuliDecs, cycles, used) <- createStimuliAssigns mCycles stimuli (head iIds)
let finalAssigns = (AST.CSSASm (AST.NSimple resetId AST.:<==:
let mIns = mkComponentInst "totest" entId portmaps
(stimuliAssigns, stimuliDecs, cycles, used) <- createStimuliAssigns mCycles stimuli (head iIds)
let finalAssigns = (AST.CSSASm (AST.NSimple resetId AST.:<==:
@@
-128,7
+129,10
@@
createStimulans ::
createStimulans expr cycl = do
-- There must be a let at top level
createStimulans expr cycl = do
-- There must be a let at top level
- (CoreSyn.Let (CoreSyn.Rec binds) (Var res)) <- normalizeExpr ("test input #" ++ show cycl) expr
+ expr <- normalizeExpr ("test input #" ++ show cycl) expr
+ -- Split the normalized expression. It can't have a function type, so match
+ -- an empty list of argument binders
+ let ([], binds, res) = splitNormalized expr
(stimulansbindss, useds) <- unzipM $ Monad.mapM mkConcSm binds
sig_dec_maybes <- mapM (mkSigDec . fst) (filter ((/=res).fst) binds)
let sig_decs = map (AST.BDISD) (Maybe.catMaybes $ sig_dec_maybes)
(stimulansbindss, useds) <- unzipM $ Monad.mapM mkConcSm binds
sig_dec_maybes <- mapM (mkSigDec . fst) (filter ((/=res).fst) binds)
let sig_decs = map (AST.BDISD) (Maybe.catMaybes $ sig_dec_maybes)