digraph G {
rankdir=LR;
compound=true;
node [shape=rect];
{% for node in nodes %}
{{ node }}
{% endfor %}
{% for edge in edges %}
{{ edge }}
{% endfor %}
}
{% macro Node(label, id, ports_exec=[], ports_data=[], debug = False) %}
subgraph cluster_{{ id }} {
label = "
{%- if debug %}
{{ id }}_
{%- endif -%}
{{ label }}"
style = rounded;
input_{{ id }} [
shape=rect;
label= {{ Gate_Table(ports_exec[0], ports_data[0]) }}
];
output_{{ id }} [
shape=rect;
label= {{ Gate_Table(ports_exec[1], ports_data[1]) }}
];
input_{{ id }}->output_{{ id }} [style=invis];
}
{%- endmacro %}
{%- macro Edge(from_id, to_id, from_gate, to_gate, prefix, color) %}
output_{{ from_id }}:{{ prefix }}_{{ from_gate }} -> input_{{ to_id }}:{{ prefix }}_{{ to_gate }} [color = {{ color }}]
{%- endmacro %}
{%- macro Gate_Table(ports_exec, ports_data) %}
<
{% if ports_exec or ports_data %}
{% if ports_exec %}
{% for port_e in ports_exec %}
| {{ port_e }} |
{% endfor %}
|
{% endif %}
{% if ports_data %}
{% for port_d in ports_data %}
| {{ port_d }} |
{% endfor %}
|
{% endif %}
{% else %}
| |
{% endif %}
>
{%- endmacro %}