Order the extracted bindings from a case expression properly.
Since the case value can use any of the binders bound by the pattern, the
bindings resulting from the pattern should come before the binding from
the value.
Christiaan Baaij [Fri, 14 Aug 2009 14:35:05 +0000 (16:35 +0200)]
Merge branch 'cλash' of http://git.stderr.nl/matthijs/projects/master-project
* 'cλash' of http://git.stderr.nl/matthijs/projects/master-project:
Add lambdasimpl normalization pass.
Make letremoveunused work for non-recursive lets.
Let casesimpl generate non-recursive lets.
Add mkNonRecLets and use it.
Make letmerge work with non-recursive lets.
Limit flattenLets to non-recursive lets only.
Move flattenLets from Normalize to CoreTools.
Make inlinebind work for non-recursive lets.
Add empty let removal normalization pass.
Rename letremove to letremovesimple.
Don't try to simplify nested lets.
Make letflat work with non-recursive lets.
Make letsimpl work on and generate a non-recursive let.
No longer add a top level let before normalization.
Make some normalizations generate nonrecursive lets.
Turn let recursification into its opposite.
This pass puts the value of a lambda in a let binding, to make a lambda
always evaluate to either a let or a simple variable reference. This was
previously not needed, since there used to be a let always (even an empty
one), but this is no longer the case.
This function creates a bunch nested non-recursive lets. It is similar to
MkCore.mkCoreLets, but works only for non-recursive lets, which makes it a
bit more elegant in usage.
flattenLets is currently used for splitNormalized only, which should be
non-recursive lets only. To use it in other places to filter lets, we
should only flatten non-recursive lets, so we can create new non-recursive
lets afterwards.
Make letsimpl work on and generate a non-recursive let.
Previously, letsimpl would work on a recursive let only, and add a new
binding to that recursive let. Now, it works on any let and produces a new
non-recursive let.
No longer add a top level let before normalization.
This was previously required to ensure there was always a let on top
level. However, since we are using nonrecursive lets now and use a
splitNormalized instead of hard matching a Let constructor, there is no
need for an (empty) let at the top anymore.
Merge branch 'master' of git://github.com/christiaanb/clash into cλash
* 'master' of git://github.com/christiaanb/clash:
Hopefully generate completely unique varNames now (also for comp_ins labels)
Generate more unique variable names, generate truely unique entity names
Add boolean or and and, tuple fst and snd function.
Added equals builtin. And fixed show function generation for integers
Class Num is re-exported by CLasH.HardwareTypes, so no need to use the one in Prelude
Instead of making all lets recursive, it now makes all lets nonrecursive,
wherever possible. This breaks normalization, since most other passes work
with recursive lets exclusively.
Previously, any cast that involves a state variable, would be classified
as state (un)packing. Now, only do this if the cast actually changes a
variable from (packed) state to non state (e.g., unpacked state).
Christiaan Baaij [Thu, 13 Aug 2009 15:20:33 +0000 (17:20 +0200)]
Merge branch 'cλash' of http://git.stderr.nl/matthijs/projects/master-project
* 'cλash' of http://git.stderr.nl/matthijs/projects/master-project:
Don't generate a state proc for an empty state.
Make splitNormalized work for non-recursive lets.
Add and use splitNormalized helper function.
This function puts the matching of a normalized expression in a single
place instead of spread out over multiple places. This prevents some code
duplication and allows for better error reporting.
This makes the output port in an Entity of the Maybe Port type, so we can
leave out the output port (for example when its type is empty). This makes
the code a bit more robus in the face of empty types.
Merge branch 'master' of git://github.com/christiaanb/clash into cλash
* 'master' of git://github.com/christiaanb/clash:
Add the type-alias Vector for TFVec to HardwareTypes, and don't export TFVec.TFVec anymore
Add the module hardware types, that exports all builtin types.
Add new modules to cabal file
The VHDL type generating functions can now return "Nothing" to mean that an
empty type would be generated. There are still some spots (builtin
functions mostly) that should handle this more gracefully, but it works
for now. Only single-constructor zero-argument algebraic types generate
the empty type currently, e.g. ().
Previously, there were three different functions for the top entity,
initial state and test input. Now, there is just a single one, which
guarantees that these things are properly linked together. This should no
also support generating multiple entities at the same time (though there
is no top level interface for this yet).
This change also makes the testbench generation optional. A bunch of
functions were moved from Utils to GhcTools, to prevent a dependency loop.
This moves some stuff from NormalizeTools and NormalizeTypes into the
(new) BinderTools and TranslatorTypes. This also puts most of these
function in the TranslatorSession instead of the TransformMonad.
Previously, first all function would be (recursively) normalized, and then
VHDL would be generated. Now, functions are normalized when needed, and
recursion is done while generating VHDL (so we know exactly which
components we are instantiating).
This disables the testbench and TFVec constructor for now, I'll fix that
in the next commits.
This also moves some code around, to prevent loops between Generate and
VHDL (again...).
The VHDLSession and NormalizeSession have been removed, and replaced with
the (previously unused) TranslatorSession. There are a few backward
compatibility aliases in place, so the next commit will probably remove
these and do a bunch of trivial replaces all over the code.
Merge branch 'master' of git://github.com/christiaanb/clash into cλash
* 'master' of git://github.com/christiaanb/clash:
TFVec builtin should now completely work
Clean up imports in Generate.hs
Use createDirectoryIfMissing to create the vhdl directory, as it can create the parent directories too
Reflect API changes of clash in clash-nolibdir
Bring back listBind(ings) in Utils.hs by reorganising Translator.hs and GhcTools.hs
Fix a few comments so Haddock will complete
Further clean up Translator.hs (almost done now)
Cleanup Translator.hs
Fail again when we find a global function
Partially fixed TFVec builtin function. Still needs to be verified