108 lines
2.8 KiB
Plaintext
108 lines
2.8 KiB
Plaintext
|
|
digraph heron {
|
|
//node [shape=circle,regular=1,style=filled,fillcolor=white];
|
|
edge [arrowhead=odot];
|
|
graph [overlap=scale];
|
|
subgraph {
|
|
edge [weight=3];
|
|
C0 -> C1 -> C2 -> C3 -> C4 -> C5 -> C6 -> C7 -> C8 -> C9 -> C10 [minlen=3];
|
|
}
|
|
|
|
// variables & constants
|
|
mem_0 [label="mem[0]"];
|
|
mem_i [label="mem[i]"];
|
|
mem_i2 [label="mem[i]",shape="box"];
|
|
i [label="i"];
|
|
"1c" [label="1" ];
|
|
"1d" [label="1" ];
|
|
Finish [label="Finish"];
|
|
|
|
// operands
|
|
s_shift_1 [label=">> 1",];
|
|
i_lt_0 [label=">",];
|
|
|
|
// i <= mem[0]
|
|
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; }
|
|
|
|
// if (i <= mem[0]) ->
|
|
i_lt_0 -> mem_s_gte_1 [style=dotted, arrowhead=normal,label="True"];
|
|
// else
|
|
i_lt_0 -> Finish [style=dotted, arrowhead=normal,label="False"];
|
|
{ rank=same; C10; Finish;}
|
|
|
|
subgraph i_lt_0 {
|
|
mem_s_gte_1 [label=">"];
|
|
|
|
s_div_x [label="/",];
|
|
new_x [label="+",];
|
|
s_div_x_shift_1 [label=">> 1",];
|
|
x_shift_1 [label=">> 1",];
|
|
old_x_lte_new_x [label=">=",];
|
|
dec_i [label="-",];
|
|
comma_fix [label="<< Kommastellen/2"];
|
|
|
|
// (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
|
|
mem_s_gte_1 -> comma_fix [style=dotted,arrowhead=normal,label="False"];
|
|
|
|
subgraph if_mem_i_gte_1 {
|
|
// x = s >> 1
|
|
mem_i -> s_shift_1;
|
|
s_shift_1 -> x [style=dotted,arrowhead=normal,label="C2->C3"];
|
|
{ rank=same; C3; s_shift_1; x}
|
|
|
|
// (x >> 1)
|
|
x [shape="box"];
|
|
x -> x_shift_1;
|
|
// (s/x)
|
|
mem_i:ne -> s_div_x:ne;
|
|
x -> s_div_x:nw;
|
|
{ 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;
|
|
new_x -> x [style=dotted,label="C7->C3 || C7->C8"];
|
|
|
|
x_2 [shape="box" label="x"];
|
|
{ rank=same; C7; old_x_lte_new_x;}
|
|
|
|
x_2 -> comma_fix;
|
|
{ rank=same; C8; comma_fix x_2}
|
|
|
|
// if (old_x <= X)
|
|
old_x_lte_new_x -> comma_fix [style=dotted,arrowhead=normal,label="True"];
|
|
// else
|
|
old_x_lte_new_x -> x [style=dotted,arrowhead=normal,label="False"];
|
|
|
|
comma_fix -> mem_i2 [label="C7->C8", style=dotted];
|
|
comma_fix -> dec_i [style=dotted, arrowhead=normal, label="True"];
|
|
|
|
"1c" -> dec_i;
|
|
i -> dec_i:ne;
|
|
dec_i:s -> i:s;
|
|
{ rank=same; C9; dec_i; mem_i2};
|
|
}
|
|
}
|
|
}
|