alt block

NSL uses 'alt' block syntax for conditional behavior activation. The 'alt' bock has priority; higher priority for upper description. The syntax of 'alt' block is:

alt {

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 NS06 { input a,b; input c,d; output f; } module NS06 { alt { 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 NS06

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:0 a:1, b:0, c:1, d:1, f:0 a:0, b:1, c:1, d:1, f:0 a:1, b:1, c:1, d:1, f:1