Skip to content

Commit c2727ab

Browse files
Merge pull request #2 from IntelLabs/initial-release
Initial release
2 parents dc5b13d + 8bd32cf commit c2727ab

File tree

4 files changed

+64
-16
lines changed

4 files changed

+64
-16
lines changed

async-toolkit/applications.design-automation.memory.lamb/.gitmodules

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 0 additions & 1 deletion
This file was deleted.

async-toolkit/m3utils/csp/doc/csp/csp.tex

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
Mika Nystr\"om \\
6666
Neuromorphic Computing Laboratory \\
6767
Intel Corporation}
68-
\date{Version 0.0\\
68+
\date{DRAFT Version 0.1\\
6969
\today}
7070

7171
\begin{document}
@@ -585,6 +585,14 @@ \section{Acknowledgments}
585585
borrowed from the Asynchronous Circuit Toolkit (ACT) of Rajit
586586
Manohar's group at Yale.
587587

588+
Thanks are due to Andrew Lines, and Rajit Manohar for reviewing the
589+
early versions of the manuscript, and to Paul Katz, who suggested a
590+
multitude of changes to make the report more accessible to those with
591+
less prior exposure to CSP. Harry Liu helped at every turn by
592+
answering every possible and some impossible questions about the
593+
language.
594+
595+
588596
\chapter{Language Definition}
589597
% ========================================
590598
% DEFINITIONS
@@ -758,7 +766,8 @@ \subsection{Array types}\label{sec:array-types}
758766
its elements; the shape of a non-array is the empty sequence.
759767
The {\em layout\/} of a multi-dimensional array is the sequence of
760768
its lengths and starting indexes in each dimension; the layout of a non-array
761-
is the empty sequence.
769+
is the empty sequence. The {\em rank\/} of a multi-dimensional array
770+
is the number of indexes of the array.
762771

763772
All arrays are {\em fixed\/} in CSP, meaning that the layout of every array is
764773
determined before program startup.
@@ -927,8 +936,11 @@ \section{Functions}
927936

928937
\item \verb!Name! is an identifier that names the parameter.
929938

930-
\item \verb!Layout! specifies the array layout for an array parameter; if it is
931-
omitted, the parameter is scalar.
939+
\item \verb!Layout! specifies the array layout for an array parameter;
940+
if it is omitted, the parameter is scalar. If the layout is
941+
specified, only the rank is significant. That is, the starting and
942+
ending indexes of each dimension are ignored, and the actual layout of
943+
the array is copied from the caller.
932944

933945
\item\verb!Initial! specifies the initial value of a scalar parameter whose mode is \verb!+!. \verb!= Initial! can be omitted.
934946
\end{itemize}
@@ -1163,7 +1175,7 @@ \subsection{Function call}\label{sec:funccall}
11631175
left-to-right,
11641176
\begin{itemize}
11651177

1166-
\item the formal parameters are assigned (the prolog)
1178+
\item the formal parameters are declared (at which time the layout of any array parameter is copied from the caller) and assigned (the prolog)
11671179

11681180
\item the body of the procedure is executed
11691181

@@ -1629,12 +1641,17 @@ \subsubsection{Bit access}
16291641
\begin{Verbatim}[samepage=true]
16301642
e { Range }
16311643
\end{Verbatim}
1632-
where \verb!Range! is a range \verb!Hi : Lo! where \verb!Hi! and \verb!Lo!
1633-
are of type \verb!int!, or a single number \verb!k!, which is interpreted as
1634-
\verb!k : k!. If the range is empty (that is, if $\verb!Hi! < \verb!Lo!$) then, the value of the expression is zero.
1635-
The bit-access expression is a designator if \verb!e! is a designator; it is
1636-
a writable designator if \verb!e! is a writable designator. The type of
1637-
\verb!e { Range }! is \verb!uint(Hi - Lo + 1)!.
1644+
where \verb!Range! is a range \verb!Hi : Lo! where \verb!Hi! and
1645+
\verb!Lo! are of type \verb!int!, or a single number \verb!k!, which
1646+
is interpreted as \verb!k : k!. If the range is empty (that is, if
1647+
$\verb!Hi! < \verb!Lo!$) then, the value of the expression is zero.
1648+
The bit-access expression is a designator if \verb!e! is a designator;
1649+
it is a writable designator if \verb!e! is a writable designator. The
1650+
type of \verb!e { Range }! is \verb!uint(Hi - Lo + 1)!. The value of
1651+
\verb!e {Range }! is the referenced bits of the two's-complement
1652+
representation of \verb!e!. In particular, the high-order bits of a
1653+
positive \verb!e! will be zero, whereas the high-order bits of a
1654+
negative \verb!e! will be one.
16381655

16391656

16401657
\subsubsection{Array access}
@@ -1665,6 +1682,9 @@ \subsubsection{Array access}
16651682
declare arrays: this implies that ``partial array slices'' are not
16661683
available in CSP.
16671684

1685+
It is a checked runtime error to activate the access of an array outside of
1686+
the declared bounds of the array, but it is not a static error to do so.
1687+
16681688
\subsubsection{Struct field access}\label{sec:struct-field-access}
16691689
If \verb!e! is a struct, the expression
16701690
\begin{Verbatim}[samepage=true]
@@ -1673,7 +1693,7 @@ \subsubsection{Struct field access}\label{sec:struct-field-access}
16731693
where \verb!Field! names a field of the structure type of \verb!e!, denotes
16741694
the value of the corresponding field. The struct-access expression is a designator if \verb!e! is a designator; it is
16751695
a writable designator if \verb!e! is a writable designator. The type of
1676-
\verb! e :: Field! is the declared type of the field.
1696+
\verb! e :: Field! is the declared type of the field.
16771697

16781698

16791699
\subsection{Arithmetic and string operators}

async-toolkit/m3utils/csp/simplecsp/cast/arrays2.cast

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,35 @@ define P()() <+ common
5353
}
5454
}
5555

56+
define Q()()
57+
{
58+
59+
csp {
60+
61+
function f(int -n; string -a[0..-1 ]) : string =
62+
(string s = "";
63+
<;i:n: s = s + "a[" + i + "] = " + a[i] + " ">;
64+
f = s;
65+
);
66+
67+
function g(int -m,-n; string -a[0..0,0..0]) : string =
68+
(string s = "";
69+
<;i:m:<;j:n: s = s + "a[" + i + "," + j + "] = " + a[i,j] + " " >; s = s + "\n" >;
70+
g = s;
71+
);
72+
73+
string x[X,Y];
74+
75+
<;i:X: <;j:Y: x[i,j] = " cell[" + i + "," + j + "]">>;
76+
77+
<;i : X:
78+
print(f(Y, x[i]));
79+
>;
80+
81+
print(g(X, Y, x));
82+
83+
#[false -> x[999,999] = ""];
84+
85+
}
86+
}
87+

0 commit comments

Comments
 (0)