Merge branch 'cλash' of http://git.stderr.nl/matthijs/projects/master-project
* 'cλash' of http://git.stderr.nl/matthijs/projects/master-project:
Generate proper VHDL for top level bindings with no arguments.
Use is_local_var for limiting appsimpl and letsimpl.
Add newline at the end of file.
Add is_local_var predicate.
Santize comment dashes position.
Normalize all used global binders.
Generate proper VHDL for top level bindings with no arguments.
Previously, a = b bindings would always generate an unconditional
assignment. Now, they use genApplication to generate VHDL, and
genApplications knows how to generate unconditional assignments when b is
a local identifier, and a component instantiation when b is a top level
binder.
Use is_local_var for limiting appsimpl and letsimpl.
Previously, appsimple and letsimpl would refrain from simplifying any Var
expression, since they are already simple. Now, they only refrain from
simplifying local variables, so references to top-level bindings will
still be simplified. This enables proper normalization of top level
bindings without arguments.
This allows us to comment some lines in and out without having to remember
the exact position of the comment dashes (to prevent unneeded changes in
git).
Merge branch 'cλash' of http://git.stderr.nl/matthijs/projects/master-project
* 'cλash' of http://git.stderr.nl/matthijs/projects/master-project:
Let inlinefun inline everything non-representable.
Unify typeprop and funprop into argprop.
Extract only representable arguments.
Add predicates for testing representability of types.
Let inlinefun inline everything non-representable.
This changes its name to inlinenonrep and makes it inline everything that
is not representable (which helps in particular for dictionary
construction expressions...).
I've not yet changed the conditions in various other transforms, so if
something silly would happen like having a dictionary as the value or
scrutinee of a case of let expression, things might go into an infinite
loop.
Also, since HTypes are generated very often now, things are really
starting to slow down...
Previously, anything but types and functions was extracted. This
definition is slightly more general, but it should not matter for the
programs we work with.
Make vhdl_ty and friends return errors with Either.
Previously, error messages were passed forward. However, this does not
allow a type lookup to gracefully fail, which will be needed for
normalization soon. Now, error messages are returned using an Either
value, so they can be ignored at top level if needed.
Previously, dataconstructor arguments that had no arguments themselves
(eg. False, or High), would be extracted from an argument list, even
though they were just simple variable references. Since such a datacon can
be translated to a VHDL literal and VHDL supports mapping expressions (at
least constant expressions) to a port, there is no need for extraction
anymore.
* git://github.com/darchon/clash:
We now output VHDL types in the correct order
Removed the need for a special vector-type map.
Added builtin functions: concat, reverse, iterate, iteraten, generate and generaten
Christiaan Baaij [Mon, 29 Jun 2009 13:06:34 +0000 (15:06 +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:
Make genMap support mapping applications.
Allow arguments to builtins to be applications.
* git://github.com/darchon/clash:
Added unzip
Added "zip" function
Added <+ and ++ operations
Added support for instances of tfp integer, but poorly...
Added select builtin
Parameterized fold, so that it can be used for foldl and foldr
This is a companion commit to the previous one, to handle the changes in
normal form introduced there. This only works for map so far, the other
higher order functions will be changed later.
This allows things like "map (hwand Low) as" or even "map (hwand x) as" in
normal form. Previously, the "hwand Low" part would be put into its own
function, but that could only work when mapping expression without free
variables.
Christiaan Baaij [Fri, 26 Jun 2009 12:28:34 +0000 (14:28 +0200)]
Added support for instances of tfp integer, but poorly...
They are always used as 'structural' parameters for functions
and as such should not be turned in to ports when these
arguments are applied.
Christiaan Baaij [Fri, 26 Jun 2009 11:09:19 +0000 (13:09 +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:
Let exprToVar give a useful error message.
Use tcSplitSigmaTy for getting at value arguments.
Add is_simple predicate for applications and vars.
Add function-typed argument extraction transform.
Add has_free_vars predicate.
Remove TODO that was already solved.
Disabled foldr generation again, it should either be updated to the
shorter form from my last commits, but preferably foldl should be
abstracted to handle both.
In particular:
* The globalNameTable was moved into Generate.
* A large part of mkConcSm was moved into Generate.
* A BuiltinBuilder now accepts Either CoreBndr VHDLName and
[Either CoreExpr AST.Expr], so we can reuse them even when we no longer
have a CoreBndrs (this does not happen yet, though).
Christiaan Baaij [Thu, 25 Jun 2009 09:16:27 +0000 (11:16 +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:
Unify all BuiltinBuilder functions.
Give HighOrdAlu an and operation.
Let tfvec_len and tfvec_elem give a proper error message.
No longer use a view pattern in HsTools.
By create a few wrapper functions, we can still leave the functions mostly
unchanged, but register them all with the same interface in the
GlobalNameTable.
Christiaan Baaij [Wed, 24 Jun 2009 10:35:50 +0000 (12: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:
Put the Builders in the VHDLSession.
Remove the globalNameTable from the VHDLState.
Swap the VHDLState and VHDLSession type names.
The globalNameTable is never modified, so it can just be referenced
directly. Additionally, having it in the VHDLSession prevents us from
putting the Builder type in the VHDLSession Monad.
Christiaan Baaij [Tue, 23 Jun 2009 14:22:58 +0000 (16:22 +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 a hardware module for a generalized Alu.
Make mkConcSm support a = b style bindings.
Make appsimpl also simplify dataconstructors.
Make subeverywhere support NonRec Lets.
These were previously left alone, since they were considered already
simple (they're simple variable references). However, a dataconstructor
can be translated to a VHDL expression, which can be assigned to a signal,
but not used in the port map of an component instantiation.
Also prevent letremovetop from inlining the datacon again.
Christiaan Baaij [Tue, 23 Jun 2009 13:39:25 +0000 (15:39 +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:
Support turning dataconstructors into VHDL constants.
Use varToVHDLExpr in mkConcSm.
Christiaan Baaij [Tue, 23 Jun 2009 13:10:21 +0000 (15:10 +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:
Ignore cast expressions when generating VHDL.
Add Cast propagation transform.
Make subeverywhere support Cast expressions.
Remove a double line introduced a few commits back.
Make subeverywhere complain for unknown expressions.