matthijs/master-project/cλash.git
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.

15 years agoMake is_fun also work properly for Type CoreExprs.
Matthijs Kooijman [Sun, 21 Jun 2009 11:58:15 +0000 (13:58 +0200)]
Make is_fun also work properly for Type CoreExprs.

Previously, this would generate some debug output from exprType, which
isn't properly defined for Type expressions.

15 years agoRemove two old debug traces.
Matthijs Kooijman [Sun, 21 Jun 2009 11:52:55 +0000 (13:52 +0200)]
Remove two old debug traces.

15 years agoAdd type propagation transform.
Matthijs Kooijman [Sun, 21 Jun 2009 11:37:52 +0000 (13:37 +0200)]
Add type propagation transform.

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.

15 years agoAdd cloneVar function to clone a Var.
Matthijs Kooijman [Sun, 21 Jun 2009 11:37:04 +0000 (13:37 +0200)]
Add cloneVar function to clone a Var.

15 years agoRecursively normalize binds.
Matthijs Kooijman [Fri, 19 Jun 2009 14:40:15 +0000 (16:40 +0200)]
Recursively normalize binds.

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

15 years agoAdded support for (!) function
Christiaan Baaij [Fri, 19 Jun 2009 14:14:28 +0000 (16:14 +0200)]
Added support for (!) function

15 years agoAdded support for RangedWords
Christiaan Baaij [Fri, 19 Jun 2009 14:14:02 +0000 (16:14 +0200)]
Added support for RangedWords

15 years agoAdders.hs explicityly uses Prelude lists function. TFVec function are the default
Christiaan Baaij [Fri, 19 Jun 2009 11:33:17 +0000 (13:33 +0200)]
Adders.hs explicityly uses Prelude lists function. TFVec function are the default

15 years agoAdded main function to Main module
Christiaan Baaij [Fri, 19 Jun 2009 11:32:48 +0000 (13:32 +0200)]
Added main function to Main module

15 years agoMerge branch 'cλash' of http://git.stderr.nl/matthijs/projects/master-project
Christiaan Baaij [Fri, 19 Jun 2009 11:25:24 +0000 (13:25 +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 another higher order testcase, highordtest2.
  Support VHDL generation for two-alternative cases.

Conflicts:
Translator.hs

15 years agoAdded function calls
Christiaan Baaij [Fri, 19 Jun 2009 11:22:06 +0000 (13:22 +0200)]
Added function calls

15 years agoAdd another higher order testcase, highordtest2.
Matthijs Kooijman [Fri, 19 Jun 2009 10:41:49 +0000 (12:41 +0200)]
Add another higher order testcase, highordtest2.

This testcase can be succesfully normalized and translated to VHDL.

15 years agoSupport VHDL generation for two-alternative cases.
Matthijs Kooijman [Fri, 19 Jun 2009 10:39:44 +0000 (12:39 +0200)]
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.

15 years agoMerge branch 'cλash' of http://git.stderr.nl/matthijs/projects/master-project
Christiaan Baaij [Fri, 19 Jun 2009 10:17:44 +0000 (12: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:
  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.

Conflicts:
Translator.hs
VHDL.hs

15 years agoStarted adding builtin functions
Christiaan Baaij [Fri, 19 Jun 2009 10:11:49 +0000 (12:11 +0200)]
Started adding builtin functions

15 years agoCabalized clash
Christiaan Baaij [Fri, 19 Jun 2009 08:26:52 +0000 (10:26 +0200)]
Cabalized clash

15 years agoAdded global vector function generation
Christiaan Baaij [Fri, 19 Jun 2009 08:13:43 +0000 (10:13 +0200)]
Added global vector function generation

15 years agoUse highordtest in main, since that can now be normalized.
Matthijs Kooijman [Thu, 18 Jun 2009 13:27:28 +0000 (15:27 +0200)]
Use highordtest in main, since that can now be normalized.

15 years agoAdd a (fairly complete) set of transforms.
Matthijs Kooijman [Thu, 18 Jun 2009 13:26:38 +0000 (15:26 +0200)]
Add a (fairly complete) set of transforms.

These transforms should normalize most core programs, though this was not
confirmed yet. Also, they do not use any cross-function transforming.

15 years agoAdd is_lam and is_fun predicates.
Matthijs Kooijman [Thu, 18 Jun 2009 12:55:14 +0000 (14:55 +0200)]
Add is_lam and is_fun predicates.

15 years agoAdd a inlinebind helper function.
Matthijs Kooijman [Thu, 18 Jun 2009 12:48:36 +0000 (14:48 +0200)]
Add a inlinebind helper function.

This function can create a transformation that will inline some bindings
in a let expression, based on a condition function passed in.

15 years agoAdd a substitute helper function.
Matthijs Kooijman [Thu, 18 Jun 2009 12:47:56 +0000 (14:47 +0200)]
Add a substitute helper function.

This function performs a number of substitutions on a CoreExpr, by using
the CoreSubst module.

15 years agoPrint the type in the transform debug output.
Matthijs Kooijman [Thu, 18 Jun 2009 12:47:15 +0000 (14:47 +0200)]
Print the type in the transform debug output.

15 years agoAdd infrastructure for running core to core transformations.
Matthijs Kooijman [Thu, 18 Jun 2009 09:30:12 +0000 (11:30 +0200)]
Add infrastructure for running core to core transformations.

This does not add any actual transformations, just the supporting
functions and functions to run the transformations.

15 years agoAdd a higher order testcase.
Matthijs Kooijman [Thu, 18 Jun 2009 08:59:26 +0000 (10:59 +0200)]
Add a higher order testcase.

This testcase is taken from my report and uses some higher order
constructs.

15 years agoAdd is_wild function to check for wild binders.
Matthijs Kooijman [Thu, 18 Jun 2009 08:58:54 +0000 (10:58 +0200)]
Add is_wild function to check for wild binders.

15 years agoGenerate VHDL from Core instead of flat functions.
Matthijs Kooijman [Mon, 15 Jun 2009 11:42:33 +0000 (13:42 +0200)]
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.

15 years agoMake listBind support recursive bindings.
Matthijs Kooijman [Fri, 12 Jun 2009 12:02:01 +0000 (14:02 +0200)]
Make listBind support recursive bindings.

This allows listBind to process non-simplified Core modules.

15 years agoUpdate the hardware models a bit.
Matthijs Kooijman [Mon, 25 May 2009 09:58:23 +0000 (11:58 +0200)]
Update the hardware models a bit.

15 years agoSupport binding the scrutinee of a Case expression.
Matthijs Kooijman [Thu, 16 Apr 2009 08:00:14 +0000 (10:00 +0200)]
Support binding the scrutinee of a Case expression.

15 years agoDerive Show CoreSyn.Note.
Matthijs Kooijman [Wed, 15 Apr 2009 08:40:11 +0000 (10:40 +0200)]
Derive Show CoreSyn.Note.

15 years agoLet VHDL generate a typecast for SizedWord literals.
Matthijs Kooijman [Tue, 14 Apr 2009 09:51:58 +0000 (11:51 +0200)]
Let VHDL generate a typecast for SizedWord literals.

15 years agoGenerate VHDL typecasts for literals when needed.
Matthijs Kooijman [Tue, 14 Apr 2009 09:51:38 +0000 (11:51 +0200)]
Generate VHDL typecasts for literals when needed.

15 years agoPut mkConcSm inside the VHDLState monad.
Matthijs Kooijman [Tue, 14 Apr 2009 09:36:24 +0000 (11:36 +0200)]
Put mkConcSm inside the VHDLState monad.

This will allow us to acces the TypeMap for typed literals.

15 years agoAdd a Type to a Literal SignalExpr.
Matthijs Kooijman [Tue, 14 Apr 2009 09:24:34 +0000 (11:24 +0200)]
Add a Type to a Literal SignalExpr.

The Type is still unused, but will be used for making the VHDL backend add
a typecast (since the actual VHDL name for the type is not known
earlier).

15 years agoGeneralize VHDL type creation for SizedWord and FSVec.
Matthijs Kooijman [Thu, 9 Apr 2009 16:29:53 +0000 (18:29 +0200)]
Generalize VHDL type creation for SizedWord and FSVec.

15 years agoA word has a width, not a length.
Matthijs Kooijman [Thu, 9 Apr 2009 16:25:53 +0000 (18:25 +0200)]
A word has a width, not a length.

15 years agoProperly save state propagated flat functions.
Matthijs Kooijman [Thu, 9 Apr 2009 16:23:23 +0000 (18:23 +0200)]
Properly save state propagated flat functions.

Previously, the propagated state was not properly saved, resulting in
stateful functions being defined, while stateless versions were
instantiated.

15 years agoMake the Alu example use 4-bit SizedWord as data.
Matthijs Kooijman [Thu, 9 Apr 2009 16:21:39 +0000 (18:21 +0200)]
Make the Alu example use 4-bit SizedWord as data.

Since we have no operations on words yet, the alu itself is reduced to a
simple multiplexer for now.

15 years agoAdd (non-working) support for SizedWord literals.
Matthijs Kooijman [Thu, 9 Apr 2009 16:19:59 +0000 (18:19 +0200)]
Add (non-working) support for SizedWord literals.

The VHDL produced by this commit does not compile due to type
incompatibility, some thought is needed here.

15 years agoTranslate the SizedWord type to a VHDL vector.
Matthijs Kooijman [Thu, 9 Apr 2009 16:18:29 +0000 (18:18 +0200)]
Translate the SizedWord type to a VHDL vector.

15 years agoMove eval_type_level_int to CoreTools.
Matthijs Kooijman [Thu, 9 Apr 2009 16:17:01 +0000 (18:17 +0200)]
Move eval_type_level_int to CoreTools.

15 years agoImport the Types.Data.Num module in eval_tfp_int.
Matthijs Kooijman [Thu, 9 Apr 2009 16:16:32 +0000 (18:16 +0200)]
Import the Types.Data.Num module in eval_tfp_int.

This makes eval_tfp_int actually work, since now the proper instances are
in scope.

15 years agoAdd a [ModuleName] parameter to toCore.
Matthijs Kooijman [Thu, 9 Apr 2009 16:15:43 +0000 (18:15 +0200)]
Add a [ModuleName] parameter to toCore.

This allows callers to put any number of modules into scope before
translating to Core. Previously, functions and values could be
automatically imported by using their qualified name, but now also
instances can be used from modules that would not be imported otherwise.

15 years agoFix compilation of CoreTools.
Matthijs Kooijman [Thu, 9 Apr 2009 16:13:10 +0000 (18:13 +0200)]
Fix compilation of CoreTools.

15 years agoAdd an importModule function.
Matthijs Kooijman [Thu, 9 Apr 2009 16:06:47 +0000 (18:06 +0200)]
Add an importModule function.

This function allows us to import a module inside the TcRn monad and
properly handles (family) instances. This is needed for working with the
tfp package.

15 years agoAllow references to global values without arguments.
Matthijs Kooijman [Thu, 9 Apr 2009 16:03:13 +0000 (18:03 +0200)]
Allow references to global values without arguments.

These references are treated as function applications without arguments.

15 years agoMove some code out of the flattenExpr to global scope.
Matthijs Kooijman [Thu, 9 Apr 2009 16:02:00 +0000 (18:02 +0200)]
Move some code out of the flattenExpr to global scope.

15 years agoAdd sized_word_len, which gets the length from a SizedWord type.
Matthijs Kooijman [Thu, 9 Apr 2009 15:58:59 +0000 (17:58 +0200)]
Add sized_word_len, which gets the length from a SizedWord type.

15 years agoAdd the new CoreTools module.
Matthijs Kooijman [Thu, 9 Apr 2009 15:58:21 +0000 (17:58 +0200)]
Add the new CoreTools module.

This module will contain functions to work with specific constructs
represented as Core expressions and types (i.e., it knows about how
certain libraries are structured and uses functions from there).

For now, this contains a single function to translate (the Core
representation of) a type level int from the tfp package to a real Int.