Programming Language CP

This page as PDF

The ConPro programming language provides generic imperative statements like branches and loops with additional true parallel programming features. The main execution object is a process.  Processes support data processing with strict sequential instruction behaviour. Concurrency is provided by (creation of) multiple processes executing in parallel on control path level and by bounded instruction blocks inside a process on data path level. Access of global shared resources is implemented with atomic guarded actions (mutual exclusion).
The programming language maps the communicating sequential processes model with atomic guarded actions to multiple finite-state machines with data and control path specifications on Register-Transfer level, providing input for hardware synthesis.

Data Types

Predefined ordinal data types DT:

Statement    Type DT    Description
int[N]     INT      Signed integer with data with of N bits
logic
logic[N]     LOGIC      Unsigned integer and logic vector (value set
{0, 1, Z, H, L}) with data width of N bits.
char     CHAR      Character

bool      BOOL      Boolean type (value set {true, false}.
value     VALUE      Untyped value (integer, logic, char, bool)
with data type and width assigned at compile
time (only used in constants)

Values

Values used in expressions with data content of registers, variables, and signals are associated with different ordinal data types DT depending on the value format.

Value         Type        Description
-1, 0, 1 ...  INT      Signed integer (decimal format)
0,1,2,3,4,... INT, LOGIC  Unsigned integer (decimal format)
0x1,0x2,...   INT, LOGIC  Unsigned integer or logic (hexadecimal
format: 0-9, A-F, a-f)
0b110,...     INT, LOGIC  Unsigned integer or unsigned logic value
(binary format: 0,1)
0l111,0lZZZ   LOGIC     Logic value (logic multi-value format;
0,1,L,H,Z)
’a’,’A’,...   CHAR      Character
"abc"     STRING      String (character array)
true, false   BOOL      Boolean value
nanosec,
microsec,
millisec, sec UNIT      Time unit (used with integer values)
hz, kilohz,
megahz,
gigahz      UNIT      Frequency unit (used with integer values)

Expressions and Assignments

Expressions are used in assignments, branches, function applications, and loops. There are arithmetic, relational, and boolean/logical operations. All operands of an expression must be of the same type. Explicit type conversion can be used only  to convert the data type of native objects (register, variable, signal).

Operator    Type                Description
+,-,*,/     INT, LOGIC, CHAR    Addition,Subtraction (Negation),
Multiplication, Division.
(CHAR: ASCII code)
< <= >
>= = <>     INT, LOGIC, CHAR    Lower than, lower equal than, greater
than, greate equal than, equal,
not equal.
and, or,
xor, not    BOOL      Boolean operators
land, lor,
lxor, lnot  INT, LOGIC, CHAR    Bitwise logical operators
@
a @  b @ .. LOGIC     Bitvector concatenation operator
~
V~B      INT     logB(V) (only in constant
definitions allowed)
lsl, lsr
obj lsx n   INT, LOGIC      Static and dynamic (non-constant
shift parameter n) shift operations.
Left hand operator must be an object
(register, variable, signal).
to_logic
to_int
to_char
to_bool     INT, BOOL, LOGIC,
CHAR      Type conversion (only applicable to
single objects)

Expression values can be assigned to data objects (register, variable, signal). 
Function application (only not recursive) is provided by the function name and an argument list, which can be empty (Def. 2). Arguments containing expressions are evaluated before function application. Function applications can be embedded in expressions.

LHS <- RHS;
x <- expr;
dst <- f(arg1,arg2,...);
dst <- f();
expr(f(...))
p(arg1,arg2,...);
p();

Data Objects

Sequential data processing requires storage objects (memory). There are registers and variables for data storage. A register is a single memory object mappable to CREW access behaviour, whereas a variable is bounded to a memory block (RAM) with EREW access behaviour. Additonal there is a signal object without any storage required for inter-connect of hardware components. Data objects are assigned to a specific data type.
There are data objects with local and global visibility (scope). Local objects can only be accessed by one process, whereas global objects can be accessed by multiple processes concurrently. Concurrent access of those global objects are resolved and serialized with a atomic guarded actions and a scheduler for each object.
Storage objects of structure type (registers and signals only) are splitted in a independent set of storage objects with each object associated with a structure element.

Statement         Data Type DT    
Description


reg R: DT;
reg R: DT[N];
reg R,S,...:DT;   INT, LOGIC, CHAR, BOOL, TYPE    
Creates a register storage object R of data type DT and optional data
width N (bits).

var V: DT;
var V: DT[N];
block B;
var V: DT in B;   INT, LOGIC, CHAR, BOOL, TYPE    
Creates a variable storage object V of data type DT and optional data
width N (bits). Variables are bounded in a RAM block, which can be
specified explicitly. RAM data cell width and number of cells are
determined at compile time.

sig S: DT;
sig S: DT[N];
sig S,T,...:DT;   INT, LOGIC, CHAR, BOOL, TYPE    
Creates a inter-connect signal object S of data type DT and optional
data width N (bits).

const C:
  DT := V;
const C:
  DT[N] := V;
const NC:
  value := V;    INT, LOGIC, CHAR, BOOL, VALUE    
Creates a constant  object C with value V of data type DT (or generic
VALUE) and optional data width N (bits).

xx