matthijs/master-project/cλash.git
13 years agoReally revert all of the recent rotating changes. master
Matthijs Kooijman [Thu, 24 Jun 2010 12:02:25 +0000 (14:02 +0200)]
Really revert all of the recent rotating changes.

Some minor structural and comment changes were left, no functional
changes, though.

13 years agoAlways rotate alternatives of case-statements. Original bug was caused by reverse...
christiaanb [Thu, 24 Jun 2010 09:34:01 +0000 (11:34 +0200)]
Always rotate alternatives of case-statements. Original bug was caused by reverse order of true and false vhdl literals

13 years agoDon't rotate alternatives when there is no default case and there are no binders
christiaanb [Wed, 23 Jun 2010 16:11:00 +0000 (18:11 +0200)]
Don't rotate alternatives when there is no default case and there are no binders

13 years agoAggregate types containing only stateelements is itself state. Not too sure though...
christiaanb [Wed, 23 Jun 2010 10:08:33 +0000 (12:08 +0200)]
Aggregate types containing only stateelements is itself state. Not too sure though, so leave existing comments, and only comment out the original error message.

13 years agoNumber of bits for an Index is the Ceiling of the log2 of its upperbound, not the...
christiaanb [Wed, 23 Jun 2010 10:07:34 +0000 (12:07 +0200)]
Number of bits for an Index is the Ceiling of the log2 of its upperbound, not the Floor

13 years agorotate alternatives of a case-statement if there is a default case
christiaanb [Wed, 23 Jun 2010 10:05:35 +0000 (12:05 +0200)]
rotate alternatives of a case-statement if there is a default case

13 years agoAs identifiers are z-encoded instead of extended they are no longer case sensitive...
christiaanb [Wed, 23 Jun 2010 10:03:57 +0000 (12:03 +0200)]
As identifiers are z-encoded instead of extended they are no longer case sensitive; so make identifiers "more" unique

13 years agoshow function id should just be a basic identifier
christiaanb [Wed, 23 Jun 2010 10:02:12 +0000 (12:02 +0200)]
show function id should just be a basic identifier

13 years agoZ-encode invalid names instead of using extended identifiers. External tools recogniz...
christiaanb [Wed, 23 Jun 2010 09:55:38 +0000 (11:55 +0200)]
Z-encode invalid names instead of using extended identifiers. External tools recognize \ as escape-character

13 years agoAdd parenthesis to output of show function to mimic haskell's show function
christiaanb [Tue, 22 Jun 2010 12:01:03 +0000 (14:01 +0200)]
Add parenthesis to output of show function to mimic haskell's show function

13 years agoAdd comment to DEFAULT alternative simplification
christiaanb [Tue, 22 Jun 2010 09:40:37 +0000 (11:40 +0200)]
Add comment to DEFAULT alternative simplification

13 years agoAlso simplify expressions of the DEFAULT alternative of case expressions
christiaanb [Tue, 22 Jun 2010 09:36:28 +0000 (11:36 +0200)]
Also simplify expressions of the DEFAULT alternative of case expressions

13 years agoEnum literals are now correctly translated to numbers
christiaanb [Mon, 21 Jun 2010 15:07:15 +0000 (17:07 +0200)]
Enum literals are now correctly translated to numbers

13 years agoAdd derivelift function to hardwaretypes
christiaanb [Mon, 21 Jun 2010 14:45:59 +0000 (16:45 +0200)]
Add derivelift function to hardwaretypes

13 years agoPrint null character instead of empty character when adt has no fields
christiaanb [Mon, 21 Jun 2010 12:55:22 +0000 (14:55 +0200)]
Print null character instead of empty character when adt has no fields

13 years agoUse numbers in case-selectors to reflect changes to encoding of enum types
christiaanb [Mon, 21 Jun 2010 12:53:59 +0000 (14:53 +0200)]
Use numbers in case-selectors to reflect changes to encoding of enum types

13 years agoClash depends on newer vhdl package that can print integer typedefs
christiaanb [Mon, 21 Jun 2010 11:36:39 +0000 (13:36 +0200)]
Clash depends on newer vhdl package that can print integer typedefs

13 years agoadtShow now calls vhdl show function to show the constructor
christiaanb [Mon, 21 Jun 2010 11:33:51 +0000 (13:33 +0200)]
adtShow now calls vhdl show function to show the constructor

13 years agoEnum are now integer typedefs instead of unsigned subtypedefs
christiaanb [Mon, 21 Jun 2010 11:32:58 +0000 (13:32 +0200)]
Enum are now integer typedefs instead of unsigned subtypedefs

13 years agoNumbers are now encoded using a descending index
christiaanb [Mon, 21 Jun 2010 09:29:05 +0000 (11:29 +0200)]
Numbers are now encoded using a descending index

13 years agoAdd show generation function for ADTs
christiaanb [Mon, 21 Jun 2010 09:28:37 +0000 (11:28 +0200)]
Add show generation function for ADTs

13 years agoEncode enumerations as unsigned integers instead of vhdls enum type
christiaanb [Mon, 21 Jun 2010 09:27:51 +0000 (11:27 +0200)]
Encode enumerations as unsigned integers instead of vhdls enum type

13 years agoAdd shiftL and shiftR operators for signed and unsigned. Update name of shiftl and...
christiaanb [Thu, 17 Jun 2010 21:14:07 +0000 (23:14 +0200)]
Add shiftL and shiftR operators for signed and unsigned. Update name of shiftl and shiftr in Vector type to shiftIntoL and shiftIntoR

13 years agoAdd higherordercpu and matrix multiplication examples
christiaanb [Thu, 17 Jun 2010 15:00:10 +0000 (17:00 +0200)]
Add higherordercpu and matrix multiplication examples

13 years agoFix sectioning bug of fold, iterate and friends
christiaanb [Thu, 17 Jun 2010 14:46:36 +0000 (16:46 +0200)]
Fix sectioning bug of fold, iterate and friends

13 years agomap fst works again after latest fixes to clash
christiaanb [Thu, 17 Jun 2010 14:19:46 +0000 (16:19 +0200)]
map fst works again after latest fixes to clash

13 years agogetFieldLabels has better error messages
christiaanb [Thu, 17 Jun 2010 14:19:12 +0000 (16:19 +0200)]
getFieldLabels has better error messages

13 years agogenApplication get an explicit destination type
christiaanb [Thu, 17 Jun 2010 14:18:26 +0000 (16:18 +0200)]
genApplication get an explicit destination type

13 years agoBuiltin builder arguments now get an extra Type.Type
christiaanb [Thu, 17 Jun 2010 14:17:00 +0000 (16:17 +0200)]
Builtin builder arguments now get an extra Type.Type

13 years agoImplement API change of shiftl and shiftr, limit Prelude import of HardwareTypes
christiaanb [Thu, 17 Jun 2010 08:30:57 +0000 (10:30 +0200)]
Implement API change of shiftl and shiftr, limit Prelude import of HardwareTypes

13 years agoFix vhdl type generation of index type, as upper bound is now exclusive
christiaanb [Thu, 17 Jun 2010 08:26:44 +0000 (10:26 +0200)]
Fix vhdl type generation of index type, as upper bound is now exclusive

13 years agoGive the index type an exclusive upper-bound, and fix related types accordingly
christiaanb [Wed, 16 Jun 2010 14:49:34 +0000 (16:49 +0200)]
Give the index type an exclusive upper-bound, and fix related types accordingly

13 years agoAdd a CaseAlt constructor to CoreContext.
Matthijs Kooijman [Wed, 16 Jun 2010 13:37:19 +0000 (15:37 +0200)]
Add a CaseAlt constructor to CoreContext.

Since a case expression can introduce a binder (for its scrutinee), we
should be able to denote that in the CoreContext.

13 years agoStore which binders become in scope in the CoreContext.
Matthijs Kooijman [Wed, 16 Jun 2010 13:34:14 +0000 (15:34 +0200)]
Store which binders become in scope in the CoreContext.

This allows us to determine what variables are local in a more reliable
way and allows distinguishing arguments from other local variables.

13 years agoUse the CoreContext predicate functions.
Matthijs Kooijman [Wed, 16 Jun 2010 13:15:49 +0000 (15:15 +0200)]
Use the CoreContext predicate functions.

Previously, comparisons were made to the constructors directly, which
will break when arguments are added to the CoreContext constructors.

13 years agoAdd predicate functions for the CoreContext type.
Matthijs Kooijman [Wed, 16 Jun 2010 13:15:33 +0000 (15:15 +0200)]
Add predicate functions for the CoreContext type.

13 years agoLet genApplication handle (built-in) enumeration types.
Matthijs Kooijman [Wed, 16 Jun 2010 11:28:47 +0000 (13:28 +0200)]
Let genApplication handle (built-in) enumeration types.

Since datacons are no longer seen as local variables, genApplication
sees simple datacons without arguments (e.g., x = True). Now it knows
how to handle these.

13 years agoRestructure genApplication to handle all AggrTypes.
Matthijs Kooijman [Wed, 16 Jun 2010 11:27:14 +0000 (13:27 +0200)]
Restructure genApplication to handle all AggrTypes.

Previously, some cases of AggrType (resulting from recently added extra
ADT support) were not properly handled.

13 years agoDon't treat datacon id's as local variables.
Matthijs Kooijman [Wed, 16 Jun 2010 10:47:44 +0000 (12:47 +0200)]
Don't treat datacon id's as local variables.

This ensures that datacon id's get simplified like they should.
Previously, this wasn't really needed, since a datacon id would become a
constant that could be used in conditional assignments directly. Now,
however, there might be more complex ADT's (like the Maybe type), where
one of the constructors is without arguments (e.g., Nothing), but
assigning the enumeration value directly won't work (it should go into
the constructor field).

13 years agoAdd getConstructorFieldLabel accessor function.
Matthijs Kooijman [Wed, 16 Jun 2010 10:39:58 +0000 (12:39 +0200)]
Add getConstructorFieldLabel accessor function.

13 years agoAdd datacons_for function to get the datacons for a TypedThing.
Matthijs Kooijman [Wed, 16 Jun 2010 10:37:20 +0000 (12:37 +0200)]
Add datacons_for function to get the datacons for a TypedThing.

13 years agoCorrectly treat errors as a nested list in mkTyConHType.
Matthijs Kooijman [Wed, 16 Jun 2010 09:19:49 +0000 (11:19 +0200)]
Correctly treat errors as a nested list in mkTyConHType.

This prevents no errors (list of empty lists) to be treated as an error
condition (since the list is not empty).

13 years agoDon't mix up the i and dc_i variables.
Matthijs Kooijman [Wed, 16 Jun 2010 09:18:15 +0000 (11:18 +0200)]
Don't mix up the i and dc_i variables.

13 years agoAdd support for multiple-constructor datatypes with fields.
Matthijs Kooijman [Wed, 9 Jun 2010 20:30:13 +0000 (22:30 +0200)]
Add support for multiple-constructor datatypes with fields.

This is the naïve implementation that will not try to use the same
storage space for fields from different constructors, so it might
quickly become inefficient with bigger datatypes. For simple types like
the Maybe type, this should be fine.

The support is not quite working yet, for some reason these new types
are not marked as representable. This is cause because the type
substitution in mkTyConHType does not work for some reason, so the field
type of the Just constructor in (for example) a Maybe Bool type stays
"a" instead of "Bool".

13 years agoAdd stringToVHDLExpr function.
Matthijs Kooijman [Wed, 9 Jun 2010 20:29:23 +0000 (22:29 +0200)]
Add stringToVHDLExpr function.

13 years agoAdd datacon_index function to find a datacon in a type.
Matthijs Kooijman [Wed, 9 Jun 2010 20:28:34 +0000 (22:28 +0200)]
Add datacon_index function to find a datacon in a type.

13 years agoMake casesimpl support multiple-alt cases with fields.
Matthijs Kooijman [Wed, 9 Jun 2010 20:27:58 +0000 (22:27 +0200)]
Make casesimpl support multiple-alt cases with fields.

13 years agoMerge branch 'master' of git://github.com/christiaanb/clash
Matthijs Kooijman [Tue, 8 Jun 2010 13:48:06 +0000 (15:48 +0200)]
Merge branch 'master' of git://github.com/christiaanb/clash

* 'master' of git://github.com/christiaanb/clash:
  Do not be overzealous with inlining results of polymorphic functions
  Do not function extract functions that still have free type variables
  Add setup file
  Fix cabal file to reflect temp bug fixes
  Temporarily disable "inlinenonrepresult" transformation, and apply eta-expansion transformation to all expressions
  Rename cλash dir to clash so it behaves well within the ghc build tree
  update cabal file to upload to hackage
  Remove defunct makeVHDLStrings function, messes with haddock
  Update reducer to use new integer types
  Reflect moving TFVec and TFP Integers into clash in sourcefiles related to builtin types
  Update package dependencies
  Move TFVec and TFP integers (Signed, Unsiged and Index) into clash

13 years agoDo not be overzealous with inlining results of polymorphic functions
christiaanb [Tue, 8 Jun 2010 13:45:14 +0000 (15:45 +0200)]
Do not be overzealous with inlining results of polymorphic functions

13 years agoDo not function extract functions that still have free type variables
christiaanb [Tue, 8 Jun 2010 13:43:39 +0000 (15:43 +0200)]
Do not function extract functions that still have free type variables

13 years agoAdd setup file
christiaanb [Mon, 7 Jun 2010 20:41:14 +0000 (22:41 +0200)]
Add setup file

13 years agoFix cabal file to reflect temp bug fixes
christiaanb [Mon, 7 Jun 2010 20:37:42 +0000 (22:37 +0200)]
Fix cabal file to reflect temp bug fixes

13 years agoTemporarily disable "inlinenonrepresult" transformation, and apply eta-expansion...
christiaanb [Mon, 7 Jun 2010 20:36:13 +0000 (22:36 +0200)]
Temporarily disable "inlinenonrepresult" transformation, and apply eta-expansion transformation to all expressions

13 years agoRename cλash dir to clash so it behaves well within the ghc build tree
christiaanb [Wed, 2 Jun 2010 08:03:58 +0000 (10:03 +0200)]
Rename cλash dir to clash so it behaves well within the ghc build tree

13 years agoupdate cabal file to upload to hackage
christiaanb [Tue, 1 Jun 2010 15:02:51 +0000 (17:02 +0200)]
update cabal file to upload to hackage

13 years agoRemove defunct makeVHDLStrings function, messes with haddock
christiaanb [Tue, 1 Jun 2010 15:01:49 +0000 (17:01 +0200)]
Remove defunct makeVHDLStrings function, messes with haddock

13 years agoUpdate reducer to use new integer types
christiaanb [Tue, 1 Jun 2010 14:21:30 +0000 (16:21 +0200)]
Update reducer to use new integer types

13 years agoReflect moving TFVec and TFP Integers into clash in sourcefiles related to builtin...
christiaanb [Tue, 1 Jun 2010 14:20:33 +0000 (16:20 +0200)]
Reflect moving TFVec and TFP Integers into clash in sourcefiles related to builtin types

13 years agoUpdate package dependencies
christiaanb [Tue, 1 Jun 2010 14:19:04 +0000 (16:19 +0200)]
Update package dependencies

13 years agoMove TFVec and TFP integers (Signed, Unsiged and Index) into clash
christiaanb [Tue, 1 Jun 2010 14:16:00 +0000 (16:16 +0200)]
Move TFVec and TFP integers (Signed, Unsiged and Index) into clash

13 years agoAlso simplify top level binder scrutinees.
Matthijs Kooijman [Wed, 26 May 2010 18:05:20 +0000 (20:05 +0200)]
Also simplify top level binder scrutinees.

Previously, if the scrutinee was a variable reference, it would not be
simplified, skipping top level binders as scrutinees. Now only local
variable references are skipped.

13 years agoAdd a new "section" for type-class transformations.
Matthijs Kooijman [Wed, 26 May 2010 15:27:06 +0000 (17:27 +0200)]
Add a new "section" for type-class transformations.

13 years agoImprove listBindings output.
Matthijs Kooijman [Tue, 25 May 2010 19:30:50 +0000 (21:30 +0200)]
Improve listBindings output.

13 years agoReorder transformations to match my thesis.
Matthijs Kooijman [Tue, 18 May 2010 09:59:33 +0000 (11:59 +0200)]
Reorder transformations to match my thesis.

Also add or correct some comments.

13 years agoMove a part of β-reduction to application propagation.
Matthijs Kooijman [Tue, 18 May 2010 08:16:07 +0000 (10:16 +0200)]
Move a part of β-reduction to application propagation.

14 years agoMake debug output controllable with a top-level "constant".
Matthijs Kooijman [Wed, 14 Apr 2010 13:19:02 +0000 (15:19 +0200)]
Make debug output controllable with a top-level "constant".

14 years agoAdd traceIf function for conditional tracing.
Matthijs Kooijman [Wed, 14 Apr 2010 13:16:42 +0000 (15:16 +0200)]
Add traceIf function for conditional tracing.

14 years agoMove the application of "everywhere" to dotransforms.
Matthijs Kooijman [Tue, 13 Apr 2010 15:26:58 +0000 (17:26 +0200)]
Move the application of "everywhere" to dotransforms.

Since every transformation is now applied "everywhere", we don't need to
specify this for every transform. This allows us to change the
application order in the future.

14 years agoRemove some commented out code.
Matthijs Kooijman [Tue, 13 Apr 2010 15:10:41 +0000 (17:10 +0200)]
Remove some commented out code.

14 years agos/normalise/normalize/
Matthijs Kooijman [Tue, 13 Apr 2010 14:56:19 +0000 (16:56 +0200)]
s/normalise/normalize/

14 years agoDon't inline non representable results with free type variables.
Matthijs Kooijman [Tue, 13 Apr 2010 14:48:35 +0000 (16:48 +0200)]
Don't inline non representable results with free type variables.

argprop should ensure that these variables get removed eventually
anyway.

14 years agoImprove error message in mkSelCase.
Matthijs Kooijman [Tue, 13 Apr 2010 14:48:24 +0000 (16:48 +0200)]
Improve error message in mkSelCase.

14 years agoReplace fst with a lambda in a map.
Matthijs Kooijman [Tue, 13 Apr 2010 14:47:36 +0000 (16:47 +0200)]
Replace fst with a lambda in a map.

Cλash doesn't like mapping the fst builtin yet, so avoid that for now.

14 years agoForbid inlinenonrepresult to inline dictionaries.
Matthijs Kooijman [Tue, 13 Apr 2010 14:09:47 +0000 (16:09 +0200)]
Forbid inlinenonrepresult to inline dictionaries.

14 years agoRemove two debug traces.
Matthijs Kooijman [Tue, 13 Apr 2010 14:09:36 +0000 (16:09 +0200)]
Remove two debug traces.

14 years agoRewrite fromInteger and literal generation.
Matthijs Kooijman [Tue, 13 Apr 2010 12:40:17 +0000 (14:40 +0200)]
Rewrite fromInteger and literal generation.

Literals are less of a hack now and should work more reliably.

14 years agoNo longer treat tfp ints as builtin types.
Matthijs Kooijman [Tue, 13 Apr 2010 12:39:17 +0000 (14:39 +0200)]
No longer treat tfp ints as builtin types.

This makes tfp ints non-representable, breaking their use as literal
arguments to fromIntegerT for now.

14 years agoAdd genCoreArgs wrapper to VHDL.Generate.
Matthijs Kooijman [Tue, 13 Apr 2010 12:38:23 +0000 (14:38 +0200)]
Add genCoreArgs wrapper to VHDL.Generate.

14 years agoMove tfp_to_int from VHDLTools to CoreTools.
Matthijs Kooijman [Tue, 13 Apr 2010 12:33:28 +0000 (14:33 +0200)]
Move tfp_to_int from VHDLTools to CoreTools.

14 years agoAdd getFullString function to get a qualified name.
Matthijs Kooijman [Tue, 13 Apr 2010 11:41:40 +0000 (13:41 +0200)]
Add getFullString function to get a qualified name.

14 years agoAdd non-representable result inlining transformation.
Matthijs Kooijman [Wed, 7 Apr 2010 13:12:03 +0000 (15:12 +0200)]
Add non-representable result inlining transformation.

14 years agoAdd case of known constructor simplification.
Matthijs Kooijman [Wed, 7 Apr 2010 13:08:35 +0000 (15:08 +0200)]
Add case of known constructor simplification.

14 years agoAllow normalized functions to have a non-representable result.
Matthijs Kooijman [Wed, 7 Apr 2010 12:45:11 +0000 (14:45 +0200)]
Allow normalized functions to have a non-representable result.

An extra boolean argument to getNormalized / isNormalizeable switches
this behaviour when needed (which is never currently).

This commit also removes the unused isNormalizeable'.

14 years agoAdd allM and anyM functions.
Matthijs Kooijman [Wed, 7 Apr 2010 12:15:22 +0000 (14:15 +0200)]
Add allM and anyM functions.

14 years agoSplit off selector case creation code into CoreTools.
Matthijs Kooijman [Tue, 6 Apr 2010 17:47:01 +0000 (19:47 +0200)]
Split off selector case creation code into CoreTools.

14 years agoMake top level inlining handle non-representable results gracefully.
Matthijs Kooijman [Tue, 6 Apr 2010 17:44:57 +0000 (19:44 +0200)]
Make top level inlining handle non-representable results gracefully.

Since it does not know (nor care) if the function result is
representable, it now uses splitNormalizedNonRep and checks if the
result is a Var afterwards.

14 years agoFix typo in error message.
Matthijs Kooijman [Tue, 6 Apr 2010 17:17:49 +0000 (19:17 +0200)]
Fix typo in error message.

14 years agoAdd variant of splitNormalized for non-representable expressions.
Matthijs Kooijman [Tue, 6 Apr 2010 15:11:45 +0000 (17:11 +0200)]
Add variant of splitNormalized for non-representable expressions.

14 years agoSwitch order of clauses in retvalsimpl to match thesis.
Matthijs Kooijman [Tue, 6 Apr 2010 14:50:39 +0000 (16:50 +0200)]
Switch order of clauses in retvalsimpl to match thesis.

14 years agoUpdate comment for return value simplification.
Matthijs Kooijman [Tue, 6 Apr 2010 14:45:17 +0000 (16:45 +0200)]
Update comment for return value simplification.

14 years agoFix let binding inlining in some cases.
Matthijs Kooijman [Tue, 6 Apr 2010 14:22:04 +0000 (16:22 +0200)]
Fix let binding inlining in some cases.

Let binding inlining was not working properly when an to-be-inlined
binding used another to-be-inlined binding and they were inlined in the
wrong order (the result would be a reference to a no longer existing
binding).

14 years agoTurn letderecursification into let recursification again.
Matthijs Kooijman [Wed, 31 Mar 2010 15:21:27 +0000 (17:21 +0200)]
Turn letderecursification into let recursification again.

Since we can't completely derecursify everything, just make our lives
easy by making everything recursive.

14 years agoRevert "Make inlinebind work for non-recursive lets."
Matthijs Kooijman [Wed, 31 Mar 2010 15:20:20 +0000 (17:20 +0200)]
Revert "Make inlinebind work for non-recursive lets."

This reverts commit 077fe523188b85aff82569232acecfc9dbb082cb.

Conflicts:

cλash/CLasH/Normalize/NormalizeTools.hs

14 years agoSlightly move the "after normalization" debug output.
Matthijs Kooijman [Wed, 31 Mar 2010 14:44:47 +0000 (16:44 +0200)]
Slightly move the "after normalization" debug output.

This should ensure it is always printed. Previously, it seems it was printed
only when the final state from the monad was accessed, not when the
value was used (which caused problems if the value caused an error
further on).

14 years agoCompilefix debug output.
Matthijs Kooijman [Wed, 31 Mar 2010 14:33:28 +0000 (16:33 +0200)]
Compilefix debug output.

14 years agoUpdate reducer to latest design (that runs at 159 MHz)
christiaanb [Wed, 31 Mar 2010 13:07:28 +0000 (15:07 +0200)]
Update reducer to latest design (that runs at 159 MHz)

14 years agoAdd time dependency to cabal package
christiaanb [Wed, 31 Mar 2010 13:02:51 +0000 (15:02 +0200)]
Add time dependency to cabal package

14 years agoShow number of transformations per function.
Matthijs Kooijman [Wed, 31 Mar 2010 12:22:29 +0000 (14:22 +0200)]
Show number of transformations per function.

14 years agoKeep (and show) a count of applied transformations.
Matthijs Kooijman [Wed, 31 Mar 2010 12:17:37 +0000 (14:17 +0200)]
Keep (and show) a count of applied transformations.

14 years agoMerge lambdasimpl, letsimpl and simplres into retvalsimpl transformation.
Matthijs Kooijman [Wed, 31 Mar 2010 12:15:50 +0000 (14:15 +0200)]
Merge lambdasimpl, letsimpl and simplres into retvalsimpl transformation.

This makes these transformations like described in my thesis.