Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Last revision Both sides next revision
language:connections [2022/05/13 08:44]
rajit
language:connections [2023/04/09 19:10]
rajit [Simple connections]
Line 76: Line 76:
 parameter variables as //immutable types//---they can only be parameter variables as //immutable types//---they can only be
 defined once. defined once.
 +
 +===== Assertions =====
 +
 +Sometimes it is useful to be able to check that a parameter (or an expression of parameters) has a reasonable 
 +value. To express this, ACT supports explicit assertions. We use Hoare's syntax for assertions, so the assertion that 
 +''x'' must be ''8'' would be written
 +<code act>
 +{x=8};
 +</code>
 +If a more meaningful message is required, the following syntax is also supported:
 +<code act>
 +{x=8 : "This assertion failed"};
 +</code>
 +which also reports the message specified when the assertion failed.
 +
 +During circuit development/debugging, it may be helpful to assert that two signals are connected to each
 +other or in fact disconnected from each other at a particular point during circuit construction. To assert that ''a'' is connected to ''b'', use:
 +<code act>
 +bool a;
 +bool b;
 +
 +{ a !== b : "a and b are connected connected!" };  // this will pass
 +a = b;
 +{ a === b : "a and b are not connected!" }; // this will pass
 +{ a !== b : "a and b are connected connected!" };  // this will fail
 +</code>
 +
 +The operators ''==='' and ''!=='' are used to check that the two signals are connected or disconnected at the point the  assertion was encountered during circuit construction.
  
 ===== Array and subrange connections ===== ===== Array and subrange connections =====