1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
#!/usr/bin/awk -f
BEGIN {
FS = "\t";
OFS = "\t";
BLOCKPORTSCSVFORMAT = "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n";
STDERR = "/dev/stderr";
BLOCKPORTSCSV = "data/blocks-ports.tsv";
GETSIZECSV = "data/getsize.tsv";
blockportid = 0;
port_part = 1;
port_dmg = 1;
}
{
category = $1;
block = $2;
explicit_input_ports = $3;
implicit_input_ports = $4;
explicit_output_ports = $5;
implicit_output_ports = $6;
control_ports = $8;
command_ports = $7;
block_width = $9;
block_height = $10;
print category, block, block_width, block_height > GETSIZECSV;
port_order = 0;
input_ports = explicit_input_ports + implicit_input_ports;
for (i = 0; i < explicit_input_ports; i++) {
++port_order;
port_x = int(block_width * -0.5 - 0.5);
if (2 * i < input_ports)
port_y = int(block_height * ((i + 0.5) / input_ports - 0.5) - 0.5);
else
port_y = int(block_height * ((i + 0.5) / input_ports - 0.5) + 0.5);
port_orientation = "ExplicitInputPort";
port_type = "ExplicitInputPort";
printf BLOCKPORTSCSVFORMAT, ++blockportid, category, block, port_order, port_order, port_order, port_x, port_y, port_orientation, port_part, port_dmg, port_type > BLOCKPORTSCSV;
}
for (i = 0; i < implicit_input_ports; i++) {
++port_order;
port_x = int(block_width * -0.5 - 0.5);
if (2 * (explicit_input_ports + i) < input_ports)
port_y = int(block_height * ((explicit_input_ports + i + 0.5) / input_ports - 0.5) - 0.5);
else
port_y = int(block_height * ((explicit_input_ports + i + 0.5) / input_ports - 0.5) + 0.5);
port_orientation = "ImplicitInputPort";
port_type = "ImplicitInputPort";
printf BLOCKPORTSCSVFORMAT, ++blockportid, category, block, port_order, port_order, port_order, port_x, port_y, port_orientation, port_part, port_dmg, port_type > BLOCKPORTSCSV;
}
output_ports = explicit_output_ports + implicit_output_ports;
for (i = 0; i < explicit_output_ports; i++) {
++port_order;
port_x = int(block_width * 0.5 + 0.5);
if (2 * i < output_ports)
port_y = int(block_height * ((i + 0.5) / output_ports - 0.5) - 0.5);
else
port_y = int(block_height * ((i + 0.5) / output_ports - 0.5) + 0.5);
port_orientation = "ExplicitOutputPort";
port_type = "ExplicitOutputPort";
printf BLOCKPORTSCSVFORMAT, ++blockportid, category, block, port_order, port_order, port_order, port_x, port_y, port_orientation, port_part, port_dmg, port_type > BLOCKPORTSCSV;
}
for (i = 0; i < implicit_output_ports; i++) {
++port_order;
port_x = int(block_width * 0.5 + 0.5);
if (2 * (explicit_output_ports + i) < output_ports)
port_y = int(block_height * ((explicit_output_ports + i + 0.5) / output_ports - 0.5) - 0.5);
else
port_y = int(block_height * ((explicit_output_ports + i + 0.5) / output_ports - 0.5) + 0.5);
port_orientation = "ImplicitOutputPort";
port_type = "ImplicitOutputPort";
printf BLOCKPORTSCSVFORMAT, ++blockportid, category, block, port_order, port_order, port_order, port_x, port_y, port_orientation, port_part, port_dmg, port_type > BLOCKPORTSCSV;
}
for (i = 0; i < control_ports; i++) {
++port_order;
if (2 * i < control_ports)
port_x = int(block_width * ((i + 0.5) / control_ports - 0.5) - 0.5);
else
port_x = int(block_width * ((i + 0.5) / control_ports - 0.5) + 0.5);
port_y = int(block_height * -0.5 - 0.5);
port_orientation = "ControlPort";
port_type = "ControlPort";
printf BLOCKPORTSCSVFORMAT, ++blockportid, category, block, port_order, port_order, port_order, port_x, port_y, port_orientation, port_part, port_dmg, port_type > BLOCKPORTSCSV;
}
for (i = 0; i < command_ports; i++) {
++port_order;
if (2 * i < command_ports)
port_x = int(block_width * ((i + 0.5) / command_ports - 0.5) - 0.5);
else
port_x = int(block_width * ((i + 0.5) / command_ports - 0.5) + 0.5);
port_y = int(block_height * 0.5 + 0.5);
port_orientation = "CommandPort";
port_type = "CommandPort";
printf BLOCKPORTSCSVFORMAT, ++blockportid, category, block, port_order, port_order, port_order, port_x, port_y, port_orientation, port_part, port_dmg, port_type > BLOCKPORTSCSV;
}
}
|