schedule_dot.j2 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. digraph G {
  2. rankdir=LR;
  3. compound=true;
  4. node [shape=rect];
  5. {% for node in nodes %}
  6. {{ node }}
  7. {% endfor %}
  8. {% for edge in edges %}
  9. {{ edge }}
  10. {% endfor %}
  11. }
  12. {% macro Node(label, id, ports_exec=[], ports_data=[], debug = False) %}
  13. subgraph cluster_{{ id }} {
  14. label = "
  15. {%- if debug %}
  16. {{ id }}_
  17. {%- endif -%}
  18. {{ label }}"
  19. style = rounded;
  20. input_{{ id }} [
  21. shape=rect;
  22. label= {{ Gate_Table(ports_exec[0], ports_data[0]) }}
  23. ];
  24. output_{{ id }} [
  25. shape=rect;
  26. label= {{ Gate_Table(ports_exec[1], ports_data[1]) }}
  27. ];
  28. input_{{ id }}->output_{{ id }} [style=invis];
  29. }
  30. {%- endmacro %}
  31. {%- macro Edge(from_id, to_id, from_gate, to_gate, prefix, color) %}
  32. output_{{ from_id }}:{{ prefix }}_{{ from_gate }} -> input_{{ to_id }}:{{ prefix }}_{{ to_gate }} [color = {{ color }}]
  33. {%- endmacro %}
  34. {%- macro Gate_Table(ports_exec, ports_data) %}
  35. <<TABLE BORDER="0" CELLBORDER="0" CELLSPACING="0">
  36. {% if ports_exec or ports_data %}
  37. {% if ports_exec %}
  38. <TR><TD>
  39. <TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0" COLOR="darkblue">
  40. {% for port_e in ports_exec %}
  41. <TR><TD PORT="e_{{ port_e }}">{{ port_e }}</TD></TR>
  42. {% endfor %}
  43. </TABLE>
  44. </TD></TR>
  45. {% endif %}
  46. {% if ports_data %}
  47. <TR><TD>
  48. <TABLE BORDER="1" CELLBORDER="1" CELLSPACING="0" COLOR="green">
  49. {% for port_d in ports_data %}
  50. <TR><TD PORT="d_{{ port_d }}">{{ port_d }}</TD></TR>
  51. {% endfor %}
  52. </TABLE>
  53. </TD></TR>
  54. {% endif %}
  55. {% else %}
  56. <TR><TD>&nbsp;</TD></TR>
  57. {% endif %}
  58. </TABLE>>
  59. {%- endmacro %}