Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
language:expressions [2022/07/22 15:13]
rajit [Functions]
language:expressions [2022/12/13 10:03]
rajit [External Functions]
Line 91: Line 91:
 The first kind of function is typically used when constructing the circuit, and its value can be statically computed during the circuit construction phase. The second kind of function is viewed as CHP, and can be implemented either by inlining the function or through some other approach (e.g. shared, partially shared, etc). The first kind of function is typically used when constructing the circuit, and its value can be statically computed during the circuit construction phase. The second kind of function is viewed as CHP, and can be implemented either by inlining the function or through some other approach (e.g. shared, partially shared, etc).
  
-For example, the following function that takes an ''int<8>'' argument  can be called in the CHP sub-language:+For example, the following function that takes an ''int<8>'' argument  can be called from the CHP sub-language:
 <code act> <code act>
 /* look at the MSB to determine if this is a negative 2's complement integer */ /* look at the MSB to determine if this is a negative 2's complement integer */
Line 97: Line 97:
 { {
   chp {   chp {
-    self := bool(x{7});+    self := bool(x{7})
   }   }
 } }
 </code> </code>
 +
 +===== External Functions =====
 +
 +ACT is a hardware description language. However, especially when simulating a design, it is useful to be able to have additional functionality that goes beyond the circuit that is implemented. For example, a designer may want to test a CHP program by providing it inputs from a test suite that is contained in a file. To do so would require providing an I/O library for ACT. Similarly there may be other additional features one might want for simulation purposes. 
 +
 +Instead of providing specific solutions to a large number of potential use cases, ACT provides a single generic mechanism: the ability to call an //external// function. An external function is one that is not defined within the ACT language itself, but is rather defined in the C programming language. The C function must be compiled into a shared object library that is loaded by ACT during run-time.
 +