Matthijs Kooijman [Fri, 13 Feb 2009 14:12:21 +0000 (15:12 +0100)]
Generate dummy component instantiations for each architecture.
We don't have a session available, so we can't lookup or generate any
names yet. Also, the portmaps are not implemented yet.
Matthijs Kooijman [Fri, 13 Feb 2009 13:54:00 +0000 (14:54 +0100)]
Move some pretty printing code around.
Matthijs Kooijman [Fri, 13 Feb 2009 13:49:30 +0000 (14:49 +0100)]
Use less general names as labels some fields.
Matthijs Kooijman [Fri, 13 Feb 2009 13:45:05 +0000 (14:45 +0100)]
Generate a VHDL architecture for each function.
The architecture contains signal declarations, but no instantiations yet.
Matthijs Kooijman [Fri, 13 Feb 2009 13:07:06 +0000 (14:07 +0100)]
Add port declarations to the VHDL entities.
Matthijs Kooijman [Fri, 13 Feb 2009 12:43:51 +0000 (13:43 +0100)]
Put a TypeMark in a VHDLSignalmap.
Matthijs Kooijman [Fri, 13 Feb 2009 12:38:08 +0000 (13:38 +0100)]
Rename fields of SignalInfo.
Matthijs Kooijman [Fri, 13 Feb 2009 12:36:20 +0000 (13:36 +0100)]
Store the Haskell Type in SignalInfo.
Matthijs Kooijman [Fri, 13 Feb 2009 11:39:29 +0000 (12:39 +0100)]
Add the VHDLTypes module
This file should have been added a few commits back already...
Matthijs Kooijman [Fri, 13 Feb 2009 11:37:19 +0000 (12:37 +0100)]
Extract entities from the session and return them in the design file.
Matthijs Kooijman [Fri, 13 Feb 2009 11:28:36 +0000 (12:28 +0100)]
Generate VHDL entity declarations.
These declarations are still without ports and with a name that might not
be unique, though.
Matthijs Kooijman [Fri, 13 Feb 2009 11:17:58 +0000 (12:17 +0100)]
Create an entity for each function.
The entity does not yet contain the actual VHDL entity, but does contain
the argument / result to port name map.
Matthijs Kooijman [Fri, 13 Feb 2009 10:11:33 +0000 (11:11 +0100)]
Store signals in a map.
This turns the list of Signals into a list of (sigid, SignalInfo), which
enables lookup by id.
Matthijs Kooijman [Fri, 13 Feb 2009 09:43:09 +0000 (10:43 +0100)]
Name signals in a function after flattening it.
Matthijs Kooijman [Fri, 13 Feb 2009 08:55:53 +0000 (09:55 +0100)]
Add a modFunc function to edit a function in the session.
Matthijs Kooijman [Fri, 13 Feb 2009 08:55:29 +0000 (09:55 +0100)]
Remove NamedFlatFunction again.
We'll use another way to represent names in FlatFunctions.
Matthijs Kooijman [Wed, 11 Feb 2009 19:22:07 +0000 (20:22 +0100)]
Allow a FlatFunction to be named as well as unnamed.
Matthijs Kooijman [Wed, 11 Feb 2009 19:13:10 +0000 (20:13 +0100)]
Fill the signal list in FlatFunction.
Matthijs Kooijman [Wed, 11 Feb 2009 19:07:46 +0000 (20:07 +0100)]
Add a list of used signals to FlatFunction.
Matthijs Kooijman [Wed, 11 Feb 2009 19:01:44 +0000 (20:01 +0100)]
Remove the distinction between SignalDef and SignalUse.
Now everywhere SignalDef and SignalUse was used before, the sigid is used
directly.
Matthijs Kooijman [Wed, 11 Feb 2009 18:53:47 +0000 (19:53 +0100)]
Make FlatFunction parameterized with the signal id type.
This allows us to define a NamedFlatFunction later on where the signals
have names.
Matthijs Kooijman [Wed, 11 Feb 2009 18:38:57 +0000 (19:38 +0100)]
Move around a bunch of types.
Now most types are defined in a separate module, making it easier to
prevent circular dependencies.
Matthijs Kooijman [Wed, 11 Feb 2009 17:58:53 +0000 (18:58 +0100)]
Add more builtin functions.
Matthijs Kooijman [Wed, 11 Feb 2009 17:58:02 +0000 (18:58 +0100)]
Only force a stateful interface for top level functions.
Matthijs Kooijman [Wed, 11 Feb 2009 17:44:58 +0000 (18:44 +0100)]
Add facilities for builtin functions.
Matthijs Kooijman [Wed, 11 Feb 2009 17:39:50 +0000 (18:39 +0100)]
Add a setFlatFunc function.
This function allows for associating a FlatFunction with a HsFunction in
the current session.
Matthijs Kooijman [Wed, 11 Feb 2009 17:32:41 +0000 (18:32 +0100)]
Make the flatfunc in FuncMap optional.
Matthijs Kooijman [Wed, 11 Feb 2009 17:31:34 +0000 (18:31 +0100)]
Replace FuncMap by a Data.Map.
Matthijs Kooijman [Wed, 11 Feb 2009 17:23:05 +0000 (18:23 +0100)]
Derive Ord for HsFunction.
Matthijs Kooijman [Wed, 11 Feb 2009 17:07:51 +0000 (18:07 +0100)]
Implement resolvFunc.
This function looks for any used functions in the current module.
Matthijs Kooijman [Wed, 11 Feb 2009 17:06:56 +0000 (18:06 +0100)]
Add getFunc session accessor.
Matthijs Kooijman [Wed, 11 Feb 2009 16:56:13 +0000 (17:56 +0100)]
Add the current CoreModule to the session.
Matthijs Kooijman [Wed, 11 Feb 2009 16:47:12 +0000 (17:47 +0100)]
Replace printBind* by a Pretty instance.
Matthijs Kooijman [Wed, 11 Feb 2009 16:28:05 +0000 (17:28 +0100)]
Add Pretty instance for VHDLSession.
Matthijs Kooijman [Wed, 11 Feb 2009 16:27:09 +0000 (17:27 +0100)]
Greatly clean up Translator.
Translator now uses Flatten to flatten a function, but does not do
anything after that point yet. Some code is moved from Translator to the
new modules VHDL and TranslatorTypes, but a lot of other code is removed
(since it was duplicated in Flatten, or will be redone in VHDL).
Matthijs Kooijman [Wed, 11 Feb 2009 16:24:18 +0000 (17:24 +0100)]
Give stateless a type signature.
This ensures that any function that stateless is inlined into doesn't
become polymorph.
Matthijs Kooijman [Wed, 11 Feb 2009 14:39:57 +0000 (15:39 +0100)]
Add pretty printing functions for FlatFunction.
These pretty printing functions are based on Text.PrettyPrint.HughesPJ and
the related Text.PrettyPrint.HughesPJClass from the prettyclass package.
Matthijs Kooijman [Wed, 11 Feb 2009 11:58:28 +0000 (12:58 +0100)]
Learn flattenExpr about single alt Case expressions.
Matthijs Kooijman [Wed, 11 Feb 2009 11:48:36 +0000 (12:48 +0100)]
Learn flattenExpr about Let expressions.
Matthijs Kooijman [Wed, 11 Feb 2009 11:37:50 +0000 (12:37 +0100)]
Learn flattenExpr about building tuples.
Matthijs Kooijman [Wed, 11 Feb 2009 11:25:59 +0000 (12:25 +0100)]
Learn flattenExpr to flatten normal applications.
Matthijs Kooijman [Wed, 11 Feb 2009 11:05:59 +0000 (12:05 +0100)]
Add useAsPort and useAsState functions.
For this, HsValueMap is made Traversable and a PassState type to wrap a
function was added as well.
Matthijs Kooijman [Mon, 9 Feb 2009 16:18:49 +0000 (17:18 +0100)]
Add defMapTouseMap function.
Matthijs Kooijman [Mon, 9 Feb 2009 16:18:40 +0000 (17:18 +0100)]
Make HsValueMap an instance of Functor.
Matthijs Kooijman [Mon, 9 Feb 2009 15:20:26 +0000 (16:20 +0100)]
Learn flattenExpr about function application.
This only distinguishes tuple construction, other data constructor
application and other function applications, but does not actually flatten
any of these yet.
Matthijs Kooijman [Mon, 9 Feb 2009 15:00:01 +0000 (16:00 +0100)]
Make flattenExpr return signal definitions for arguments.
This makes the "wire" example be flattened properly.
Matthijs Kooijman [Mon, 9 Feb 2009 14:53:10 +0000 (15:53 +0100)]
Learn flattenExpr about Var expressions.
Matthijs Kooijman [Mon, 9 Feb 2009 14:36:03 +0000 (15:36 +0100)]
Learn flattenExpr about Lambda expressions.
Matthijs Kooijman [Fri, 6 Feb 2009 11:23:25 +0000 (12:23 +0100)]
Add a BindMap argument to flattenExpr.
Matthijs Kooijman [Fri, 6 Feb 2009 11:19:36 +0000 (12:19 +0100)]
Add accessor methods for FlattenState.
Matthijs Kooijman [Fri, 6 Feb 2009 11:13:13 +0000 (12:13 +0100)]
Add flattenFunction and flattenExpr.
This does not add any actual implementation for flattenExpr, just an empty
function.
This also duplicates the HsValueMap type from Translator, to prevent
dependency loops when testing.
Matthijs Kooijman [Fri, 6 Feb 2009 08:36:59 +0000 (09:36 +0100)]
Add a new module "Flatten".
Only contains data structures so far, but this module will also contain
code for translaten Core to FlatFunctions.
Matthijs Kooijman [Fri, 6 Feb 2009 08:36:31 +0000 (09:36 +0100)]
Let Translator.hs export everything.
Matthijs Kooijman [Thu, 5 Feb 2009 18:47:57 +0000 (19:47 +0100)]
Name the module in Translator.hs Translator.
The module was previously called Main.
Matthijs Kooijman [Thu, 5 Feb 2009 08:20:34 +0000 (09:20 +0100)]
Remove the export list from the Alu module.
This means to export all functions in the module. Previously, it seems
that the alu function was inlined everywhere and thus dropped from the
function list.
Matthijs Kooijman [Thu, 5 Feb 2009 08:20:14 +0000 (09:20 +0100)]
Make the arguments of the alu function curried.
Matthijs Kooijman [Thu, 5 Feb 2009 08:18:08 +0000 (09:18 +0100)]
Remove the empty state of the alu function.
Matthijs Kooijman [Tue, 3 Feb 2009 15:02:48 +0000 (16:02 +0100)]
Create a VHDL proc for each state variable.
This also requires that every entity has a clk inport. This should be
limited to stateful entities only later on.
Matthijs Kooijman [Tue, 3 Feb 2009 13:57:04 +0000 (14:57 +0100)]
Generate a list of state, signal pairs as a side effect of generating signal assignments.
Matthijs Kooijman [Tue, 3 Feb 2009 11:02:21 +0000 (12:02 +0100)]
Match input and output state using ints.
Matthijs Kooijman [Tue, 3 Feb 2009 10:20:52 +0000 (11:20 +0100)]
Use a better name for binders in a lambda expression.
Previously, all signals resulting from a lambda expression were named
"xxx". Now, the actual binder name is included and the name is made
unique.
Matthijs Kooijman [Tue, 3 Feb 2009 10:19:18 +0000 (11:19 +0100)]
Improve error message.
Matthijs Kooijman [Tue, 3 Feb 2009 10:10:46 +0000 (11:10 +0100)]
Let mkIfaceSigDecs and createSignalAssignments handle Unused values.
Matthijs Kooijman [Mon, 2 Feb 2009 16:21:31 +0000 (17:21 +0100)]
Add a D-Flip flop hardware model.
Matthijs Kooijman [Mon, 2 Feb 2009 15:31:51 +0000 (16:31 +0100)]
Make state values unused in a SignalNameMap.
Matthijs Kooijman [Mon, 2 Feb 2009 15:29:02 +0000 (16:29 +0100)]
Extract mkPort and mkState to the top level.
This also changes their names to useAsPort and useAsState resp.
Matthijs Kooijman [Mon, 2 Feb 2009 14:28:24 +0000 (15:28 +0100)]
Print the final session after the output.
Matthijs Kooijman [Mon, 2 Feb 2009 14:27:20 +0000 (15:27 +0100)]
Allow variables to be bound to complex expressions.
Previously, variables (in let expressions for example) could only be bound
to single values. This enables them to be bound to for example tuples as
well.
Matthijs Kooijman [Mon, 2 Feb 2009 14:26:13 +0000 (15:26 +0100)]
Find state arguments / results in top level functions.
This does not actually handle or propagate state yet.
Matthijs Kooijman [Mon, 2 Feb 2009 13:54:28 +0000 (14:54 +0100)]
Add a full_adder version with stateful interface.
The state itself is still empty, this uses the (yank-pasted) stateless
function from Sim.hs to reuse the existing full_adder.
Matthijs Kooijman [Mon, 2 Feb 2009 13:48:06 +0000 (14:48 +0100)]
Make a proper HsFunction for top-level functions.
Matthijs Kooijman [Mon, 2 Feb 2009 13:41:49 +0000 (14:41 +0100)]
Restructure mkVHDL and getArchitecture a bit.
There is now a expandBind which makes the function signature and adds it
to the session, calls getEntity and getArchitecture and merges the
results.
Matthijs Kooijman [Mon, 2 Feb 2009 13:00:33 +0000 (14:00 +0100)]
Create proper HsFunctions for function application.
To keep things working, we also give the builtin functions a proper
HSFunction, since they are the only ones applied up until now.
Matthijs Kooijman [Mon, 2 Feb 2009 12:11:01 +0000 (13:11 +0100)]
Index the list of functions with information about argument usage in addition to the function name.
This will allow some sort of function overloading later on. In particular,
it will allow the VHDL interface and implementation of a function be
different depending on how and where the function is called, but still use
the same VHDL entity where the invocations are the same.
The extra information is not yet used or filled in, this will come next.
Matthijs Kooijman [Mon, 2 Feb 2009 11:44:50 +0000 (12:44 +0100)]
Introduce a new type HsValueMap.
This type generalized SignalNameMap (which remains as a type alias for
now), but can map a haskell value to any value.
Matthijs Kooijman [Mon, 2 Feb 2009 11:17:26 +0000 (12:17 +0100)]
Make tuple construction handling more portable.
Matthijs Kooijman [Mon, 2 Feb 2009 11:07:41 +0000 (12:07 +0100)]
Remove the getInstantiations function.
It was no longer used and replaced by expandExpr.
Matthijs Kooijman [Mon, 2 Feb 2009 09:01:37 +0000 (10:01 +0100)]
Write the resulting vhdl to file.
Matthijs Kooijman [Mon, 2 Feb 2009 09:01:19 +0000 (10:01 +0100)]
Replace - with _ in VHDL ids.
Matthijs Kooijman [Fri, 30 Jan 2009 12:40:30 +0000 (13:40 +0100)]
Set VHDL types based on Haskell Types.
Only the Bit type is supported so far.
Matthijs Kooijman [Fri, 30 Jan 2009 12:21:07 +0000 (13:21 +0100)]
Store the type of a signal in a SignalNameMap.
Note that the type is still always filled with vhdl_bit_ty, but this moves
this hardcoding from two seperate places to one place (where we can remove
it next).
Matthijs Kooijman [Fri, 30 Jan 2009 12:13:18 +0000 (13:13 +0100)]
Make SignalNameMap always map VHDLId's.
Previously, the SignalNameMap had a type argument to specify the
idenitifier type, which helped in transitioning from String to VHDLId but
is not longer used now.
Matthijs Kooijman [Fri, 30 Jan 2009 12:02:46 +0000 (13:02 +0100)]
Generate entities in addition to architectures.
Matthijs Kooijman [Fri, 30 Jan 2009 11:31:29 +0000 (12:31 +0100)]
Store the VHDLId of a function in HWFunction.
Matthijs Kooijman [Fri, 30 Jan 2009 09:29:45 +0000 (10:29 +0100)]
Give Adders a mainIO to to interactive simulation.
Matthijs Kooijman [Fri, 30 Jan 2009 09:25:15 +0000 (10:25 +0100)]
Add a a new function "stateless".
This function converts a stateless circuit into a stateful one (with an
empty state), so it can be simulated.
Matthijs Kooijman [Fri, 30 Jan 2009 09:23:49 +0000 (10:23 +0100)]
Add a stateless circuit type.
Matthijs Kooijman [Fri, 30 Jan 2009 09:14:42 +0000 (10:14 +0100)]
Rename the Circuit type to SCircuit (for stateful)
Matthijs Kooijman [Fri, 30 Jan 2009 09:13:45 +0000 (10:13 +0100)]
Rename a bunch of type variables.
Matthijs Kooijman [Fri, 30 Jan 2009 09:11:06 +0000 (10:11 +0100)]
Store the RegisterBankState in a algbraic data type.
Matthijs Kooijman [Fri, 30 Jan 2009 09:10:41 +0000 (10:10 +0100)]
Show input on each simulation step.
Matthijs Kooijman [Fri, 30 Jan 2009 08:56:27 +0000 (09:56 +0100)]
Print the binds we're about to translate.
Matthijs Kooijman [Fri, 30 Jan 2009 08:55:44 +0000 (09:55 +0100)]
Implement full_adder in terms of half_adder.
Matthijs Kooijman [Thu, 29 Jan 2009 16:55:24 +0000 (17:55 +0100)]
Allow multiple functions to be translated in the same session.
Matthijs Kooijman [Thu, 29 Jan 2009 16:47:45 +0000 (17:47 +0100)]
Swap argument order on findBind.
Matthijs Kooijman [Thu, 29 Jan 2009 16:43:32 +0000 (17:43 +0100)]
Learn expandExpr how to handle Let expressions.
Matthijs Kooijman [Thu, 29 Jan 2009 16:43:10 +0000 (17:43 +0100)]
Make full_adder simpler.
Matthijs Kooijman [Thu, 29 Jan 2009 16:42:42 +0000 (17:42 +0100)]
Improve error message for createSignalAssignments.
Matthijs Kooijman [Thu, 29 Jan 2009 16:42:09 +0000 (17:42 +0100)]
Learn ExpandExpr how to handle simple case expressions.
Matthijs Kooijman [Thu, 29 Jan 2009 15:49:05 +0000 (16:49 +0100)]
Add a base case to splitTupleConstructorArgs.
Apparently we've never tried to find the end of the returned list before :-)