ANML Documentation

Simple Automaton Using a Macro

This section provides an example for building an ANML macro.

<macro-definition id="m3" name="simplemacro">
        <port type="in" id="in_dec_1"/>
        <port type="out" id="out_dec_1"/>
        <port type="out" id="out_dec_2"/>
        <port type="report" id="report_dec_1"/>

        <port-in id="in_dec_1"> 
            <activate-on-event element="ste_1"/>
            <activate-on-event element="ste_2"/>
            <activate-on-event element="ste_3"/>
        <port-out id="out_dec_1">
            <activate-from-event element="ste_1"/>
        <port-out id="out_dec_2">
            <activate-from-event element="ste_2"/>
        <report-alias id="report_dec_1" element="ste_1"/>
        <report-alias id="report_dec_1" element="ste_2"/>

<state-transition-element id="ste_1" symbol-set="A">

<state-transition-element id="ste_2" symbol-set="B">

<state-transition-element id="ste_3" symbol-set="C">


The macro functions accordingly:

  1. The <header> <interface-declarations> statement creates five ports:
    • a single input port: in_dec_1
    • two output ports: out_dec_1 and out_dec_2
    • a single report port: report_dec_1
  2. The <port-definitions> section connects the ports to resources located within the macro.
  3. The input <port-in> in_dec_1 connects to all three STEs.
  4. STE 1 is connected to the output port out_dec_1.
  5. STE 2 is connected to the output port out_dec_2.
  6. Both STEs 1 and 2 are connected to the report port report_dec_1`.
  7. STE 3 reports on match, but it is not connected to any report port; therefore, if it generates a report event, this event will propagate up as a report associated with the top-most macro reference that uses this macro.
Figure 1. Example Macro (AP Workbench)
Macro example 1