-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrx_time_ldpc.m
166 lines (131 loc) · 5.84 KB
/
rx_time_ldpc.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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
% Function to generate demodulator bar graph with LLR Mean relative erro
function rx_time_ldpc( ...
logdata_fxp_base16, logdata_fxp_approx16,...
logdata_fxp_base32, logdata_fxp_approx32,...
logdata_fxp8_base16, logdata_fxp8_approx16,...
logdata_fxp8_base32, logdata_fxp8_approx32,...
iter)
% 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 == iter);
idx_fxp_approx16 = find(logdata_fxp_approx16.LDPC_Iter == iter);
idx_fxp_base32 = find(logdata_fxp_base32.LDPC_Iter == iter);
idx_fxp_approx32 = find(logdata_fxp_base32.LDPC_Iter == iter);
idx_fxp8_base16 = find(logdata_fxp8_base16.LDPC_Iter == iter);
idx_fxp8_approx16 = find(logdata_fxp8_approx16.LDPC_Iter == iter);
idx_fxp8_base32 = find(logdata_fxp8_base32.LDPC_Iter == iter);
idx_fxp8_approx32 = find(logdata_fxp8_approx32.LDPC_Iter == iter);
delay = 5.2;
% Create array with base and optimized time values
% FLP Base
y(1,1) = mean(logdata_fxp_base16.Demod_Base(idx_fxp_base16));
y(1,2) = delay;
y(1,3) = mean(logdata_fxp_base16.Deinterleaver(idx_fxp_base16));
y(1,4) = mean(logdata_fxp_base16.Decoder(idx_fxp_base16));
base = y(1,1) + y(1,2) + y(1,3) + y(1,4);
% S2.14 Base MUL16
y(2,1) = mean(logdata_fxp_base16.Demod_Opt(idx_fxp_base16));
y(2,2) = delay;
y(2,3) = mean(logdata_fxp_base16.Deinterleaver(idx_fxp_base16));
y(2,4) = mean(logdata_fxp_base16.Decoder(idx_fxp_base16));
% S2.14 Approx MUL16
y(3,1) = mean(logdata_fxp_approx16.Demod_Opt(idx_fxp_approx16));
y(3,2) = delay;
y(3,3) = mean(logdata_fxp_approx16.Deinterleaver(idx_fxp_approx16));
y(3,4) = mean(logdata_fxp_base16.Decoder(idx_fxp_approx16));
% S2.14 Base MUL32
y(4,1) = mean(logdata_fxp_base32.Demod_Opt(idx_fxp_base32));
y(4,2) = delay;
y(4,3) = mean(logdata_fxp_base32.Deinterleaver(idx_fxp_base32));
y(4,4) = mean(logdata_fxp_base32.Decoder(idx_fxp_base32));
% S2.14 Approx MUL32
y(5,1) = mean(logdata_fxp_approx32.Demod_Opt(idx_fxp_approx32));
y(5,2) = delay;
y(5,3) = mean(logdata_fxp_approx32.Deinterleaver(idx_fxp_approx32));
y(5,4) = mean(logdata_fxp_approx32.Decoder(idx_fxp_approx32));
% S2.6 Base MUL16
y(6,1) = mean(logdata_fxp8_base16.Demod_Opt(idx_fxp8_base16));
y(6,2) = delay;
y(6,3) = mean(logdata_fxp8_base16.Deinterleaver(idx_fxp8_base16));
y(6,4) = mean(logdata_fxp8_base16.Decoder(idx_fxp8_base16));
% S2.6 Approx MUL16
y(7,1) = mean(logdata_fxp8_approx16.Demod_Opt(idx_fxp8_approx16));
y(7,2) = delay;
y(7,3) = mean(logdata_fxp8_approx16.Deinterleaver(idx_fxp8_approx16));
y(7,4) = mean(logdata_fxp8_approx16.Decoder(idx_fxp8_approx16));
% S2.6 Base MUL32
y(8,1) = mean(logdata_fxp8_base32.Demod_Opt(idx_fxp8_base32));
y(8,2) = delay;
y(8,3) = mean(logdata_fxp8_base32.Deinterleaver(idx_fxp8_base32));
y(8,4) = mean(logdata_fxp8_base32.Decoder(idx_fxp8_base32));
% S2.6 Approx MUL32
y(9,1) = mean(logdata_fxp8_approx32.Demod_Opt(idx_fxp8_approx32));
y(9,2) = delay;
y(9,3) = mean(logdata_fxp8_approx32.Deinterleaver(idx_fxp8_approx32));
y(9,4) = mean(logdata_fxp8_approx32.Decoder(idx_fxp8_approx32));
% Calculate speedup
for i=2:9
speedup(i) = round(base/(y(i,1) + y(i,2) + y(i,3) + y(i,4)), 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(2).FaceColor = steel_blue;
% b(3).FaceColor = powder_blue;
% b(4).FaceColor = sky_blue;
b(1).FaceColor = blue80;
b(2).FaceColor = teal50;
b(3).FaceColor = purple50;
b(4).FaceColor = magenta70;
% b(5).FaceColor = royal_blue;
ylabel("Execution Time [ms]");
xlabel("Demodulator Implementation");
% Add speedup for fxp16
xtips1 = b(4).XEndPoints;
ytips1 = b(4).YEndPoints;
labels1 = string("$\times$" + speedup);
labels1(1) = " ";
text(xtips1, ytips1, labels1, "HorizontalAlignment", "left",...
"VerticalAlignment", "bottom", "FontSize", 7, "Rotation", 45)
% x = [0 1.5 1.5 0];
% y = [0 0 b(4).YEndPoints(1) b(4).YEndPoints(1)];
% patch(x,y,'blue', 'FaceAlpha',.1, "EdgeColor", "none");
%
%
% x = [1.5 4.5 4.5 1.5];
% y = [0 0 b(4).YEndPoints(1) b(4).YEndPoints(1)];
% patch(x,y,'red', 'FaceAlpha',.1, "EdgeColor", "none");
% Misc plot settings
% -----------------------------
% title("Receiver with LDPC at " + iter + " Iterations - QAM64 (N = 64800)");
% grid on;
ax = gca;
ax.XGrid = 'off';
ax.YGrid = 'on';
% ax.GridLineStyle = "--";
% xlabel("Modulation type");
legend("Demodulator", "Align", "De-interleaver", "LDPC (" + iter + " Iter)",...
"Location", "northoutside", "Orientation", "horizontal");
% 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]);
% saveas(gca, "plots/rx_ldpc" + iter + "_qam64", "epsc");
saveas(gcf, "plots/rx_ldpc" + iter + "_qam64.pdf");
system("sudo pdfcrop plots/rx_ldpc" + iter + "_qam64.pdf plots/rx_ldpc" + iter + "_qam64.pdf");
save("data");
end