Do not apply eta expansion to application arguments.
Doing this can introduce expressions such as:
map (\x -> foo x) xs
which is of course not really what we want. By limiting eta expansion in
this way, we'll still get it where we really want it: At the top level.
Christiaan Baaij [Tue, 23 Jun 2009 11:38:35 +0000 (13:38 +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:
Always add a clk port map on instantiations.
Delete all old .vhdl files before writing new ones.
Prepend "comp_ins_" to component instantiation labels.
Remove dummy mkConcSm clause for r = r bindings.
Return multiple statements instead of a block.
Let mkConcSm return a list of ConcSms.
Christiaan Baaij [Tue, 23 Jun 2009 10:24:25 +0000 (12:24 +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 signal for the output port.
Perform subsititutions one after another.
Previously, multiple substitutions would be done in a single run of
substExpr, but that did not properly handle the case where one of the
to-be-substituted values appears in the to-be-substituted values. For
example, when performing the substitution [(a, b), (b, c)] on the
expression a, we would get b (while we want to get c).
Christiaan Baaij [Mon, 22 Jun 2009 13:17:07 +0000 (15:17 +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:
Append the Unique to generated VHDL entity id's.
Generate the VHDLId of an entity in a single place.
Remove the old builtin function support.
Add error message to mkConcSm for unsupported expressions.
Fix definition of hwor builtin operator.
Generate the VHDLId of an entity in a single place.
Additionally, make the SignatureMap indexed by CoreBndr instead of String.
This was previously not possible, because the builtin function also needed
to be in the signature map. This is no longer the case.
Christiaan Baaij [Mon, 22 Jun 2009 11:39:00 +0000 (13: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:
Check parameter counts in mkConcSm instead of the actual generate functions.
Make the hw functions builtin operators instead of components.
Fix typo.
Christiaan Baaij [Mon, 22 Jun 2009 10:22:31 +0000 (12:22 +0200)]
Added subtype declarations to TypeMap, removed SubtypeMap.
Merge branch 'cλash' of http://git.stderr.nl/matthijs/projects/master-project
* 'cλash' of http://git.stderr.nl/matthijs/projects/master-project: (32 commits)
Support application of dataconstructors.
Make mkAssign support assigning to a VHDLName as well.
Split off record field selection AST construction.
Only try to generate builtin functions for global binders.
Never try to normalize global binders.
Split off assignment generating code.
Support single-alt selector case expressions.
Add pprString convenience method.
Support single-constructor algebraic types.
Move type registration out of construct_vhdl_ty.
Split off the VHDL type generating code.
Actually use the introduced let from a few commits back...
Error out when normalizing polymorphic functions.
Add an empty let before starting normalization.
Add and use a mkFunction utility function.
Make beta reduction of Case expressions work for type arguments.
Add function propagation transform.
Improve debug output timing.
Don't propagate types with free tyvars.
Add is_applicable predicate.
...
Only try to generate builtin functions for global binders.
Since builtin functions will always come from elsewhere, these will
always be global. Functions for which we can generate components, on the
other hand, will always be local.
Previously, there was some duplicate AST building code for assignments in
mkConcSm. This is not split of into mkAssign, mkUncondAssign and
mkCondAssign.
construct_vhdl_ty now only creates the type and does not register it in
the session. Additionally, we save only the TypeDef in the session instead
of the TypeDec, since the latter contains the VHDLId which we also store
separately. This means we'll create the TypeDecs later, when outputint the
types VHDL package.
Previously, the vhdl_ty function did builtin type lookups, cached custom
types and creating new custom types. Now, the latter is moved into the new
function create_vhdl_ty.
This ensures that every expression will always contain a let at the top
level, since none of the transforms will remove the last let (lets are
only merged when two are nested).
This function creates a new function with a given body and adds it to the
TransformMonad state. The function is named after an existing binder, but
with a new Unique.
Make beta reduction of Case expressions work for type arguments.
Previously, splitFunTy was used, which assumes a function type, while a
type argument is applied to a forall type instead of a function type.
Using applyTypeToArg handles all this for us.
Any free type variables in a type argument wouldn't be in scope in the new
function. Eventually, beta reducation and applicable inlining should make
sure that all type variables are resolved.
This transform propagates type arguments passed to functions into (a copy
of) the called function, effectively removing all type arguments. This is
the first cross-function transformation pass.
This allows for functions to use other (user-defined) functions, which
will then also get VHDL generated. Also restructures some code to make
this possible. In particular, the TranslatorState is now no longer used
(but not yet removed).
Christiaan Baaij [Fri, 19 Jun 2009 11:25:24 +0000 (13:25 +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 another higher order testcase, highordtest2.
Support VHDL generation for two-alternative cases.
Support VHDL generation for two-alternative cases.
This does not support single alternatives statements yet, and will never
support more than two alternatives. Only supports case statements on Bit
and Bool types for now.
Christiaan Baaij [Fri, 19 Jun 2009 10:17:44 +0000 (12:17 +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:
Use highordtest in main, since that can now be normalized.
Add a (fairly complete) set of transforms.
Add is_lam and is_fun predicates.
Add a inlinebind helper function.
Add a substitute helper function.
Print the type in the transform debug output.
Add infrastructure for running core to core transformations.
Add a higher order testcase.
Add is_wild function to check for wild binders.
Generate VHDL from Core instead of flat functions.
Generate VHDL from Core instead of flat functions.
This bypasses all of the Flatten functionality for now and generates VHDL
directly. The generation only works on very simple Core programs, that are
already in normal form. An example of such a program is the inv function
in Adders.hs.
For now, all state generation is broken again. Support for ValueMaps has
mostly been removed, since in the future tuples will be translated to
records in VHDL instead of being flattened.