Next: , Up: Built-in datatypes


7.1.1 Booleans

In the nonmeta language, assigning a pbool value to a bool is common and legal. The compiler should eventually resolve all meta-parameter values to constants, which would result in assigning a boolean constant to a bool data instance.

In the following example, the constant<true> and constant<false> types would unroll as one-time assignments to different values. (See CHP, for the description of the CHP language.)

     template <pbool B>
     defproc constant(bool b) {
       chp { b := B }
     }

Nonmeta operators: e.g. in CHP.

Defect: Currently bool is overloaded to mean different things in different contexts. It is (tentatively) both a physical type representing a single node or net, and abstract data type representing a boolean value (whose implementation may be multi-node, such as dual-rail.) In a data type context, bool is synonymous with int<1>. There is an ambiguity with ‘defproc foo(bool b) {...}’, where it is not known without additional context whether bool refers to the physical type or the data type. Until implementation-interface semantics are better defined and implemented, we must allow CHP to manipulate physical bools directly. Eventually, we would like an unambiguous use of bool, which may require introducing a typedef for int<1>, such as dbool, either built-in or library-defined.