2013-12-06 14:11:41 +00:00
|
|
|
|
|
|
|
digraph heron {
|
|
|
|
//node [shape=circle,regular=1,style=filled,fillcolor=white];
|
|
|
|
edge [arrowhead=odot];
|
2013-12-13 09:36:19 +00:00
|
|
|
graph [overlap=scale];
|
2013-12-06 14:11:41 +00:00
|
|
|
subgraph {
|
|
|
|
edge [weight=3];
|
2014-01-02 12:01:07 +00:00
|
|
|
C0 -> C1 -> C2 -> C3 -> C4 -> C5 -> C6 -> C7 -> C8 -> C9 -> C10 [minlen=3];
|
2013-12-06 14:11:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// variables & constants
|
|
|
|
mem_0 [label="mem[0]"];
|
|
|
|
mem_i [label="mem[i]"];
|
2013-12-13 09:36:19 +00:00
|
|
|
mem_i2 [label="mem[i]",shape="box"];
|
|
|
|
i [label="i"];
|
2013-12-06 14:11:41 +00:00
|
|
|
"1c" [label="1" ];
|
|
|
|
"1d" [label="1" ];
|
|
|
|
Finish [label="Finish"];
|
|
|
|
|
|
|
|
// operands
|
2014-01-02 12:01:07 +00:00
|
|
|
s_shift_1 [label=">> 1",];
|
2013-12-13 09:36:19 +00:00
|
|
|
i_lt_0 [label=">",];
|
2013-12-06 14:11:41 +00:00
|
|
|
|
|
|
|
// i <= mem[0]
|
2013-12-13 09:36:19 +00:00
|
|
|
mem_0 -> i:n [label="C0",style=dotted];
|
|
|
|
|
|
|
|
0 -> i_lt_0;
|
|
|
|
i -> i_lt_0;
|
|
|
|
{ rank=same; C0; i}
|
|
|
|
{ rank=same; C1; i_lt_0; }
|
2013-12-06 14:11:41 +00:00
|
|
|
|
|
|
|
// if (i <= mem[0]) ->
|
2013-12-13 09:36:19 +00:00
|
|
|
i_lt_0 -> mem_s_gte_1 [style=dotted, arrowhead=normal,label="True"];
|
2013-12-06 14:11:41 +00:00
|
|
|
// else
|
2013-12-13 09:36:19 +00:00
|
|
|
i_lt_0 -> Finish [style=dotted, arrowhead=normal,label="False"];
|
2014-01-02 12:01:07 +00:00
|
|
|
{ rank=same; C10; Finish;}
|
2013-12-06 14:11:41 +00:00
|
|
|
|
2013-12-13 09:36:19 +00:00
|
|
|
subgraph i_lt_0 {
|
2013-12-06 14:11:41 +00:00
|
|
|
mem_s_gte_1 [label=">"];
|
|
|
|
|
|
|
|
s_div_x [label="/",];
|
|
|
|
new_x [label="+",];
|
2014-01-02 12:01:07 +00:00
|
|
|
s_div_x_shift_1 [label=">> 1",];
|
|
|
|
x_shift_1 [label=">> 1",];
|
2013-12-13 09:36:19 +00:00
|
|
|
old_x_lte_new_x [label=">=",];
|
|
|
|
dec_i [label="-",];
|
2014-01-02 12:01:07 +00:00
|
|
|
comma_fix [label="<< Kommastellen/2"];
|
2013-12-06 14:11:41 +00:00
|
|
|
|
|
|
|
// (s > 1)
|
|
|
|
mem_i -> mem_s_gte_1;
|
|
|
|
"1d" -> mem_s_gte_1;
|
|
|
|
{ rank=same; C2; mem_s_gte_1}
|
|
|
|
|
|
|
|
// if (s > 1)
|
|
|
|
mem_s_gte_1 -> s_shift_1 [style=dotted,arrowhead=normal,label="True"];
|
|
|
|
// else
|
2014-01-02 12:01:07 +00:00
|
|
|
mem_s_gte_1 -> comma_fix [style=dotted,arrowhead=normal,label="False"];
|
2013-12-06 14:11:41 +00:00
|
|
|
|
|
|
|
subgraph if_mem_i_gte_1 {
|
|
|
|
// x = s >> 1
|
|
|
|
mem_i -> s_shift_1;
|
2013-12-13 09:36:19 +00:00
|
|
|
s_shift_1 -> x [style=dotted,arrowhead=normal,label="C2->C3"];
|
2013-12-06 14:11:41 +00:00
|
|
|
{ rank=same; C3; s_shift_1; x}
|
|
|
|
|
|
|
|
// (x >> 1)
|
2013-12-13 09:36:19 +00:00
|
|
|
x [shape="box"];
|
2013-12-06 14:11:41 +00:00
|
|
|
x -> x_shift_1;
|
|
|
|
// (s/x)
|
2014-01-02 12:01:07 +00:00
|
|
|
mem_i:ne -> s_div_x:ne;
|
|
|
|
x -> s_div_x:nw;
|
2013-12-06 14:11:41 +00:00
|
|
|
{ rank=same; C4; x_shift_1; s_div_x}
|
|
|
|
|
|
|
|
// ((s/x) >> 1)
|
|
|
|
s_div_x -> s_div_x_shift_1;
|
|
|
|
{ rank=same; C5; s_div_x_shift_1}
|
|
|
|
|
|
|
|
// (x >> 1) + ((s/x) >> 1);
|
|
|
|
x_shift_1 -> new_x;
|
|
|
|
s_div_x_shift_1 -> new_x;
|
|
|
|
{ rank=same; C6; new_x;}
|
|
|
|
|
|
|
|
// (old_x <= X)
|
|
|
|
x -> old_x_lte_new_x;
|
|
|
|
new_x -> old_x_lte_new_x;
|
2014-01-02 12:01:07 +00:00
|
|
|
new_x -> x [style=dotted,label="C7->C3 || C7->C8"];
|
2013-12-06 14:11:41 +00:00
|
|
|
|
2014-01-02 12:01:07 +00:00
|
|
|
x_2 [shape="box" label="x"];
|
2013-12-06 14:11:41 +00:00
|
|
|
{ rank=same; C7; old_x_lte_new_x;}
|
|
|
|
|
2014-01-02 12:01:07 +00:00
|
|
|
x_2 -> comma_fix;
|
|
|
|
{ rank=same; C8; comma_fix x_2}
|
|
|
|
|
2013-12-06 14:11:41 +00:00
|
|
|
// if (old_x <= X)
|
2014-01-02 12:01:07 +00:00
|
|
|
old_x_lte_new_x -> comma_fix [style=dotted,arrowhead=normal,label="True"];
|
2013-12-06 14:11:41 +00:00
|
|
|
// else
|
2013-12-13 09:36:19 +00:00
|
|
|
old_x_lte_new_x -> x [style=dotted,arrowhead=normal,label="False"];
|
2013-12-06 14:11:41 +00:00
|
|
|
|
2014-01-02 12:01:07 +00:00
|
|
|
comma_fix -> mem_i2 [label="C7->C8", style=dotted];
|
|
|
|
comma_fix -> dec_i [style=dotted, arrowhead=normal, label="True"];
|
|
|
|
|
2013-12-13 09:36:19 +00:00
|
|
|
"1c" -> dec_i;
|
|
|
|
i -> dec_i:ne;
|
|
|
|
dec_i:s -> i:s;
|
2014-01-02 12:01:07 +00:00
|
|
|
{ rank=same; C9; dec_i; mem_i2};
|
2013-12-06 14:11:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|