Defining a new component

Syntax:
Define name input_signals | output_signals;
    ...
    ...
    ...
Endef;

Parameters:
name - name of the self-defined component.
input_signals - input signals of the self-defined component.
output_signals - output signals of the self-defined component.

Using a new component

Syntax:
name coord input_signals | output_signals;

Parameters:
coord - coordinate of the component.
name - name of the self-defined component.
input_signals - input signals of the self-defined component.
output_signals - output signals of the self-defined component.

Example

Example 1:
Define my_component a b c d | z;
    And bb a b x;
    And bb c d y;
    Or bb x y z;
Endef;
Switch aa in0 '1' ZERO;
Switch ba in1 '2' ZERO;
Switch ca in2 '3' ZERO;
Switch da in3 '4' ZERO;
my_component bb in0 in1 in2 in3 | out;
Probe ce out;

Example 2:
Define my_component a b c[1..0] | z;
    And bb a b x;
    And bb c y;
    Or bb x y z;
Endef;
Switch aa in[2] '0' ZERO;
Switch ba in[1] '1' ZERO;
Switch ca in[0] '2' ZERO;
Switch da in2 '3' ZERO;
Switch ea in3 '4' ZERO;
my_component bb in2 in3 in[2..1] | out;
Probe ce out;

Example 3:
Define my_component a[3..0] | z;
    And bb a[3] a[2] x;
    And bb a[1] a[0] y;
    Or bb x y z;
Endef;
Switch ba in[1] '1' ZERO;
Switch ca in[0] '2' ZERO;
Switch ca in2 '3' ZERO;
Switch da in3 '4' ZERO;
my_component bb in3 in2 in[1..0] | out;
Probe ce out;

Example 4:
Define my_component a[3..0] | z;
    And bb a[3] a[2] x;
    And bb a[1] a[0] y;
    Or bb x y z;
Endef;
Switch ba in[1] '1' ZERO;
Switch ca in[0] '2' ZERO;
Switch ca in2 '3' ZERO;
Switch da in3 '4' ZERO;
my_component bb (in3 in2 in[1] in[0]) | out;
Probe ce out;