Matthijs Kooijman [Wed, 12 Aug 2009 15:16:07 +0000 (17:16 +0200)]
Throw away old and unused functions for state.
Matthijs Kooijman [Wed, 12 Aug 2009 15:12:53 +0000 (17:12 +0200)]
Generate a state proc for a stateful function.
This means that stateful functions can now be succesfully compiled to some
extent (the Alu example only works without the simplifier).
Matthijs Kooijman [Wed, 12 Aug 2009 15:11:43 +0000 (17:11 +0200)]
Don't inline register_bank.
Matthijs Kooijman [Wed, 12 Aug 2009 15:09:41 +0000 (17:09 +0200)]
Only do State packing once in register_bank.
Matthijs Kooijman [Wed, 12 Aug 2009 15:06:52 +0000 (17:06 +0200)]
Improve Normalize debug output.
Matthijs Kooijman [Wed, 12 Aug 2009 14:14:50 +0000 (16:14 +0200)]
Add isStateCon helper.
Matthijs Kooijman [Wed, 12 Aug 2009 14:13:21 +0000 (16:13 +0200)]
Use mkBinderFor instead of mkInternalVar.
Matthijs Kooijman [Wed, 12 Aug 2009 14:09:41 +0000 (16:09 +0200)]
Add identical let binding merge normalization pass.
Matthijs Kooijman [Wed, 12 Aug 2009 13:08:02 +0000 (15:08 +0200)]
Add cast simplification normalization pass.
This ensures that the casts used for packing and unpacking State variables
only operate on simple variables.
Matthijs Kooijman [Wed, 12 Aug 2009 10:19:27 +0000 (12:19 +0200)]
Make output ports optional.
This makes the output port in an Entity of the Maybe Port type, so we can
leave out the output port (for example when its type is empty). This makes
the code a bit more robus in the face of empty types.
Matthijs Kooijman [Wed, 12 Aug 2009 09:05:48 +0000 (11:05 +0200)]
Fix more comments.
Matthijs Kooijman [Wed, 12 Aug 2009 09:04:38 +0000 (11:04 +0200)]
Fix comment.
Christiaan Baaij [Sat, 8 Aug 2009 11:21:17 +0000 (13:21 +0200)]
Fix haddock comments
Christiaan Baaij [Fri, 7 Aug 2009 13:58:14 +0000 (15:58 +0200)]
Add support for translating designs defined over multiple modules
Have to test the stability, it works for HighOrdAlu
Christiaan Baaij [Fri, 7 Aug 2009 12:29:22 +0000 (14:29 +0200)]
Have reduceCoreListToHsList work with simplified modules
Christiaan Baaij [Fri, 7 Aug 2009 08:11:35 +0000 (10:11 +0200)]
We now use compileToCoreSimplified, I'm sure there will be dragons
Christiaan Baaij [Fri, 7 Aug 2009 07:22:52 +0000 (09:22 +0200)]
State newtype has been moved to CLasH.HardwareTypes
Christiaan Baaij [Fri, 7 Aug 2009 07:20:15 +0000 (09:20 +0200)]
Alu.hs now uses the new CLasH.HardwareTypes
Matthijs Kooijman [Thu, 6 Aug 2009 17:22:09 +0000 (19:22 +0200)]
Merge branch 'master' of git://github.com/christiaanb/clash into cλash
* 'master' of git://github.com/christiaanb/clash:
Add the type-alias Vector for TFVec to HardwareTypes, and don't export TFVec.TFVec anymore
Add the module hardware types, that exports all builtin types.
Add new modules to cabal file
Matthijs Kooijman [Thu, 6 Aug 2009 17:21:17 +0000 (19:21 +0200)]
Rewrite Alu using the State newtype.
This is the way stateful functions will be working. Alu.hs now compiles,
but it does not result in valid (stateful) VHDL yet.
Matthijs Kooijman [Thu, 6 Aug 2009 17:19:52 +0000 (19:19 +0200)]
Filter out empty-typed binders in selector cases.
This makes sure that the non-empty binders are skipped when calculating
the field number, which prevents overflow when indexing the field names.
Matthijs Kooijman [Thu, 6 Aug 2009 17:18:48 +0000 (19:18 +0200)]
Add hasNonEmptyType helper function.
Matthijs Kooijman [Thu, 6 Aug 2009 17:09:11 +0000 (19:09 +0200)]
Let argsToVHDLExpr ignore empty types.
This makes sure that state arguments are not passed to called functions.
Matthijs Kooijman [Thu, 6 Aug 2009 17:08:22 +0000 (19:08 +0200)]
Generalize vhdl_ty to work an all TypedThings.
Matthijs Kooijman [Thu, 6 Aug 2009 17:06:43 +0000 (19:06 +0200)]
Add isJustM helper function.
Matthijs Kooijman [Thu, 6 Aug 2009 16:47:09 +0000 (18:47 +0200)]
Rename eitherCoreOrExprArgs to argsToVHDLExprs.
Also add a helper function to make it more readable.
Matthijs Kooijman [Thu, 6 Aug 2009 15:54:03 +0000 (17:54 +0200)]
Remove the getType field name from OrdType.
This conflicted with the getType method from TypedThing. The field label
was never used.
Matthijs Kooijman [Thu, 6 Aug 2009 15:45:56 +0000 (17:45 +0200)]
Put mkAssocElems in the TranslatorSession.
Matthijs Kooijman [Thu, 6 Aug 2009 15:43:40 +0000 (17:43 +0200)]
Remove unused mkAssocElemIndexed.
Matthijs Kooijman [Thu, 6 Aug 2009 15:40:25 +0000 (17:40 +0200)]
Don't generate VHDL for substate extractor cases.
Matthijs Kooijman [Thu, 6 Aug 2009 15:32:25 +0000 (17:32 +0200)]
Fix letremoveunused, it removed all used bindings.
Matthijs Kooijman [Thu, 6 Aug 2009 15:21:49 +0000 (17:21 +0200)]
Fix the trace output of normalized functions.
Before, it would output the un-normalized version.
Matthijs Kooijman [Thu, 6 Aug 2009 15:13:54 +0000 (17:13 +0200)]
Filtering out state arguments is no longer needed.
Since State types generate empty VHDL types now, they will be filtered out
automatically.
Matthijs Kooijman [Thu, 6 Aug 2009 15:13:14 +0000 (17:13 +0200)]
Generate the empty type for State types.
Matthijs Kooijman [Thu, 6 Aug 2009 15:08:25 +0000 (17:08 +0200)]
Allow explicit empty VHDL types using Maybe.
The VHDL type generating functions can now return "Nothing" to mean that an
empty type would be generated. There are still some spots (builtin
functions mostly) that should handle this more gracefully, but it works
for now. Only single-constructor zero-argument algebraic types generate
the empty type currently, e.g. ().
Matthijs Kooijman [Thu, 6 Aug 2009 14:21:32 +0000 (16:21 +0200)]
Don't generate input ports for State arguments.
Matthijs Kooijman [Thu, 6 Aug 2009 14:20:51 +0000 (16:20 +0200)]
Don't generate VHDL for state packing.
Matthijs Kooijman [Thu, 6 Aug 2009 14:15:20 +0000 (16:15 +0200)]
Add TypedThing class, and generalize hasStateType with it.
Matthijs Kooijman [Thu, 6 Aug 2009 13:56:44 +0000 (15:56 +0200)]
Add letremoveunused transformation.
This transformation removes all unused let bindings.
Matthijs Kooijman [Thu, 6 Aug 2009 13:56:23 +0000 (15:56 +0200)]
Add changeif normalization helper function.
Matthijs Kooijman [Thu, 6 Aug 2009 13:56:04 +0000 (15:56 +0200)]
Add expr_uses_binders predicate.
Matthijs Kooijman [Thu, 6 Aug 2009 13:55:43 +0000 (15:55 +0200)]
Add {is,has}StateType predicates.
Matthijs Kooijman [Thu, 6 Aug 2009 13:47:19 +0000 (15:47 +0200)]
Let mkTupleShow support empty tuples.
Christiaan Baaij [Thu, 6 Aug 2009 13:02:40 +0000 (15:02 +0200)]
Add the type-alias Vector for TFVec to HardwareTypes, and don't export TFVec.TFVec anymore
Christiaan Baaij [Thu, 6 Aug 2009 12:54:43 +0000 (14:54 +0200)]
Add the module hardware types, that exports all builtin types.
This way, users only have to import CLasH.HardwareTypes to get
access to all translatable hardware types.
Christiaan Baaij [Thu, 6 Aug 2009 11:29:11 +0000 (13:29 +0200)]
Add new modules to cabal file
Matthijs Kooijman [Thu, 6 Aug 2009 10:06:32 +0000 (12:06 +0200)]
Remove the unused "stateful" argument fomr makeVHDL*.
State will be explicitely specified in the Haskell sources, so no reason
anymore to pass the statefulness of a function around.
Matthijs Kooijman [Wed, 5 Aug 2009 15:10:41 +0000 (17:10 +0200)]
Merge branch 'master' of git://github.com/christiaanb/clash into cλash
* 'master' of git://github.com/christiaanb/clash:
Fix builtin functions (!),take and RangedWord
Conflicts:
cλash/CLasH/VHDL/Generate.hs
Matthijs Kooijman [Wed, 5 Aug 2009 15:04:48 +0000 (17:04 +0200)]
Restructure the "finder" functions.
Previously, there were three different functions for the top entity,
initial state and test input. Now, there is just a single one, which
guarantees that these things are properly linked together. This should no
also support generating multiple entities at the same time (though there
is no top level interface for this yet).
This change also makes the testbench generation optional. A bunch of
functions were moved from Utils to GhcTools, to prevent a dependency loop.
Matthijs Kooijman [Wed, 5 Aug 2009 15:04:06 +0000 (17:04 +0200)]
Add catMaybesM and concatM helper functions.
Matthijs Kooijman [Wed, 5 Aug 2009 15:00:47 +0000 (17:00 +0200)]
Use the right id for the testbench architecture.
Christiaan Baaij [Wed, 5 Aug 2009 14:17:17 +0000 (16:17 +0200)]
Fix builtin functions (!),take and RangedWord
Matthijs Kooijman [Wed, 5 Aug 2009 13:21:45 +0000 (15:21 +0200)]
Fix testbench again.
The testbench code has also been moved to a separate module.
Matthijs Kooijman [Wed, 5 Aug 2009 13:20:14 +0000 (15:20 +0200)]
Split of part of getNormalized into normalizeExpr.
Matthijs Kooijman [Wed, 5 Aug 2009 12:51:53 +0000 (14:51 +0200)]
Add unzipM helper function.
Matthijs Kooijman [Wed, 5 Aug 2009 12:05:45 +0000 (14:05 +0200)]
Slightly simplify getEntity.
Matthijs Kooijman [Wed, 5 Aug 2009 11:59:39 +0000 (13:59 +0200)]
Move around some helper functions.
This moves some stuff from NormalizeTools and NormalizeTypes into the
(new) BinderTools and TranslatorTypes. This also puts most of these
function in the TranslatorSession instead of the TransformMonad.
Matthijs Kooijman [Wed, 5 Aug 2009 10:36:38 +0000 (12:36 +0200)]
Remove compatability aliases for the old sessions.
Matthijs Kooijman [Wed, 5 Aug 2009 10:12:28 +0000 (12:12 +0200)]
Make vhdl generation and normalization lazy.
Previously, first all function would be (recursively) normalized, and then
VHDL would be generated. Now, functions are normalized when needed, and
recursion is done while generating VHDL (so we know exactly which
components we are instantiating).
This disables the testbench and TFVec constructor for now, I'll fix that
in the next commits.
This also moves some code around, to prevent loops between Generate and
VHDL (again...).
The VHDLSession and NormalizeSession have been removed, and replaced with
the (previously unused) TranslatorSession. There are a few backward
compatibility aliases in place, so the next commit will probably remove
these and do a bunch of trivial replaces all over the code.
Matthijs Kooijman [Mon, 3 Aug 2009 10:26:43 +0000 (12:26 +0200)]
Put a comment on UniqSupply generation back.
Matthijs Kooijman [Mon, 3 Aug 2009 10:20:29 +0000 (12:20 +0200)]
Merge branch 'master' of git://github.com/christiaanb/clash into cλash
* 'master' of git://github.com/christiaanb/clash:
TFVec builtin should now completely work
Clean up imports in Generate.hs
Use createDirectoryIfMissing to create the vhdl directory, as it can create the parent directories too
Reflect API changes of clash in clash-nolibdir
Bring back listBind(ings) in Utils.hs by reorganising Translator.hs and GhcTools.hs
Fix a few comments so Haddock will complete
Further clean up Translator.hs (almost done now)
Cleanup Translator.hs
Fail again when we find a global function
Partially fixed TFVec builtin function. Still needs to be verified
Christiaan Baaij [Mon, 3 Aug 2009 07:51:55 +0000 (09:51 +0200)]
TFVec builtin should now completely work
Christiaan Baaij [Sun, 2 Aug 2009 19:17:21 +0000 (21:17 +0200)]
Clean up imports in Generate.hs
Christiaan Baaij [Sun, 2 Aug 2009 19:07:46 +0000 (21:07 +0200)]
Use createDirectoryIfMissing to create the vhdl directory, as it can create the parent directories too
Christiaan Baaij [Sun, 2 Aug 2009 18:51:29 +0000 (20:51 +0200)]
Reflect API changes of clash in clash-nolibdir
Christiaan Baaij [Sat, 1 Aug 2009 18:41:19 +0000 (20:41 +0200)]
Bring back listBind(ings) in Utils.hs by reorganising Translator.hs and GhcTools.hs
Christiaan Baaij [Fri, 31 Jul 2009 19:01:02 +0000 (21:01 +0200)]
Fix a few comments so Haddock will complete
Christiaan Baaij [Fri, 31 Jul 2009 18:46:17 +0000 (20:46 +0200)]
Further clean up Translator.hs (almost done now)
Christiaan Baaij [Fri, 31 Jul 2009 15:17:04 +0000 (17:17 +0200)]
Cleanup Translator.hs
Can be reduced in size even more by parameterizing the findcore functions
to work for both strings and annotations
Christiaan Baaij [Fri, 31 Jul 2009 15:15:54 +0000 (17:15 +0200)]
Fail again when we find a global function
Was only disabled to fix the builtin TFVec function
Christiaan Baaij [Fri, 31 Jul 2009 13:21:02 +0000 (15:21 +0200)]
Partially fixed TFVec builtin function. Still needs to be verified
Matthijs Kooijman [Fri, 31 Jul 2009 12:34:34 +0000 (14:34 +0200)]
Merge casevalsimpl and casewild into casesimpl.
Both transformations had a very similar structure, which are now merged.
Matthijs Kooijman [Fri, 31 Jul 2009 11:04:05 +0000 (13:04 +0200)]
Fix a small bug in the case wildening.
This bug could be triggered when the scrutinee was a datatype containing a
non-representable value. This is probably not translatable, but handle it
properly anyway.
Matthijs Kooijman [Fri, 31 Jul 2009 10:37:08 +0000 (12:37 +0200)]
Prevent conflicts with inlinenonrep in normalization.
This is a followup on
ebdc2024d7cf71: Let inlinefun inline everything non-representable.
which make inlinefun more general. A few other normalizations tried to
prevent loops with inline fun, but now work correctly for the (new)
inlinenonrep.
Matthijs Kooijman [Fri, 31 Jul 2009 09:26:59 +0000 (11:26 +0200)]
Merge branch 'master' of git://github.com/christiaanb/clash into cλash
* 'master' of git://github.com/christiaanb/clash:
Quick hack implementation of FSVec literals, needs to be fixed
We need the latest vhdl package
We now make a show function for all default datatypes.
Add automated testbench generation according to supplied test input
Conflicts:
cλash/CLasH/Translator.hs
Christiaan Baaij [Fri, 31 Jul 2009 07:19:57 +0000 (09:19 +0200)]
Quick hack implementation of FSVec literals, needs to be fixed
Christiaan Baaij [Wed, 29 Jul 2009 12:08:54 +0000 (14:08 +0200)]
We need the latest vhdl package
Christiaan Baaij [Wed, 29 Jul 2009 12:01:41 +0000 (14:01 +0200)]
We now make a show function for all default datatypes.
We need to figure out how to show custom datatypes in VHDL, for that
we will need a string representation for each constructor.
Christiaan Baaij [Tue, 28 Jul 2009 14:52:18 +0000 (16:52 +0200)]
Add automated testbench generation according to supplied test input
Will not compile in VHDL yet as we need to implement the VHDL show method first
Matthijs Kooijman [Tue, 28 Jul 2009 13:40:41 +0000 (15:40 +0200)]
Show type of binder in listBinding.
Matthijs Kooijman [Tue, 28 Jul 2009 13:38:30 +0000 (15:38 +0200)]
Make listBind use listBinding.
Matthijs Kooijman [Tue, 28 Jul 2009 13:26:58 +0000 (15:26 +0200)]
Extend CoreShow for TyCons.
This still does not completely show TyCons, since they are quite complex,
but at least distinguishes the various constructors and some useful info.
Christiaan Baaij [Thu, 23 Jul 2009 21:18:35 +0000 (23:18 +0200)]
Remove NoGenerics pragma, as the ghc bug 3391 is now fixed
Christiaan Baaij [Thu, 23 Jul 2009 19:14:19 +0000 (21:14 +0200)]
Add a clash wrapper that fills in the libdir from GHC.Paths
Christiaan Baaij [Thu, 23 Jul 2009 16:03:54 +0000 (18:03 +0200)]
Also add NoGenerics pragma to the other types.hs files
Christiaan Baaij [Thu, 23 Jul 2009 15:59:24 +0000 (17:59 +0200)]
Fix core show
Christiaan Baaij [Thu, 23 Jul 2009 15:22:47 +0000 (17:22 +0200)]
Currently Generics support is broken in combination with deriveAccessors
Christiaan Baaij [Wed, 22 Jul 2009 11:38:20 +0000 (13:38 +0200)]
Add licence to top directory
Christiaan Baaij [Wed, 22 Jul 2009 11:33:44 +0000 (13:33 +0200)]
Removed need for GHC.Paths, some functions however require a top libdir
Christiaan Baaij [Wed, 22 Jul 2009 07:37:59 +0000 (09:37 +0200)]
Update .cabal file so that a default build is expected to be in the GHC tree
Christiaan Baaij [Wed, 22 Jul 2009 07:31:30 +0000 (09:31 +0200)]
Make sure clash is build using stage2 ghc when build in ghc build tree
Christiaan Baaij [Wed, 22 Jul 2009 07:27:03 +0000 (09:27 +0200)]
Changed name of cabal file so it will work in the GHC build tree
Christiaan Baaij [Mon, 20 Jul 2009 12:01:08 +0000 (14:01 +0200)]
Changed build-depends to only those libraries required to build clash
tfvec, tfp and th-lift-ng are however required to translate any haskell
file to VHDL. They will be included in the clash package
Christiaan Baaij [Thu, 16 Jul 2009 13:25:10 +0000 (15:25 +0200)]
We now support Annotations to indicate top-level entity and initial state
Christiaan Baaij [Wed, 15 Jul 2009 18:14:06 +0000 (20:14 +0200)]
No need for Main.hs now that clash is a library
Christiaan Baaij [Wed, 15 Jul 2009 18:11:44 +0000 (20:11 +0200)]
Adepted the modules to their new structure
Christiaan Baaij [Wed, 15 Jul 2009 17:29:53 +0000 (19:29 +0200)]
Moved clash to it's own library directory, and started on library structure
Christiaan Baaij [Wed, 15 Jul 2009 15:41:13 +0000 (17:41 +0200)]
Moved to new GHC API (6.11). Also use vhdl package for the VHDL AST
Matthijs Kooijman [Tue, 14 Jul 2009 13:36:39 +0000 (15:36 +0200)]
Remove the (now unused) is_wild predicate.
Matthijs Kooijman [Tue, 14 Jul 2009 13:31:56 +0000 (15:31 +0200)]
Don't create selector cases for unused binders.
Previously, no selector cases were created for wild binders, using the
hacky is_wild predicate. Now, this checks the free variables of the case
value instead.