Control Input Terminals

NSL uses control input terminals to recieve control message from other modules. Control input terminals are declared with 'func_in'. We can refer and invoke associate behavior with the terminal.

Example-NS10

declare NS10 { input a,b; output f; func_in exec_and(); func_in exec_or(); func_in exec_xor(); } module NS10 { func exec_and { f = a & b; } func exec_or { f = a | b; } func exec_xor { f = a ^ b; } }



We will make a simulation on this circuitry as following command:

# ./exe NS10



The result will be available on your console.



AND: a:0, b:0, f:0 AND: a:0, b:1, f:0 AND: a:1, b:0, f:0 AND: a:1, b:1, f:1 OR: a:0, b:0, f:0 OR: a:0, b:1, f:1 OR: a:1, b:0, f:1 OR: a:1, b:1, f:1 XOR: a:0, b:0, f:0 XOR: a:0, b:1, f:1 XOR: a:1, b:0, f:1 XOR: a:1, b:1, f:0

A control input terminal is a single bit signal, but associated behavior can operate on any width data as following example.

Example-NS11

declare NS11 { input a[8],b[8]; output f[8]; func_in exec_add(a,b); } module NS11 { func exec_add { f = a + b; } }



We will make a simulation on this circuitry as following command:

# ./exe NS11



The result will be available on your console.



a:129, b: 36, f:165 a: 99, b: 9, f:108 a:141, b: 13, f:154 a: 18, b:101, f:119





PREV UP NEXT