Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
language:connections [2019/04/18 14:17] rajit [Port connections] |
language:connections [2023/04/09 19:13] (current) rajit [Assertions] |
||
---|---|---|---|
Line 14: | Line 14: | ||
variables of type '' | variables of type '' | ||
- | < | + | < |
bool x, y; | bool x, y; | ||
x=y; | x=y; | ||
Line 27: | Line 27: | ||
parameters. | parameters. | ||
- | < | + | < |
pint x, y; | pint x, y; | ||
x=5; | x=5; | ||
Line 36: | Line 36: | ||
meta-language variables is not symmetric, as illustrated below. | meta-language variables is not symmetric, as illustrated below. | ||
- | < | + | < |
pint x, y; | pint x, y; | ||
x=5; | x=5; | ||
x=y*1+2; | x=y*1+2; | ||
+ | </ | ||
+ | < | ||
-[ERROR]-> | -[ERROR]-> | ||
| | ||
Line 49: | Line 51: | ||
meta-language variable assignments. | meta-language variable assignments. | ||
- | < | + | < |
pint x; | pint x; | ||
x=5; | x=5; | ||
x=8; | x=8; | ||
+ | </ | ||
+ | < | ||
-[ERROR]-> | -[ERROR]-> | ||
| | ||
Line 72: | Line 76: | ||
parameter variables as //immutable types// | parameter variables as //immutable types// | ||
defined once. | defined once. | ||
+ | |||
===== Array and subrange connections ===== | ===== Array and subrange connections ===== | ||
Line 82: | Line 87: | ||
nodes '' | nodes '' | ||
- | < | + | < |
bool x[10]; | bool x[10]; | ||
bool y[10..19]; | bool y[10..19]; | ||
Line 90: | Line 95: | ||
Connecting two arrays of differing sizes is an error. | Connecting two arrays of differing sizes is an error. | ||
- | < | + | < |
bool x[10]; | bool x[10]; | ||
bool y[10..20]; | bool y[10..20]; | ||
x=y; | x=y; | ||
+ | </ | ||
+ | < | ||
-[ERROR]-> | -[ERROR]-> | ||
LHS: bool[10] | LHS: bool[10] | ||
Line 106: | Line 113: | ||
'' | '' | ||
- | < | + | < |
x[3..7] = y[12..16]; | x[3..7] = y[12..16]; | ||
</ | </ | ||
Line 125: | Line 132: | ||
so on. | so on. | ||
- | < | + | < |
bool x[3..4][5..6]; | bool x[3..4][5..6]; | ||
bool y[2][2]; | bool y[2][2]; | ||
Line 134: | Line 141: | ||
become aliases for each other. So while the connection statement | become aliases for each other. So while the connection statement | ||
- | < | + | < |
x[3..4][5..6] = y[0..1][0..1]; | x[3..4][5..6] = y[0..1][0..1]; | ||
</ | </ | ||
Line 143: | Line 150: | ||
visible in the case of sparse arrays. | visible in the case of sparse arrays. | ||
- | < | + | < |
bool x[3..4][5..6]; | bool x[3..4][5..6]; | ||
bool y[2][2]; | bool y[2][2]; | ||
x = y; | x = y; | ||
bool x[5..5][5..5]; | bool x[5..5][5..5]; | ||
+ | </ | ||
+ | < | ||
-[ERROR]-> | -[ERROR]-> | ||
Type: bool[ [3..4][5..6]+[5..5][5..5] ] | Type: bool[ [3..4][5..6]+[5..5][5..5] ] | ||
Line 177: | Line 186: | ||
it in braces. | it in braces. | ||
- | < | + | < |
bool x[3]; | bool x[3]; | ||
bool x0,x1,x2; | bool x0,x1,x2; | ||
Line 197: | Line 206: | ||
(excluding the left-most dimension). | (excluding the left-most dimension). | ||
- | < | + | < |
bool x[5]; | bool x[5]; | ||
bool y[3]; | bool y[3]; | ||
Line 211: | Line 220: | ||
list of lower dimensional arrays enclosed in braces. | list of lower dimensional arrays enclosed in braces. | ||
- | < | + | < |
bool x[2]; | bool x[2]; | ||
bool y[2]; | bool y[2]; | ||
Line 230: | Line 239: | ||
row and one column from a two-dimensional array. | row and one column from a two-dimensional array. | ||
- | < | + | < |
bool row[4], | bool row[4], | ||
bool y[4][4]; | bool y[4][4]; | ||
Line 241: | Line 250: | ||
following is a valid connection statement: | following is a valid connection statement: | ||
- | < | + | < |
bool a[2][4]; | bool a[2][4]; | ||
bool b[4..4][4..7]; | bool b[4..4][4..7]; | ||
Line 268: | Line 277: | ||
implements an '' | implements an '' | ||
- | < | + | < |
int< | int< | ||
d1of2 y; | d1of2 y; | ||
Line 289: | Line 298: | ||
recommended one. It is only being used to illusrate how connections behave.) | recommended one. It is only being used to illusrate how connections behave.) | ||
- | < | + | < |
chp { | chp { | ||
x:=1; | x:=1; | ||
Line 306: | Line 315: | ||
code. Consider the following scenario: | code. Consider the following scenario: | ||
- | < | + | < |
int< | int< | ||
d1of4 x; | d1of4 x; | ||
Line 328: | Line 337: | ||
situation, where '' | situation, where '' | ||
- | < | + | < |
foo f1; | foo f1; | ||
bar b1; | bar b1; | ||
Line 354: | Line 363: | ||
mechanism akin to parameter passing. | mechanism akin to parameter passing. | ||
- | < | + | < |
defproc dualrail (bool d0, d1, a) | defproc dualrail (bool d0, d1, a) | ||
{ | { | ||
Line 371: | Line 380: | ||
connects '' | connects '' | ||
- | < | + | < |
dualrail c(,d1,); | dualrail c(,d1,); | ||
</ | </ | ||
Line 382: | Line 391: | ||
one we just saw. | one we just saw. | ||
- | < | + | < |
dualrail c; | dualrail c; | ||
Line 392: | Line 401: | ||
example, consider the following scenario: | example, consider the following scenario: | ||
- | < | + | < |
dualrail c[4]; | dualrail c[4]; | ||
bool d1[4]; | bool d1[4]; | ||
Line 404: | Line 413: | ||
we can instead use the following syntax. | we can instead use the following syntax. | ||
- | < | + | < |
bool d1; | bool d1; | ||
dualrail c(.d1=d1); | dualrail c(.d1=d1); |