any block

NSL uses 'any' block syntax for conditional behavior activation. The 'any' bock does not have priority. All the behavior which matches the condition will be activated in parallel. The syntax of 'any' block is:


  any {

     condition1: behavior description 1

     condition2: behavior description 2

    .... as may description as you like ....

     else: behavior description for otherwise



The 'else' condition is optional.



declare NS07 { input a,b; input c,d; output f; } module NS07 { any { c: f = a & b; d: f = a ^ b; } }

This example uses IO definitions and core behavior description. Two behavioral operations will be activated conditionally in the core behavior description.

It is an easy operation and you may image the result. We will make a simulation on this circuitry as following command:

# ./exe NS07


The result will be available on your console.


a:0, b:0, c:0, d:0, f:x a:1, b:0, c:0, d:0, f:x a:0, b:1, c:0, d:0, f:x a:1, b:1, c:0, d:0, f:x a:0, b:0, c:1, d:0, f:0 a:1, b:0, c:1, d:0, f:0 a:0, b:1, c:1, d:0, f:0 a:1, b:1, c:1, d:0, f:1 a:0, b:0, c:0, d:1, f:0 a:1, b:0, c:0, d:1, f:1 a:0, b:1, c:0, d:1, f:1 a:1, b:1, c:0, d:1, f:0 a:0, b:0, c:1, d:1, f:x a:1, b:0, c:1, d:1, f:x a:0, b:1, c:1, d:1, f:x a:1, b:1, c:1, d:1, f:x