matthijs/master-project/cλash.git
14 years agoMultiplications are now resized to mimic the behaviour in Haskell
Christiaan Baaij [Wed, 25 Nov 2009 13:01:31 +0000 (14:01 +0100)]
Multiplications are now resized to mimic the behaviour in Haskell

14 years agoFix haddock generation
Christiaan Baaij [Wed, 11 Nov 2009 16:20:23 +0000 (17:20 +0100)]
Fix haddock generation

14 years agoMerge branch 'cλash' of http://git.stderr.nl/matthijs/projects/master-project
Christiaan Baaij [Wed, 11 Nov 2009 14:52:33 +0000 (15:52 +0100)]
Merge branch 'cλash' of git.stderr.nl/matthijs/projects/master-project

* 'cλash' of http://git.stderr.nl/matthijs/projects/master-project:
  Actually make the scrutinee binder removal not crash.
  Add scrutinee binder removal transformation.

14 years agoClean up source files:
Christiaan Baaij [Wed, 11 Nov 2009 14:49:50 +0000 (15:49 +0100)]
Clean up source files:

- Remove unused imports
- Remove unneeded '$'
- Remove unneeded 'do'
- Remove unneeded 'return'
- Replace 'concat $ map' by 'concatMap'
- Replace 'mapM' by 'mapM_' if return value is not stored
- Replace 'not $ x `elem` xs' by 'x `notElem` xs'

14 years agoActually make the scrutinee binder removal not crash.
Matthijs Kooijman [Wed, 11 Nov 2009 13:38:26 +0000 (14:38 +0100)]
Actually make the scrutinee binder removal not crash.

14 years agoAdd scrutinee binder removal transformation.
Matthijs Kooijman [Wed, 11 Nov 2009 11:12:48 +0000 (12:12 +0100)]
Add scrutinee binder removal transformation.

This code is untested, for I have been unable to produce Haskell code to
which it applies...

14 years agoUse data-accessor-transformers package to remove deprecation warnings
Christiaan Baaij [Tue, 10 Nov 2009 16:42:18 +0000 (17:42 +0100)]
Use data-accessor-transformers package to remove deprecation warnings

14 years agoFixed VHDL Type generation, vhdlTy now uses HType's to generate VHDL Types. Logic...
Christiaan Baaij [Tue, 10 Nov 2009 13:49:47 +0000 (14:49 +0100)]
Fixed VHDL Type generation, vhdlTy now uses HType's to generate VHDL Types. Logic from vhdlTy moved to mkHType

14 years agoStart support on initial state. Substates currently break
Christiaan Baaij [Fri, 6 Nov 2009 12:12:00 +0000 (13:12 +0100)]
Start support on initial state. Substates currently break

14 years agoAdd built-in split function
Christiaan Baaij [Fri, 6 Nov 2009 12:11:22 +0000 (13:11 +0100)]
Add built-in split function

14 years agoUpdate reducer
Christiaan Baaij [Fri, 6 Nov 2009 12:07:21 +0000 (13:07 +0100)]
Update reducer

14 years agoFix error message genNegation for non-SizedWord types
Christiaan Baaij [Mon, 28 Sep 2009 12:13:47 +0000 (14:13 +0200)]
Fix error message genNegation for non-SizedWord types

14 years agoFix bug with generating head and tail functions. Update builtin resize function
Christiaan Baaij [Wed, 23 Sep 2009 12:29:57 +0000 (14:29 +0200)]
Fix bug with generating head and tail functions. Update builtin resize function

14 years agoFail again when we try translate a DEFAULT condition
Christiaan Baaij [Wed, 9 Sep 2009 12:13:29 +0000 (14:13 +0200)]
Fail again when we try translate a DEFAULT condition

14 years agoAdd some comments
Christiaan Baaij [Wed, 9 Sep 2009 11:57:49 +0000 (13:57 +0200)]
Add some comments

14 years agoOmit empty block statements in test bench
Christiaan Baaij [Wed, 9 Sep 2009 11:42:09 +0000 (13:42 +0200)]
Omit empty block statements in test bench

14 years agoAdd support for multiple alts in case statements
Christiaan Baaij [Wed, 9 Sep 2009 10:11:43 +0000 (12:11 +0200)]
Add support for multiple alts in case statements

14 years agoAdd support for enumeration types.
Christiaan Baaij [Wed, 9 Sep 2009 07:27:29 +0000 (09:27 +0200)]
Add support for enumeration types.

The generated VHDL 'show' function is kind of lame, it only prints
the name of the type, not the actual datacon.

14 years agoMerge branch 'cλash' of http://git.stderr.nl/matthijs/projects/master-project
Christiaan Baaij [Tue, 8 Sep 2009 11:31:38 +0000 (13:31 +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 trailing newline to HighOrdAlu.
  Add comments to the inlinetoplevel transformation.
  Update comments for inlinenonrep.
  Fix typo.
  Fix typo.

14 years agoAdd support for fromIntegerT
Christiaan Baaij [Tue, 8 Sep 2009 11:31:18 +0000 (13:31 +0200)]
Add support for fromIntegerT

14 years agoAdd some gt,lt,gteq and lteq boolean operators
Christiaan Baaij [Tue, 8 Sep 2009 11:28:17 +0000 (13:28 +0200)]
Add some gt,lt,gteq and lteq boolean operators

14 years agoAdd a trailing newline to HighOrdAlu.
Matthijs Kooijman [Tue, 1 Sep 2009 19:26:55 +0000 (21:26 +0200)]
Add a trailing newline to HighOrdAlu.

14 years agoAdd comments to the inlinetoplevel transformation.
Matthijs Kooijman [Tue, 1 Sep 2009 19:26:24 +0000 (21:26 +0200)]
Add comments to the inlinetoplevel transformation.

14 years agoUpdate comments for inlinenonrep.
Matthijs Kooijman [Tue, 1 Sep 2009 19:06:55 +0000 (21:06 +0200)]
Update comments for inlinenonrep.

14 years agoFix typo.
Matthijs Kooijman [Tue, 1 Sep 2009 19:02:50 +0000 (21:02 +0200)]
Fix typo.

14 years agoMerge branch 'master' of git://github.com/christiaanb/clash into cλash
Matthijs Kooijman [Tue, 1 Sep 2009 14:39:20 +0000 (16:39 +0200)]
Merge branch 'master' of git://github.com/christiaanb/clash into cλash

* 'master' of git://github.com/christiaanb/clash:
  Use boolean as write enable signal

14 years agoUse boolean as write enable signal
Christiaan Baaij [Sat, 29 Aug 2009 16:11:15 +0000 (18:11 +0200)]
Use boolean as write enable signal

14 years agoFix typo.
Matthijs Kooijman [Fri, 28 Aug 2009 14:08:21 +0000 (16:08 +0200)]
Fix typo.

14 years agoMerge branch 'master' of git://github.com/christiaanb/clash into cλash
Matthijs Kooijman [Fri, 28 Aug 2009 14:07:30 +0000 (16:07 +0200)]
Merge branch 'master' of git://github.com/christiaanb/clash into cλash

* 'master' of git://github.com/christiaanb/clash:
  TFP has updated/remade. Change hardwaretypes accordingly
  Connect resetn port to states.
  Fix the resetn signal in the testbench, it is now correctly '0' for 3 ns, and after that '1'

14 years agoTFP has updated/remade. Change hardwaretypes accordingly
Christiaan Baaij [Thu, 20 Aug 2009 20:03:46 +0000 (22:03 +0200)]
TFP has updated/remade. Change hardwaretypes accordingly

Delete your old git repo of TFP, it doesn't include the darcs history
from the original TFP from Peter Gavin. Then clone the new TFP.

14 years agoConnect resetn port to states.
Christiaan Baaij [Thu, 20 Aug 2009 12:22:09 +0000 (14:22 +0200)]
Connect resetn port to states.

Atleast initial state can now easily be added manual.
Be sure to update to the latest 'vhdl' package as the
old one incorrectly pretty printed the "elsif" keyword

14 years agoFix the resetn signal in the testbench, it is now correctly '0' for 3 ns, and after...
Christiaan Baaij [Thu, 20 Aug 2009 11:56:10 +0000 (13:56 +0200)]
Fix the resetn signal in the testbench, it is now correctly '0' for 3 ns, and after that '1'

14 years agoMerge branch 'cλash' of http://git.stderr.nl/matthijs/projects/master-project
Christiaan Baaij [Thu, 20 Aug 2009 07:15:43 +0000 (09:15 +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 not in isUserDefined.
  Let vhld_ty handle free tyvars gracefully.
  Add ty_has_free_tyvars predicate.
  Split substitute into substitute and substitute_clone.
  Rewrite substitute to clone the substitution range.
  Don't error on type abstraction when cloning binders.
  When inlining top level functions, guarantee uniqueness.
  Make all binders unique before normalizing.
  Add genUniques function to regenerate all uniques.
  Add mapAccumLM helper function.
  Don't try to inline non-normalizeable top level  functions.
  Add andM and orM utility functions.
  Add isNormalizeable predicate.
  Make isRepr work on TypedThings instead of CoreExpr.
  Also inline functions named "fromInteger".
  Don't extra non-representable values in simplres.
  Use isUserDefined for (not) inlining top level functions.
  Add isUserDefined predicate.
  Inline all top level functions that look simple.

14 years agoMerge branch 'master' of git://github.com/christiaanb/clash into cλash
Matthijs Kooijman [Wed, 19 Aug 2009 15:54:38 +0000 (17:54 +0200)]
Merge branch 'master' of git://github.com/christiaanb/clash into cλash

* 'master' of git://github.com/christiaanb/clash:
  Work around some bugs in the current clash to make reducer compile correctly
  Just name the testbench: testbench; don't add the unique
  No longer allow slashes in extended names, they are now stripped
  Used unsigned instead of natural as representation of RangedWord
  Add resetn ports

14 years agoAdd a not in isUserDefined.
Matthijs Kooijman [Wed, 19 Aug 2009 15:34:23 +0000 (17:34 +0200)]
Add a not in isUserDefined.

The meaning of isUserDefined was accidentally reversed.

14 years agoLet vhld_ty handle free tyvars gracefully.
Matthijs Kooijman [Wed, 19 Aug 2009 15:32:11 +0000 (17:32 +0200)]
Let vhld_ty handle free tyvars gracefully.

Previously, free type vars could result in ugly errors from eval_tfp_int
and friends. Now, a type with free type vars is correctly marked as
non-representable.

14 years agoAdd ty_has_free_tyvars predicate.
Matthijs Kooijman [Wed, 19 Aug 2009 15:31:48 +0000 (17:31 +0200)]
Add ty_has_free_tyvars predicate.

14 years agoSplit substitute into substitute and substitute_clone.
Matthijs Kooijman [Wed, 19 Aug 2009 15:14:50 +0000 (17:14 +0200)]
Split substitute into substitute and substitute_clone.

Since cloning is not needed (nor possible) for type substitutions, this
makes things a bit more clear and elegant.

14 years agoRewrite substitute to clone the substitution range.
Matthijs Kooijman [Wed, 19 Aug 2009 14:45:54 +0000 (16:45 +0200)]
Rewrite substitute to clone the substitution range.

This makes substitute no longer use CoreSubst for id substitutions, just
for type substitutions (which we don't have to clone before replacing
them). By cloning the substitution range before every substitution, we
keep the binders in it globally unique.

14 years agoDon't error on type abstraction when cloning binders.
Matthijs Kooijman [Wed, 19 Aug 2009 14:38:35 +0000 (16:38 +0200)]
Don't error on type abstraction when cloning binders.

Since we might encounter type abstractions before normalizations, the old
behaviour broke on polymorphic functions (Though type arguments would have
been propagated, there would still be type abstractions directly applied
to the propagated types).

Note that this not actually clones the type variables, it just leaves them
untouched. Since we should never introduce new type variables, this should
_probably_ work out...

14 years agoWhen inlining top level functions, guarantee uniqueness.
Matthijs Kooijman [Wed, 19 Aug 2009 12:42:58 +0000 (14:42 +0200)]
When inlining top level functions, guarantee uniqueness.

14 years agoMake all binders unique before normalizing.
Matthijs Kooijman [Wed, 19 Aug 2009 12:35:23 +0000 (14:35 +0200)]
Make all binders unique before normalizing.

14 years agoAdd genUniques function to regenerate all uniques.
Matthijs Kooijman [Wed, 19 Aug 2009 12:31:03 +0000 (14:31 +0200)]
Add genUniques function to regenerate all uniques.

This function replaces all uniques within an expression with new ones, to
generate their uniqueness.

14 years agoAdd mapAccumLM helper function.
Matthijs Kooijman [Wed, 19 Aug 2009 12:35:06 +0000 (14:35 +0200)]
Add mapAccumLM helper function.

14 years agoDon't try to inline non-normalizeable top level functions.
Matthijs Kooijman [Wed, 19 Aug 2009 10:32:00 +0000 (12:32 +0200)]
Don't try to inline non-normalizeable top level  functions.

Since we do normalization before inlining, we should only try this with
functions that can be normalized.

14 years agoAdd andM and orM utility functions.
Matthijs Kooijman [Wed, 19 Aug 2009 10:31:48 +0000 (12:31 +0200)]
Add andM and orM utility functions.

14 years agoAdd isNormalizeable predicate.
Matthijs Kooijman [Wed, 19 Aug 2009 10:31:17 +0000 (12:31 +0200)]
Add isNormalizeable predicate.

14 years agoMake isRepr work on TypedThings instead of CoreExpr.
Matthijs Kooijman [Wed, 19 Aug 2009 10:16:43 +0000 (12:16 +0200)]
Make isRepr work on TypedThings instead of CoreExpr.

14 years agoAlso inline functions named "fromInteger".
Matthijs Kooijman [Wed, 19 Aug 2009 09:58:00 +0000 (11:58 +0200)]
Also inline functions named "fromInteger".

14 years agoDon't extra non-representable values in simplres.
Matthijs Kooijman [Wed, 19 Aug 2009 09:56:09 +0000 (11:56 +0200)]
Don't extra non-representable values in simplres.

14 years agoUse isUserDefined for (not) inlining top level functions.
Matthijs Kooijman [Wed, 19 Aug 2009 08:54:18 +0000 (10:54 +0200)]
Use isUserDefined for (not) inlining top level functions.

14 years agoAdd isUserDefined predicate.
Matthijs Kooijman [Wed, 19 Aug 2009 08:53:53 +0000 (10:53 +0200)]
Add isUserDefined predicate.

This predicate makes a guess as to which binders are user defined.

14 years agoWork around some bugs in the current clash to make reducer compile correctly
Christiaan Baaij [Tue, 18 Aug 2009 12:57:43 +0000 (14:57 +0200)]
Work around some bugs in the current clash to make reducer compile correctly

14 years agoJust name the testbench: testbench; don't add the unique
Christiaan Baaij [Tue, 18 Aug 2009 12:55:04 +0000 (14:55 +0200)]
Just name the testbench: testbench; don't add the unique

14 years agoNo longer allow slashes in extended names, they are now stripped
Christiaan Baaij [Tue, 18 Aug 2009 12:54:09 +0000 (14:54 +0200)]
No longer allow slashes in extended names, they are now stripped

14 years agoUsed unsigned instead of natural as representation of RangedWord
Christiaan Baaij [Tue, 18 Aug 2009 11:43:59 +0000 (13:43 +0200)]
Used unsigned instead of natural as representation of RangedWord

14 years agoInline all top level functions that look simple.
Matthijs Kooijman [Tue, 18 Aug 2009 09:57:13 +0000 (11:57 +0200)]
Inline all top level functions that look simple.

This inlines any function whose normalized version just contains a single
definition. This might be a bit too enthusiastic, though it probably helps
a lot.

14 years agoAdd resetn ports
Christiaan Baaij [Mon, 17 Aug 2009 15:31:19 +0000 (17:31 +0200)]
Add resetn ports

14 years agoAdd (temporary) simplres normalization pass.
Matthijs Kooijman [Mon, 17 Aug 2009 14:30:08 +0000 (16:30 +0200)]
Add (temporary) simplres normalization pass.

This pass ensures that trivial top level bindings that only reference
another top level binder still get normalized correctly.

14 years agoAdd top level inliner normalization pass.
Matthijs Kooijman [Mon, 17 Aug 2009 12:29:57 +0000 (14:29 +0200)]
Add top level inliner normalization pass.

This pass does not actually do anything yet, it just provides the plumbing
for inlining later on.

14 years agoMerge branch 'cλash' of http://git.stderr.nl/matthijs/projects/master-project
Christiaan Baaij [Mon, 17 Aug 2009 10:18:11 +0000 (12:18 +0200)]
Merge branch 'cλash' of git.stderr.nl/matthijs/projects/master-project

* 'cλash' of http://git.stderr.nl/matthijs/projects/master-project:
  Make letflat work for nonrec lets in rec lets as well.
  Revert "Limit flattenLets to non-recursive lets only."
  Disable letmerge.
  Make letremoveunused work for recursive lets again.
  Make letflat work for recursive lets again.
  Turn of Normalize debugging again, accidentally committed.

14 years agoMake letflat work for nonrec lets in rec lets as well.
Matthijs Kooijman [Mon, 17 Aug 2009 09:54:01 +0000 (11:54 +0200)]
Make letflat work for nonrec lets in rec lets as well.

14 years agoRevert "Limit flattenLets to non-recursive lets only."
Matthijs Kooijman [Mon, 17 Aug 2009 09:42:37 +0000 (11:42 +0200)]
Revert "Limit flattenLets to non-recursive lets only."

This reverts commit de2b45772572a90429ffe41a86a7ba08e7de6d4b.

14 years agoDisable letmerge.
Matthijs Kooijman [Mon, 17 Aug 2009 09:36:06 +0000 (11:36 +0200)]
Disable letmerge.

When faced with nested recursive and non-recursive lets, letmerge becomes
complicated very quickly, so we might need to rewrite it if it's really
needed. For now, just disable it to prevent it from breaking things.

14 years agoMake letremoveunused work for recursive lets again.
Matthijs Kooijman [Mon, 17 Aug 2009 09:28:20 +0000 (11:28 +0200)]
Make letremoveunused work for recursive lets again.

The non-recursive version is also changed to work for each nested let in
turn, instead of running on a bunch of them at the same time.

14 years agoMake letflat work for recursive lets again.
Matthijs Kooijman [Mon, 17 Aug 2009 09:22:43 +0000 (11:22 +0200)]
Make letflat work for recursive lets again.

14 years agoTurn of Normalize debugging again, accidentally committed.
Matthijs Kooijman [Mon, 17 Aug 2009 07:39:26 +0000 (09:39 +0200)]
Turn of Normalize debugging again, accidentally committed.

This reverst part of commit 93e2a90772f1f599c1abe5ec5403e80dd1719b5c,
"Order the extracted bindings from a case expression properly."

14 years agoMerge branch 'cλash' of http://git.stderr.nl/matthijs/projects/master-project
Christiaan Baaij [Fri, 14 Aug 2009 15:50:26 +0000 (17:50 +0200)]
Merge branch 'cλash' of git.stderr.nl/matthijs/projects/master-project

* 'cλash' of http://git.stderr.nl/matthijs/projects/master-project:
  Order the extracted bindings from a case expression properly.

14 years agoOrder the extracted bindings from a case expression properly.
Matthijs Kooijman [Fri, 14 Aug 2009 15:37:03 +0000 (17:37 +0200)]
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.

14 years agoFix replace function to make Quartus II happy
Christiaan Baaij [Fri, 14 Aug 2009 15:35:46 +0000 (17:35 +0200)]
Fix replace function to make Quartus II happy

14 years agoMerge branch 'cλash' of http://git.stderr.nl/matthijs/projects/master-project
Christiaan Baaij [Fri, 14 Aug 2009 14:35:05 +0000 (16: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:
  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.

14 years agoIgnore casts that just repack state. Don't make VHDL for them, their type is empty
Christiaan Baaij [Fri, 14 Aug 2009 14:34:16 +0000 (16:34 +0200)]
Ignore casts that just repack state. Don't make VHDL for them, their type is empty

14 years agoAdd builtin blockRAM primitive
Christiaan Baaij [Fri, 14 Aug 2009 14:32:54 +0000 (16:32 +0200)]
Add builtin blockRAM primitive

14 years agoAdd lambdasimpl normalization pass.
Matthijs Kooijman [Fri, 14 Aug 2009 14:17:32 +0000 (16:17 +0200)]
Add lambdasimpl normalization pass.

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.

14 years agoMake letremoveunused work for non-recursive lets.
Matthijs Kooijman [Fri, 14 Aug 2009 14:08:08 +0000 (16:08 +0200)]
Make letremoveunused work for non-recursive lets.

14 years agoLet casesimpl generate non-recursive lets.
Matthijs Kooijman [Fri, 14 Aug 2009 13:51:29 +0000 (15:51 +0200)]
Let casesimpl generate non-recursive lets.

14 years agoAdd mkNonRecLets and use it.
Matthijs Kooijman [Fri, 14 Aug 2009 13:47:28 +0000 (15:47 +0200)]
Add mkNonRecLets and use it.

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.

14 years agoMake letmerge work with non-recursive lets.
Matthijs Kooijman [Fri, 14 Aug 2009 13:43:09 +0000 (15:43 +0200)]
Make letmerge work with non-recursive lets.

14 years agoLimit flattenLets to non-recursive lets only.
Matthijs Kooijman [Fri, 14 Aug 2009 13:38:03 +0000 (15:38 +0200)]
Limit flattenLets to non-recursive lets only.

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.

14 years agoMove flattenLets from Normalize to CoreTools.
Matthijs Kooijman [Fri, 14 Aug 2009 13:29:12 +0000 (15:29 +0200)]
Move flattenLets from Normalize to CoreTools.

14 years agoMake inlinebind work for non-recursive lets.
Matthijs Kooijman [Fri, 14 Aug 2009 13:24:44 +0000 (15:24 +0200)]
Make inlinebind work for non-recursive lets.

This removes the code for recursive lets, since it is no longer needed.

14 years agoAdd empty let removal normalization pass.
Matthijs Kooijman [Fri, 14 Aug 2009 13:19:28 +0000 (15:19 +0200)]
Add empty let removal normalization pass.

14 years agoRename letremove to letremovesimple.
Matthijs Kooijman [Fri, 14 Aug 2009 13:17:07 +0000 (15:17 +0200)]
Rename letremove to letremovesimple.

14 years agoDon't try to simplify nested lets.
Matthijs Kooijman [Fri, 14 Aug 2009 12:38:49 +0000 (14:38 +0200)]
Don't try to simplify nested lets.

This would cause loops with letflat (and possibly with itself as well).

14 years agoMake letflat work with non-recursive lets.
Matthijs Kooijman [Fri, 14 Aug 2009 12:38:11 +0000 (14:38 +0200)]
Make letflat work with non-recursive lets.

This replaces the implementation that worked with recursive lets, since
that is no longer needed.

14 years agoMake letsimpl work on and generate a non-recursive let.
Matthijs Kooijman [Fri, 14 Aug 2009 12:17:51 +0000 (14:17 +0200)]
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.

14 years agoNo longer add a top level let before normalization.
Matthijs Kooijman [Fri, 14 Aug 2009 12:12:50 +0000 (14:12 +0200)]
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.

14 years agoMake some normalizations generate nonrecursive lets.
Matthijs Kooijman [Fri, 14 Aug 2009 12:10:40 +0000 (14:10 +0200)]
Make some normalizations generate nonrecursive lets.

14 years agoMerge branch 'master' of git://github.com/christiaanb/clash into cλash
Matthijs Kooijman [Fri, 14 Aug 2009 12:02:50 +0000 (14:02 +0200)]
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

14 years agoTurn let recursification into its opposite.
Matthijs Kooijman [Fri, 14 Aug 2009 12:00:45 +0000 (14:00 +0200)]
Turn let recursification into its opposite.

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.

14 years agoMerge branch 'cλash' of http://git.stderr.nl/matthijs/projects/master-project
Christiaan Baaij [Fri, 14 Aug 2009 11:30:08 +0000 (13:30 +0200)]
Merge branch 'cλash' of git.stderr.nl/matthijs/projects/master-project

* 'cλash' of http://git.stderr.nl/matthijs/projects/master-project:
  Be more strict in state recognition.

14 years agoBe more strict in state recognition.
Matthijs Kooijman [Fri, 14 Aug 2009 11:27:31 +0000 (13:27 +0200)]
Be more strict in state recognition.

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

14 years agoHopefully generate completely unique varNames now (also for comp_ins labels)
Christiaan Baaij [Thu, 13 Aug 2009 16:03:30 +0000 (18:03 +0200)]
Hopefully generate completely unique varNames now (also for comp_ins labels)

14 years agoMerge branch 'cλash' of http://git.stderr.nl/matthijs/projects/master-project
Christiaan Baaij [Thu, 13 Aug 2009 15:20:33 +0000 (17:20 +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 state proc for an empty state.
  Make splitNormalized work for non-recursive lets.
  Add and use splitNormalized helper function.

14 years agoGenerate more unique variable names, generate truely unique entity names
Christiaan Baaij [Thu, 13 Aug 2009 15:19:48 +0000 (17:19 +0200)]
Generate more unique variable names, generate truely unique entity names

14 years agoDon't generate a state proc for an empty state.
Matthijs Kooijman [Thu, 13 Aug 2009 14:40:43 +0000 (16:40 +0200)]
Don't generate a state proc for an empty state.

This can happen when a function has no state itself, but only substates.

14 years agoMake splitNormalized work for non-recursive lets.
Matthijs Kooijman [Thu, 13 Aug 2009 14:24:44 +0000 (16:24 +0200)]
Make splitNormalized work for non-recursive lets.

For now, normalized expressions can only contain a (single) recursive let,
but this should become nested non-recursive lets only in the future.

14 years agoAdd and use splitNormalized helper function.
Matthijs Kooijman [Thu, 13 Aug 2009 14:12:31 +0000 (16:12 +0200)]
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.

14 years agoAdd boolean or and and, tuple fst and snd function.
Christiaan Baaij [Thu, 13 Aug 2009 12:15:42 +0000 (14:15 +0200)]
Add boolean or and and, tuple fst and snd function.

And add reducer, which uses the above functions

14 years agoAdded equals builtin. And fixed show function generation for integers
Christiaan Baaij [Thu, 13 Aug 2009 09:25:04 +0000 (11:25 +0200)]
Added equals builtin. And fixed show function generation for integers