Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision Next revision Both sides next revision | ||
language:interface [2021/11/21 12:41] rajit created |
language:interface [2023/04/09 18:56] rajit [Interfaces] |
||
---|---|---|---|
Line 1: | Line 1: | ||
===== Constructors for Types ===== | ===== Constructors for Types ===== | ||
- | **XXX: this section | + | There are cases when it is useful to be able to build more complex types |
+ | from existing types. ACT provides a mechanism to do so via interfaces and | ||
+ | parameter types. | ||
+ | |||
+ | ==== Interfaces ==== | ||
+ | |||
+ | An interface is defined in the following way: | ||
+ | <code act> | ||
+ | interface linearchain (bool? in; bool! out); | ||
+ | </ | ||
+ | This defines '' | ||
+ | |||
+ | Any process can export a list of interfaces. | ||
+ | When a process exports an interface, it means that it has I/O ports that correspond to the names in the interface. | ||
+ | The port names within the process need not match the port names in the interface; when an interface is exported, a mapping must be provided as part of the interface export specification. | ||
+ | |||
+ | <code act> | ||
+ | defproc proc1 (bool? a; bool! b) :> linearchain { in -> a, out -> b } | ||
+ | { | ||
+ | ... | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | In this definition, '' | ||
+ | |||
+ | ==== Parameter types ==== | ||
+ | |||
+ | **Needs to be updated** | ||
The special '' | The special '' | ||
Line 8: | Line 35: | ||
'' | '' | ||
- | < | + | < |
ptype(foo) x; | ptype(foo) x; | ||
</ | </ | ||
Line 14: | Line 41: | ||
This says that '' | This says that '' | ||
constraint that '' | constraint that '' | ||
- | '' | + | interface |
- | operations supported by type '' | + | ports corresponding to interface |
'' | '' | ||
following example: | following example: | ||
- | < | + | < |
// A constructor for a datapath with W-bit ripple connections, | // A constructor for a datapath with W-bit ripple connections, | ||
// where each component has M inputs and one output | // where each component has M inputs and one output | ||
Line 59: | Line 86: | ||
} | } | ||
</ | </ | ||
- | |||
- | |||