matthijs/master-project/cλash.git
15 years agoMerge branch 'cλash' of http://git.stderr.nl/matthijs/projects/master-project
Christiaan Baaij [Thu, 25 Jun 2009 09:16:27 +0000 (11:16 +0200)]
Merge branch 'cλash' of 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.

Conflicts:
Generate.hs

15 years agoUnify all BuiltinBuilder functions.
Matthijs Kooijman [Thu, 25 Jun 2009 09:12:07 +0000 (11:12 +0200)]
Unify all BuiltinBuilder functions.

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.

15 years agoGive HighOrdAlu an and operation.
Matthijs Kooijman [Thu, 25 Jun 2009 09:11:10 +0000 (11:11 +0200)]
Give HighOrdAlu an and operation.

15 years agoLet tfvec_len and tfvec_elem give a proper error message.
Matthijs Kooijman [Thu, 25 Jun 2009 08:40:40 +0000 (10:40 +0200)]
Let tfvec_len and tfvec_elem give a proper error message.

15 years agoCleaned up genFoldlCall.
Christiaan Baaij [Thu, 25 Jun 2009 08:05:40 +0000 (10:05 +0200)]
Cleaned up genFoldlCall.

mkComponentInst now always maps the 'clk' port. You should never map it yourself again

15 years agoNo longer use a view pattern in HsTools.
Matthijs Kooijman [Wed, 24 Jun 2009 15:38:52 +0000 (17:38 +0200)]
No longer use a view pattern in HsTools.

This prevents GHC from giving an unwarranted warning, due to view pattern
support being incomplete.

15 years agoAdded builtin foldl function
Christiaan Baaij [Wed, 24 Jun 2009 14:52:19 +0000 (16:52 +0200)]
Added builtin foldl function

Also use mkVhdlBasicId for length attributes. Attributes can not have slashes

15 years agoAdded zipwithid
Christiaan Baaij [Wed, 24 Jun 2009 11:37:56 +0000 (13:37 +0200)]
Added zipwithid

15 years agoMerge branch 'cλash' of http://git.stderr.nl/matthijs/projects/master-project
Christiaan Baaij [Wed, 24 Jun 2009 11:29:50 +0000 (13:29 +0200)]
Merge branch 'cλash' of git.stderr.nl/matthijs/projects/master-project

* 'cλash' of http://git.stderr.nl/matthijs/projects/master-project:
  Generate vector functions on demand.

Conflicts:
Generate.hs
GlobalNameTable.hs

15 years agoGenerate vector functions on demand.
Matthijs Kooijman [Wed, 24 Jun 2009 11:21:45 +0000 (13:21 +0200)]
Generate vector functions on demand.

Previously, vector functions were generated all at the same time when the
corresponding vector type was generated.

15 years agoPulled genZipWithCall into VHDLSession monad
Christiaan Baaij [Wed, 24 Jun 2009 11:10:41 +0000 (13:10 +0200)]
Pulled genZipWithCall into VHDLSession monad

15 years agoMerge branch 'cλash' of http://git.stderr.nl/matthijs/projects/master-project
Christiaan Baaij [Wed, 24 Jun 2009 10:35:50 +0000 (12:35 +0200)]
Merge branch 'cλash' of 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.

15 years agoAdded builtin zipwith function
Christiaan Baaij [Wed, 24 Jun 2009 10:19:30 +0000 (12:19 +0200)]
Added builtin zipwith function

15 years agoPut the Builders in the VHDLSession.
Matthijs Kooijman [Wed, 24 Jun 2009 10:08:05 +0000 (12:08 +0200)]
Put the Builders in the VHDLSession.

15 years agoRemove the globalNameTable from the VHDLState.
Matthijs Kooijman [Wed, 24 Jun 2009 10:03:38 +0000 (12:03 +0200)]
Remove the globalNameTable from the VHDLState.

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.

15 years agoBuiltin function 'empty' now returns a constant empty vector
Christiaan Baaij [Wed, 24 Jun 2009 09:41:40 +0000 (11:41 +0200)]
Builtin function 'empty' now returns a constant empty vector

15 years agoSwap the VHDLState and VHDLSession type names.
Matthijs Kooijman [Wed, 24 Jun 2009 09:40:12 +0000 (11:40 +0200)]
Swap the VHDLState and VHDLSession type names.

This is more consistent with the TransformSession/State and allows for
stacking monad transformers on top of the VHDLState later on.

15 years agoClean up the code a bit more.
Matthijs Kooijman [Wed, 24 Jun 2009 09:30:57 +0000 (11:30 +0200)]
Clean up the code a bit more.

This removes some unused parts, makes some naming a bit more consistent
and moves some code around.

Additionally, this disables vector function generating for now, since that
would create a dependency loop. Next up is changing the structure of that.

15 years agoAlways use everything declared in VHDL work library
Christiaan Baaij [Tue, 23 Jun 2009 20:55:53 +0000 (22:55 +0200)]
Always use everything declared in VHDL work library

15 years agoStarted cleanup of VHDL.hs and some builtin funcs now expect CoreBndrs instead of...
Christiaan Baaij [Tue, 23 Jun 2009 20:35:41 +0000 (22:35 +0200)]
Started cleanup of VHDL.hs and some builtin funcs now expect CoreBndrs instead of VHDLIds

VHDL.hs now only deals with functions that use the VHDLState Monad
All the other (helper) functions are now moved to VHDLTools.hs

Commented functions in VHDL.hs that relied on Flatfunctions. They
are ready for either removal, or should be updated to use Core
types.

15 years agoMerge branch 'cλash' of http://git.stderr.nl/matthijs/projects/master-project
Christiaan Baaij [Tue, 23 Jun 2009 14:22:58 +0000 (16:22 +0200)]
Merge branch 'cλash' of 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.

15 years agoAdd a hardware module for a generalized Alu.
Matthijs Kooijman [Tue, 23 Jun 2009 14:17:23 +0000 (16:17 +0200)]
Add a hardware module for a generalized Alu.

15 years agoMake mkConcSm support a = b style bindings.
Matthijs Kooijman [Tue, 23 Jun 2009 14:14:47 +0000 (16:14 +0200)]
Make mkConcSm support a = b style bindings.

This is meant to provide support for assigning a dataconstructor to a
signal (though it will also work for other signals).

15 years agoMake appsimpl also simplify dataconstructors.
Matthijs Kooijman [Tue, 23 Jun 2009 14:12:50 +0000 (16:12 +0200)]
Make appsimpl also simplify dataconstructors.

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.

15 years agoAdded builtin copy function
Christiaan Baaij [Tue, 23 Jun 2009 13:55:00 +0000 (15:55 +0200)]
Added builtin copy function

15 years agoMake subeverywhere support NonRec Lets.
Matthijs Kooijman [Tue, 23 Jun 2009 13:45:02 +0000 (15:45 +0200)]
Make subeverywhere support NonRec Lets.

15 years agoMerge branch 'cλash' of http://git.stderr.nl/matthijs/projects/master-project
Christiaan Baaij [Tue, 23 Jun 2009 13:39:25 +0000 (15:39 +0200)]
Merge branch 'cλash' of 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.

15 years agoMap generations always maps clk port
Christiaan Baaij [Tue, 23 Jun 2009 13:37:51 +0000 (15:37 +0200)]
Map generations always maps clk port

gen function is butt ugly, needs to be fixed

15 years agoMerge git://github.com/darchon/clash into cλash
Matthijs Kooijman [Tue, 23 Jun 2009 13:17:12 +0000 (15:17 +0200)]
Merge git://github.com/darchon/clash into cλash

* git://github.com/darchon/clash:
  Added singleton
  Almost finished support for 'map'

Conflicts:
VHDL.hs

15 years agoSupport turning dataconstructors into VHDL constants.
Matthijs Kooijman [Tue, 23 Jun 2009 13:13:20 +0000 (15:13 +0200)]
Support turning dataconstructors into VHDL constants.

15 years agoMerge branch 'cλash' of http://git.stderr.nl/matthijs/projects/master-project
Christiaan Baaij [Tue, 23 Jun 2009 13:10:21 +0000 (15:10 +0200)]
Merge branch 'cλash' of 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.

15 years agoAdded singleton
Christiaan Baaij [Tue, 23 Jun 2009 13:10:05 +0000 (15:10 +0200)]
Added singleton

15 years agoUse varToVHDLExpr in mkConcSm.
Matthijs Kooijman [Tue, 23 Jun 2009 13:07:12 +0000 (15:07 +0200)]
Use varToVHDLExpr in mkConcSm.

Previously, this used some custom set of functions. Using varToVHDLExpr
allows us to support constants for datacons later on.

15 years agoMerge git://github.com/darchon/clash into cλash
Matthijs Kooijman [Tue, 23 Jun 2009 12:54:54 +0000 (14:54 +0200)]
Merge git://github.com/darchon/clash into cλash

* git://github.com/darchon/clash:
  Added builtin function 'empty'

15 years agoIgnore cast expressions when generating VHDL.
Matthijs Kooijman [Tue, 23 Jun 2009 12:54:24 +0000 (14:54 +0200)]
Ignore cast expressions when generating VHDL.

15 years agoAdd Cast propagation transform.
Matthijs Kooijman [Tue, 23 Jun 2009 12:49:08 +0000 (14:49 +0200)]
Add Cast propagation transform.

This transform tries to push Casts down into the expression as much as
possible.

15 years agoMake subeverywhere support Cast expressions.
Matthijs Kooijman [Tue, 23 Jun 2009 12:41:30 +0000 (14:41 +0200)]
Make subeverywhere support Cast expressions.

15 years agoRemove a double line introduced a few commits back.
Matthijs Kooijman [Tue, 23 Jun 2009 12:36:28 +0000 (14:36 +0200)]
Remove a double line introduced a few commits back.

This line created some kind of infinite loop.

15 years agoMake subeverywhere complain for unknown expressions.
Matthijs Kooijman [Tue, 23 Jun 2009 12:27:48 +0000 (14:27 +0200)]
Make subeverywhere complain for unknown expressions.

Previously, subeverywhere would silently leave it unmodified.

15 years agoMerge branch 'cλash' of http://git.stderr.nl/matthijs/projects/master-project
Christiaan Baaij [Tue, 23 Jun 2009 12:27:47 +0000 (14:27 +0200)]
Merge branch 'cλash' of git.stderr.nl/matthijs/projects/master-project

* 'cλash' of http://git.stderr.nl/matthijs/projects/master-project:
  Do not apply eta expansion to application arguments.

15 years agoAlmost finished support for 'map'
Christiaan Baaij [Tue, 23 Jun 2009 12:27:08 +0000 (14:27 +0200)]
Almost finished support for 'map'

Currently it only supports vectors of lenght 4

15 years agoDo not apply eta expansion to application arguments.
Matthijs Kooijman [Tue, 23 Jun 2009 12:24:26 +0000 (14:24 +0200)]
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.

15 years agoAdded builtin function 'empty'
Christiaan Baaij [Tue, 23 Jun 2009 11:45:22 +0000 (13:45 +0200)]
Added builtin function 'empty'

15 years agoMerge branch 'cλash' of http://git.stderr.nl/matthijs/projects/master-project
Christiaan Baaij [Tue, 23 Jun 2009 11:38:35 +0000 (13:38 +0200)]
Merge branch 'cλash' of 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.

15 years agoAdded +> function, started on map
Christiaan Baaij [Tue, 23 Jun 2009 11:38:13 +0000 (13:38 +0200)]
Added +> function, started on map

15 years agoMerge git://github.com/darchon/clash into cλash
Matthijs Kooijman [Tue, 23 Jun 2009 10:54:29 +0000 (12:54 +0200)]
Merge git://github.com/darchon/clash into cλash

* git://github.com/darchon/clash:
  Added support for empty TFVec's, Added Some more builtin functions

15 years agoAlways add a clk port map on instantiations.
Matthijs Kooijman [Tue, 23 Jun 2009 10:53:47 +0000 (12:53 +0200)]
Always add a clk port map on instantiations.

This changes make the translator generate synthesizable VHDL again.

15 years agoDelete all old .vhdl files before writing new ones.
Matthijs Kooijman [Tue, 23 Jun 2009 10:47:46 +0000 (12:47 +0200)]
Delete all old .vhdl files before writing new ones.

15 years agoMerge branch 'cλash' of http://git.stderr.nl/matthijs/projects/master-project
Christiaan Baaij [Tue, 23 Jun 2009 10:24:25 +0000 (12:24 +0200)]
Merge branch 'cλash' of 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.

15 years agoAdded support for empty TFVec's, Added Some more builtin functions
Christiaan Baaij [Tue, 23 Jun 2009 10:23:34 +0000 (12:23 +0200)]
Added support for empty TFVec's, Added Some more builtin functions

15 years agoPrepend "comp_ins_" to component instantiation labels.
Matthijs Kooijman [Tue, 23 Jun 2009 10:11:10 +0000 (12:11 +0200)]
Prepend "comp_ins_" to component instantiation labels.

This should ensure that these labels are fairly unique (no guarantees yet,
though).

15 years agoRemove dummy mkConcSm clause for r = r bindings.
Matthijs Kooijman [Tue, 23 Jun 2009 10:09:22 +0000 (12:09 +0200)]
Remove dummy mkConcSm clause for r = r bindings.

These bindings are generated by GHC, but are now removed by normalization
as they are not part of the normal form.

15 years agoReturn multiple statements instead of a block.
Matthijs Kooijman [Tue, 23 Jun 2009 10:08:08 +0000 (12:08 +0200)]
Return multiple statements instead of a block.

The AST had some troubles outputting a block statement with no ports, so
we'll just drop the block now that mkConcSm can return multiple
statements.

15 years agoLet mkConcSm return a list of ConcSms.
Matthijs Kooijman [Tue, 23 Jun 2009 10:06:08 +0000 (12:06 +0200)]
Let mkConcSm return a list of ConcSms.

This will allow a single binding result in multiple concurrent
statements (or none), without resorting to a block statement.

15 years agoDon't generate a signal for the output port.
Matthijs Kooijman [Tue, 23 Jun 2009 09:49:57 +0000 (11:49 +0200)]
Don't generate a signal for the output port.

15 years agoPerform subsititutions one after another.
Matthijs Kooijman [Tue, 23 Jun 2009 08:37:35 +0000 (10:37 +0200)]
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).

15 years agoUpdated support for RangedWords, Requires new branch of ForSyDe
Christiaan Baaij [Mon, 22 Jun 2009 15:27:14 +0000 (17:27 +0200)]
Updated support for RangedWords, Requires new branch of ForSyDe

15 years agoMerge branch 'cλash' of http://git.stderr.nl/matthijs/projects/master-project
Christiaan Baaij [Mon, 22 Jun 2009 13:17:07 +0000 (15:17 +0200)]
Merge branch 'cλash' of 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.

15 years agoAppend the Unique to generated VHDL entity id's.
Matthijs Kooijman [Mon, 22 Jun 2009 13:16:43 +0000 (15:16 +0200)]
Append the Unique to generated VHDL entity id's.

15 years agoGenerate the VHDLId of an entity in a single place.
Matthijs Kooijman [Mon, 22 Jun 2009 13:14:09 +0000 (15:14 +0200)]
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.

15 years agoRemove the old builtin function support.
Matthijs Kooijman [Mon, 22 Jun 2009 13:13:23 +0000 (15:13 +0200)]
Remove the old builtin function support.

Its now replaced by a new structure, no longer needing external VHDL
files.

15 years agoFilter non-value variables for built-in functions
Christiaan Baaij [Mon, 22 Jun 2009 13:12:06 +0000 (15:12 +0200)]
Filter non-value variables for built-in functions

15 years agoMerge git://github.com/darchon/clash into cλash
Matthijs Kooijman [Mon, 22 Jun 2009 12:26:20 +0000 (14:26 +0200)]
Merge git://github.com/darchon/clash into cλash

15 years agoAdd error message to mkConcSm for unsupported expressions.
Matthijs Kooijman [Mon, 22 Jun 2009 12:23:58 +0000 (14:23 +0200)]
Add error message to mkConcSm for unsupported expressions.

Previously, there was only a cryptic message from ghc, now it also
mentions the unsupported expression.

15 years agoMerge branch 'cλash' of http://git.stderr.nl/matthijs/projects/master-project
Christiaan Baaij [Mon, 22 Jun 2009 11:39:00 +0000 (13:39 +0200)]
Merge branch 'cλash' of 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.

15 years agoAdded support for vectors with arbitrary element types
Christiaan Baaij [Mon, 22 Jun 2009 11:38:28 +0000 (13:38 +0200)]
Added support for vectors with arbitrary element types

15 years agoFix definition of hwor builtin operator.
Matthijs Kooijman [Mon, 22 Jun 2009 11:30:50 +0000 (13:30 +0200)]
Fix definition of hwor builtin operator.

15 years agoCheck parameter counts in mkConcSm instead of the actual generate functions.
Matthijs Kooijman [Mon, 22 Jun 2009 11:06:33 +0000 (13:06 +0200)]
Check parameter counts in mkConcSm instead of the actual generate functions.

15 years agoMake the hw functions builtin operators instead of components.
Matthijs Kooijman [Mon, 22 Jun 2009 10:57:20 +0000 (12:57 +0200)]
Make the hw functions builtin operators instead of components.

15 years agoFix typo.
Matthijs Kooijman [Mon, 22 Jun 2009 10:52:52 +0000 (12:52 +0200)]
Fix typo.

15 years agoAdded subtype declarations to TypeMap, removed SubtypeMap.
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.
  ...

Conflicts:
VHDL.hs

15 years agoSupport application of dataconstructors.
Matthijs Kooijman [Mon, 22 Jun 2009 08:51:08 +0000 (10:51 +0200)]
Support application of dataconstructors.

This allows one to create algebraic datatypes (and thus, tuples).

15 years agoMake mkAssign support assigning to a VHDLName as well.
Matthijs Kooijman [Mon, 22 Jun 2009 08:35:55 +0000 (10:35 +0200)]
Make mkAssign support assigning to a VHDLName as well.

Previously, assignments could only have a CoreBndr as destination.

15 years agoSplit off record field selection AST construction.
Matthijs Kooijman [Mon, 22 Jun 2009 08:28:31 +0000 (10:28 +0200)]
Split off record field selection AST construction.

15 years agoOnly try to generate builtin functions for global binders.
Matthijs Kooijman [Mon, 22 Jun 2009 08:18:17 +0000 (10:18 +0200)]
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.

15 years agoNever try to normalize global binders.
Matthijs Kooijman [Mon, 22 Jun 2009 08:17:29 +0000 (10:17 +0200)]
Never try to normalize global binders.

These should mostly (always?) be functions imported from elsewhere (for
which we won't have a value) or dataconstructors.

15 years agoSplit off assignment generating code.
Matthijs Kooijman [Mon, 22 Jun 2009 07:56:21 +0000 (09:56 +0200)]
Split off assignment generating code.

Previously, there was some duplicate AST building code for assignments in
mkConcSm. This is not split of into mkAssign, mkUncondAssign and
mkCondAssign.

15 years agoMerge branch 'cλash' of http://git.stderr.nl/matthijs/projects/master-project
Christiaan Baaij [Mon, 22 Jun 2009 07:19:40 +0000 (09:19 +0200)]
Merge branch 'cλash' of git.stderr.nl/matthijs/projects/master-project

* 'cλash' of http://git.stderr.nl/matthijs/projects/master-project:
  Recursively normalize binds.

15 years agoSupport single-alt selector case expressions.
Matthijs Kooijman [Sun, 21 Jun 2009 18:44:27 +0000 (20:44 +0200)]
Support single-alt selector case expressions.

15 years agoAdd pprString convenience method.
Matthijs Kooijman [Sun, 21 Jun 2009 18:43:46 +0000 (20:43 +0200)]
Add pprString convenience method.

This method can convert any Outputable to a string.

15 years agoSupport single-constructor algebraic types.
Matthijs Kooijman [Sun, 21 Jun 2009 18:00:48 +0000 (20:00 +0200)]
Support single-constructor algebraic types.

These will generate a VHDL record, with one field for each argument.

15 years agoMove type registration out of construct_vhdl_ty.
Matthijs Kooijman [Sun, 21 Jun 2009 17:56:25 +0000 (19:56 +0200)]
Move type registration out of construct_vhdl_ty.

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.

15 years agoSplit off the VHDL type generating code.
Matthijs Kooijman [Sun, 21 Jun 2009 16:39:20 +0000 (18:39 +0200)]
Split off the VHDL type generating code.

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.

15 years agoActually use the introduced let from a few commits back...
Matthijs Kooijman [Sun, 21 Jun 2009 16:21:20 +0000 (18:21 +0200)]
Actually use the introduced let from a few commits back...

15 years agoError out when normalizing polymorphic functions.
Matthijs Kooijman [Sun, 21 Jun 2009 16:19:08 +0000 (18:19 +0200)]
Error out when normalizing polymorphic functions.

15 years agoAdd an empty let before starting normalization.
Matthijs Kooijman [Sun, 21 Jun 2009 16:09:20 +0000 (18:09 +0200)]
Add an empty let before starting normalization.

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).

15 years agoAdd and use a mkFunction utility function.
Matthijs Kooijman [Sun, 21 Jun 2009 15:59:24 +0000 (17:59 +0200)]
Add and use a mkFunction utility function.

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.

15 years agoMake beta reduction of Case expressions work for type arguments.
Matthijs Kooijman [Sun, 21 Jun 2009 15:47:36 +0000 (17:47 +0200)]
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.

15 years agoAdd function propagation transform.
Matthijs Kooijman [Sun, 21 Jun 2009 15:42:46 +0000 (17:42 +0200)]
Add function propagation transform.

This transform propagates arguments that have a function type into (a copy
of) the function that's applied to them.

15 years agoImprove debug output timing.
Matthijs Kooijman [Sun, 21 Jun 2009 15:25:56 +0000 (17:25 +0200)]
Improve debug output timing.

The Before: line is now really printed before the transform, so also when
the transform fails.

15 years agoDon't propagate types with free tyvars.
Matthijs Kooijman [Sun, 21 Jun 2009 15:24:29 +0000 (17:24 +0200)]
Don't propagate types with free tyvars.

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.

15 years agoAdd is_applicable predicate.
Matthijs Kooijman [Sun, 21 Jun 2009 15:23:13 +0000 (17:23 +0200)]
Add is_applicable predicate.

This predicate should have been committed a few commits before.

15 years agoAdd has_free_tyvars predicate.
Matthijs Kooijman [Sun, 21 Jun 2009 15:22:40 +0000 (17:22 +0200)]
Add has_free_tyvars predicate.

15 years agoFix compile error three commits back.
Matthijs Kooijman [Sun, 21 Jun 2009 15:14:19 +0000 (17:14 +0200)]
Fix compile error three commits back.

15 years agoLet inlinefun also apply polymorphic values.
Matthijs Kooijman [Sun, 21 Jun 2009 15:13:22 +0000 (17:13 +0200)]
Let inlinefun also apply polymorphic values.

This generalizes inline fun to inline anything that still needs to be
applied to something to become a simple value.

15 years agoAdd getGlobalBinders accessor.
Matthijs Kooijman [Sun, 21 Jun 2009 14:49:36 +0000 (16:49 +0200)]
Add getGlobalBinders accessor.

15 years agoAdd functions for creating and referencing type variables.
Matthijs Kooijman [Sun, 21 Jun 2009 14:48:43 +0000 (16:48 +0200)]
Add functions for creating and referencing type variables.

These functions work for both type variables as well as normal variables,
allowing the code that uses them to work with both.

15 years agoMake substitute work for type variables as well.
Matthijs Kooijman [Sun, 21 Jun 2009 14:48:20 +0000 (16:48 +0200)]
Make substitute work for type variables as well.

15 years agoChange the debug output of applyboth a bit.
Matthijs Kooijman [Sun, 21 Jun 2009 14:47:51 +0000 (16:47 +0200)]
Change the debug output of applyboth a bit.

15 years agoAdd is_poly and is_var predicates.
Matthijs Kooijman [Sun, 21 Jun 2009 14:46:05 +0000 (16:46 +0200)]
Add is_poly and is_var predicates.