Commit Graph

18 Commits

Author SHA1 Message Date
Neil Brown
1e06768c20 Added channel-end support to the C++CSP backend
I have added two helper functions, but since they are used in contexts that are already specific to C++CSP (i.e. the channel-ends have the ">>" and "<<" operators applied to them) I have not added them to the dictionary of functions.
  
This patch allows C++CSP to actually use the direction of channels to pass around channel-ends rather than channel pointers, just as C++CSP was designed for.
2007-08-22 22:27:04 +00:00
Neil Brown
63d18373b8 Changed tlpInterface to also return the direction of each channel, so that the (C++CSP) backend knows whether to pass it a whole channel, or just an end 2007-08-22 22:07:42 +00:00
Adam Sampson
36262fc55e Rework the mechanism that GenerateC uses to get externs from AnalyseAsm.
Neil spotted that I'd broken the C++CSP backend with these changes, and I
wasn't very happy with what I'd done anyway, so this is take 2. Now there's a
separate pass that runs before GenerateC which builds a set of functions used
in PARs.
2007-08-22 22:26:26 +00:00
Neil Brown
9e8dd73149 Fixed the C++CSP backend by allowing it to override the tock_support.h header file with tock_support_cppcsp.h (the latter includes the former, but only after defining some preprocessor directives) 2007-08-22 16:10:47 +00:00
Neil Brown
96f6bc39fd Added a signed 8-bit type and unsigned 16-,32- and 64-bit types to the AST, adjusting all other code accordingly
The types have been added to the AST.  Beyond the obvious trivial changes (extra cases in functions, etc), the only
significant change was that isSafeConversion needed to be changed.  I took the opportunity to totally rewrite the 
function into a graph-like mechanism rather than just using a list.  To demonstrate its correctness I also wrote an
exhaustive test for it.
2007-08-21 12:43:00 +00:00
Neil Brown
3b14eec036 Added direction specifiers and further attributes (such as whether the channel is shared) to the Chan type in the AST 2007-08-21 10:35:18 +00:00
Adam Sampson
c8d5a4ff40 Add licensing information.
The compiler itself is under the GPLv2+; the support code that gets built into
user programs is under the LGPLv2+. This matches the existing practice for the
KRoC project.

(As with Occade, I've used the new GPLv3-style license header in the source
files, though, since that avoids having to update the FSF's postal address.)
2007-08-18 20:42:11 +00:00
Neil Brown
feebea4473 Changed the AST to distinguish reading a timer from reading a channel 2007-08-13 16:26:03 +00:00
Neil Brown
00a617150e Improved time handling by using helper function 2007-08-06 22:36:23 +00:00
Neil Brown
0a0110d122 Added warning about unused binds to the compiler options
I have added my favourite compiler option "-fwarn-unused-binds" to the Makefile.  I've then changed GenerateCPPCSP to have one explicit export, and the
combination of the two would spot any future mistakes like not including the genAlt function in then GenOps structure (see previous patch).  This 
new warning option already spots one problem with GenerateC, and I have a feeling it will also be useful in future.
2007-08-06 20:33:48 +00:00
Neil Brown
5cfa79809b Added the cppgenAlt function to the GenOps (was missed out previously by accident) 2007-08-06 20:33:10 +00:00
Neil Brown
11928a327f Put genVariable' back in the C++CSP backend
It was my own fault of - I changed the genVariable' function in GenerateCPPCSP but forgot to move it out of the "taken verbatim from GenerateC" function,
so Adam removed it during the tidy-up.  I've reinstated it from the old version - I need the ".access()" part for accessing individual array elements.
2007-08-06 20:27:12 +00:00
Adam Sampson
432d406f26 Fix an oddity Neil flagged -- yes, there is a nicer syntax for updating structures 2007-08-01 23:08:21 +00:00
Adam Sampson
687f6a10f6 Make it possible to inherit operations from GenerateC in other backends.
... and update GenerateCPPCSP to do so. This works by having a structure of
operations (GenOps) through which all the recursive calls go, and having
GenerateCPPCSP replace only the operations that it wants to override.
2007-08-01 22:42:00 +00:00
Neil Brown
a72224728a Updated documentation regarding arrays 2007-07-31 21:27:51 +00:00
Neil Brown
231b3042ac Increased the stack size for processes, to be on the safe side 2007-07-31 21:24:10 +00:00
Neil Brown
a52d115060 Changed arrays to use vector/tockArrayView
Previously the arrays used the Blitz++ library, but this was not totally satisfactory.  I have therefore resorted (after looking at many different
libraries) to using std::vector (which could perhaps be boost::array instead) coupled with a roll-my-own "array view" class (tockArrayView) that
easily allows all the functionality that we need from arrays (slicing, indexing, copying, unknown dimensions,retyping,reshaping).  I have also
had to introduce a nasty little wrapper class tockBool, because vector<bool> is a specialisation that totally breaks things.  If I do move to
boost::array, I will be able to remove tockBool.
2007-07-31 21:19:52 +00:00
Neil Brown
935d69d544 C++CSP Backend Added
C++CSP backend has been added.  It consists of a support header file and one new Haskell module: GenerateCPPCSP

The module is largely based on GenerateC, changed as needed.  
There is a large section at the bottom of the file with verbatim copy-and-paste from GenerateC,
due to wanting the same functionality, but for calls to use my C++CSP generation not the C generation -- 
hence I cannot simply import those functions.

The backend can generate code for cgtests 0 through 16 (incl) that will compile as valid C++.  The majority of the
tests pass when run (some do segfault, admittedly).  However some arrays still need more testing/work, particularly:
- timers
- array slices
- retyping

The tock_support_cppcsp.h header makes use of tock_support.h, but I had to add a few #ifnders to the latter
file so that I can use it with C++CSP and block out some of the CIF stuff.
2007-07-26 21:11:01 +00:00