-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemod_time.m
123 lines (91 loc) · 3.81 KB
/
demod_time.m
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
% Function to generate demodulator bar graph with LLR Mean relative erro
function demod_time( ...
logdata_fxp_base16, logdata_fxp_approx16,...
logdata_fxp_base32, logdata_fxp_approx32,...
logdata_fxp8_base16, logdata_fxp8_approx16,...
logdata_fxp8_base32, logdata_fxp8_approx32...
)
% Load colors from colors.m
run("colors.m");
% Use LaTeX for plots
set(0, 'defaultTextInterpreter','latex');
set(0, 'defaultLegendInterpreter', 'latex');
% Extract data from table for specific noise and LDPC iterations
% idx_fxp_base16 = find(logdata_fxp_base16.EbN0dB == noise & logdata_fxp_base16.LDPC_Iter == 0);
idx_fxp_base16 = find(logdata_fxp_base16.LDPC_Iter == 0);
idx_fxp_approx16 = find(logdata_fxp_approx16.LDPC_Iter == 0);
idx_fxp_base32 = find(logdata_fxp_base32.LDPC_Iter == 0);
idx_fxp_approx32 = find(logdata_fxp_base32.LDPC_Iter == 0);
idx_fxp8_base16 = find(logdata_fxp8_base16.LDPC_Iter == 0);
idx_fxp8_approx16 = find(logdata_fxp8_approx16.LDPC_Iter == 0);
idx_fxp8_base32 = find(logdata_fxp8_base32.LDPC_Iter == 0);
idx_fxp8_approx32 = find(logdata_fxp8_approx32.LDPC_Iter == 0);
% Create array with base and optimized time values
% FLP Base
y(1,1) = mean(logdata_fxp_base16.Demod_Base(idx_fxp_base16));
base = y(1,1);
% S2.14 Base MUL16
y(2,1) = mean(logdata_fxp_base16.Demod_Opt(idx_fxp_base16));
% S2.14 Approx MUL16
y(3,1) = mean(logdata_fxp_approx16.Demod_Opt(idx_fxp_approx16));
% S2.14 Base MUL32
y(4,1) = mean(logdata_fxp_base32.Demod_Opt(idx_fxp_base32));
% S2.14 Approx MUL32
y(5,1) = mean(logdata_fxp_approx32.Demod_Opt(idx_fxp_approx32));
% S2.6 Base MUL16
y(6,1) = mean(logdata_fxp8_base16.Demod_Opt(idx_fxp8_base16));
% S2.6 Approx MUL16
y(7,1) = mean(logdata_fxp8_approx16.Demod_Opt(idx_fxp8_approx16));
% S2.6 Base MUL32
y(8,1) = mean(logdata_fxp8_base32.Demod_Opt(idx_fxp8_base32));
% S2.6 Approx MUL32
y(9,1) = mean(logdata_fxp8_approx32.Demod_Opt(idx_fxp8_approx32));
% Calculate speedup
for i=2:9
speedup(i) = round(base/y(i,1), 2);
end
% Bar graph
figure;
% colororder([0 0 0]);
% x = ["FLP Base" "FXP S2.14 Base" "FXP S2.14 Approx"];
b = bar(y, "stacked", "BarWidth", 0.4, "EdgeColor", "none");
% xticklabels({});
x_labels = ["FLP64-B64", ...
"FXP16-B16", "FXP16-A16", "FXP16-B32", "FXP16-A32", ...
"FXP8-B16", "FXP8-A16", "FXP8-B32", "FXP8-A32"];
set(gca, "XTickLabel", x_labels);
% b(1).FaceColor = navy_blue;
b(1).FaceColor = blue80;
ylabel("Execution Time [ms]");
xlabel("Demodulator Implementation");
% Add speedup for fxp16
xtips1 = b(1).XEndPoints;
ytips1 = b(1).YEndPoints;
labels1 = string("$\times$" + speedup);
labels1(1) = " ";
text(xtips1, ytips1, labels1, "HorizontalAlignment", "left",...
"VerticalAlignment", "bottom", "FontSize", 8, "Rotation", 45)
% yline(100,'--r','Threshold');
% yline(y(2,1)+y(2,2),'--r','S2.14-BASE16', "Interpreter", "latex");
% yline(y(2,1)+y(2,2),'--r');
% Misc plot settings
%------------------
% title("Demodulator - QAM64 (N = 64800)");
% grid on;
ax = gca;
ax.XGrid = 'off';
ax.YGrid = 'on';
% xlabel("Modulation type");
legend("Demodulator",...
"Location", "northeast");
% Set vertical lines for seperating implementations
xline(1.5, '--', 'HandleVisibility','off');
xline(5.5, '--', 'HandleVisibility','off');
set(gca, 'TickLabelInterpreter','latex');
set(gcf, 'Position', [10, 10, 570, 290]);
set(gca, 'TickLabelInterpreter','latex');
% saveas(gca, "plots/demod_qam64", "epsc");
saveas(gcf, "plots/demod_qam64.pdf");
system("sudo pdfcrop plots/demod_qam64.pdf plots/demod_qam64.pdf");
save("data");
end