|
Define ComponentName inputSignals | outputsignals ; DigitalCircuit1; DigitalCircuit2; .... .... Endef; |
Between the keywords Define and Endef, you write:
|
The mutliplexor circuit has:
|
Define MyMux i3 i2 i1 i0 c1 c0 | out; Not 7a c0 not_c0; Not 8a c1 not_c1; And 1c i3 c0 c1 out_3; And 2c i2 c0 not_c1 out_2; And 3c i1 not_c0 c1 out_1; And 4c i0 not_c0 not_c1 out_0; Or 3d out_3 out_2 out_1 out_0 out; Endef; |
The following diagram shows the signal names I used in the above macro definition:
Example:
Define MyMux i3 i2 i1 i0 c1 c0 | out; Not 7a c0 not_c0; Not 8a c1 not_c1; And 1c i3 c0 c1 out_3; And 2c i2 c0 not_c1 out_2; And 3c i1 not_c0 c1 out_1; And 4c i0 not_c0 not_c1 out_0; Or 3d out_3 out_2 out_1 out_0 out; Endef; /* ============================================================== Use MyMux in a EDiSim circuit ============================================================== */ Switch 4a sw0 '0' ZERO; Switch 3a sw1 '1' ZERO; Switch 2a sw2 '2' ZERO; Switch 1a sw3 '3' ZERO; Switch 7a sw4 '4' ZERO; Switch 8a sw5 '5' ZERO; MyMux 5c sw3 sw2 sw1 sw0 sw5 sw4 | or_out; Probe 3e or_out; |
|
|
Define MyMacro a b c a | z ; Or: Define MyMacro a b c d | a ; |