Skip to content
Snippets Groups Projects
Commit f3560e4f authored by Eric Kooistra's avatar Eric Kooistra
Browse files

Support HDL ref generation for nof_points=32. Correct using transpose without complex conjugate.

parent fe2e3b48
No related branches found
No related tags found
No related merge requests found
...@@ -44,10 +44,13 @@ tb.model_signal = 'sinusoid'; % Use sinusoid to check the frequency res ...@@ -44,10 +44,13 @@ tb.model_signal = 'sinusoid'; % Use sinusoid to check the frequency res
tb.model_quantization = 'floating point'; tb.model_quantization = 'floating point';
tb.model_quantization = 'fixed point'; tb.model_quantization = 'fixed point';
tb.nof_subbands = 64; tb.nof_subbands = 16;
% Carrier frequency % Carrier frequency
tb.subband_wg = 43; % subband range 0:tb.nof_subbands-1, can be fraction to have any sinusoid frequency tb.subband_wg = 4; % subband range 0:tb.nof_subbands-1, can be fraction to have any sinusoid frequency
if tb.nof_subbands == 64
tb.subband_wg = 43; % use 43 to recreate HDL reference data for nof_subbands = 64, else use 1 to fit any nof_subbands
end
%tb.subband_wg = 1.55; %tb.subband_wg = 1.55;
%tb.subband_wg = 12; %tb.subband_wg = 12;
...@@ -56,13 +59,13 @@ tb.sop = 1; % initial 'impulse' start index in range ctr ...@@ -56,13 +59,13 @@ tb.sop = 1; % initial 'impulse' start index in range ctr
% Model a frequency sweep of the 'sinusoid' % Model a frequency sweep of the 'sinusoid'
tb.chirp = 0; % 0 = use fixed tb.subband_wg frequency or pulse period equal to block_size tb.chirp = 0; % 0 = use fixed tb.subband_wg frequency or pulse period equal to block_size
tb.chirp = 1; % else increment WG frequency every block to have chirp frequency sweep or slide the pulse %tb.chirp = 1; % else increment WG frequency every block to have chirp frequency sweep or slide the pulse
if strcmp(tb.model_signal, 'noise') if strcmp(tb.model_signal, 'noise')
tb.nof_tsub = 10 ; % number of subband periods to simulate tb.nof_tsub = 10 ; % number of subband periods to simulate
elseif tb.chirp elseif tb.chirp
tb.nof_tsub = 200; % number of subband periods to simulate tb.nof_tsub = 200; % number of subband periods to simulate
else else
tb.nof_tsub = 1; % number of subband periods to simulate tb.nof_tsub = 5; % number of subband periods to simulate
end end
tb.plot_per_block = 0; % 1 = plot spectrum for each block in time, else skip this plot to save time tb.plot_per_block = 0; % 1 = plot spectrum for each block in time, else skip this plot to save time
...@@ -205,8 +208,8 @@ if strcmp(tb.model_quantization, 'fixed point') ...@@ -205,8 +208,8 @@ if strcmp(tb.model_quantization, 'fixed point')
fid = fopen(file_name, 'w'); fid = fopen(file_name, 'w');
fprintf(fid,'Nof lines WG output: %d\n', length(wg_q_data(:))); fprintf(fid,'Nof lines WG output: %d\n', length(wg_q_data(:)));
fprintf(fid,'Nof lines PFFT output: %d\n', length(pfft_subband_q_data(:))); fprintf(fid,'Nof lines PFFT output: %d\n', length(pfft_subband_q_data(:)));
for bI = tbegin:tend
% WG output % WG output
for bI = tbegin:tend
for bJ = 1:tb.subband_fft_size for bJ = 1:tb.subband_fft_size
fprintf(fid,'%d\n', wg_q_data(bI, bJ)); fprintf(fid,'%d\n', wg_q_data(bI, bJ));
end end
...@@ -239,7 +242,7 @@ sub_Iplus1 = tb.subband_Iplus1 + [0: tb.nof_subbands: tb.nof_subbands*tb.nof_tsu ...@@ -239,7 +242,7 @@ sub_Iplus1 = tb.subband_Iplus1 + [0: tb.nof_subbands: tb.nof_subbands*tb.nof_tsu
fig=fig+1; fig=fig+1;
figure('position', [xfig+fig*dfig yfig-fig*dfig xfigw yfigw]); figure('position', [xfig+fig*dfig yfig-fig*dfig xfigw yfigw]);
figure(fig); figure(fig);
data = data_wg'; data = data_wg.';
plot(ts, data(:)) plot(ts, data(:))
ylim([-1.3 1.3]); ylim([-1.3 1.3]);
title(sprintf('WG output data (WG subband %6.3f)', tb.subband_wg)); title(sprintf('WG output data (WG subband %6.3f)', tb.subband_wg));
...@@ -252,7 +255,7 @@ fig=fig+1; ...@@ -252,7 +255,7 @@ fig=fig+1;
figure('position', [xfig+fig*dfig yfig-fig*dfig xfigw yfigw]); figure('position', [xfig+fig*dfig yfig-fig*dfig xfigw yfigw]);
figure(fig); figure(fig);
data = data_pfft_subband'; data = data_pfft_subband.';
data = data(:); data = data(:);
hy = 1.2 * max(abs(data)); hy = 1.2 * max(abs(data));
plot(tsub_all, real(data), 'r', tsub_all, imag(data), 'b'); plot(tsub_all, real(data), 'r', tsub_all, imag(data), 'b');
...@@ -273,7 +276,7 @@ fig=fig+1; ...@@ -273,7 +276,7 @@ fig=fig+1;
figure('position', [xfig+fig*dfig yfig-fig*dfig xfigw yfigw]); figure('position', [xfig+fig*dfig yfig-fig*dfig xfigw yfigw]);
figure(fig); figure(fig);
subplot(2,1,1); subplot(2,1,1);
data = sub_ampl'; data = sub_ampl.';
data = data(:); data = data(:);
plot(tsub_all, data, 'k', tsub_all(sub_I), data(sub_I), 'ko', tsub_all(sub_Iplus1), data(sub_Iplus1), 'kx'); plot(tsub_all, data, 'k', tsub_all(sub_I), data(sub_I), 'ko', tsub_all(sub_Iplus1), data(sub_Iplus1), 'kx');
title(sprintf('Subband data - amplitude (o,x = subband %d,%d for WG subband = %6.3f)', tb.subband_i, tb.subband_iplus1, tb.subband_wg)); title(sprintf('Subband data - amplitude (o,x = subband %d,%d for WG subband = %6.3f)', tb.subband_i, tb.subband_iplus1, tb.subband_wg));
...@@ -281,7 +284,7 @@ xlabel(sprintf('Subbands 0:%d at time 0:%d [Tsub]', tb.nof_subbands-1, tb.nof_ts ...@@ -281,7 +284,7 @@ xlabel(sprintf('Subbands 0:%d at time 0:%d [Tsub]', tb.nof_subbands-1, tb.nof_ts
ylabel('Voltage'); ylabel('Voltage');
grid on; grid on;
subplot(2,1,2); subplot(2,1,2);
data = sub_phase'; data = sub_phase.';
data = data(:); data = data(:);
plot(tsub_all, data, 'k', tsub_all(sub_I), data(sub_I), 'ko', tsub_all(sub_Iplus1), data(sub_Iplus1), 'kx'); plot(tsub_all, data, 'k', tsub_all(sub_I), data(sub_I), 'ko', tsub_all(sub_Iplus1), data(sub_Iplus1), 'kx');
ylim([-180 180]) ylim([-180 180])
......
...@@ -45,7 +45,7 @@ tb.model_signal = 'phasor'; % Use phasor to check the frequency respo ...@@ -45,7 +45,7 @@ tb.model_signal = 'phasor'; % Use phasor to check the frequency respo
tb.model_quantization = 'floating point'; tb.model_quantization = 'floating point';
tb.model_quantization = 'fixed point'; tb.model_quantization = 'fixed point';
tb.nof_channels = 64; tb.nof_channels = 32;
% Carrier frequency % Carrier frequency
tb.channel_wg = 1; % channel range -tb.nof_channels/2:tb.nof_channels/2-1, can be fraction to have any sinusoid frequency tb.channel_wg = 1; % channel range -tb.nof_channels/2:tb.nof_channels/2-1, can be fraction to have any sinusoid frequency
......
...@@ -308,7 +308,7 @@ sub_Iplus1 = tb.subband_Iplus1 + [0: tb.nof_subbands: tb.nof_subbands*tb.nof_tsu ...@@ -308,7 +308,7 @@ sub_Iplus1 = tb.subband_Iplus1 + [0: tb.nof_subbands: tb.nof_subbands*tb.nof_tsu
fig=fig+1; fig=fig+1;
figure('position', [xfig+fig*dfig yfig-fig*dfig xfigw yfigw]); figure('position', [xfig+fig*dfig yfig-fig*dfig xfigw yfigw]);
figure(fig); figure(fig);
data = data_wg'; data = data_wg.';
plot(ts, data(:)) plot(ts, data(:))
ylim([-1.3 1.3]); ylim([-1.3 1.3]);
title(sprintf('WG output data (WG subband %6.3f)', tb.subband_wg)); title(sprintf('WG output data (WG subband %6.3f)', tb.subband_wg));
...@@ -359,7 +359,7 @@ ylabel('Magnitude [dB]'); ...@@ -359,7 +359,7 @@ ylabel('Magnitude [dB]');
fig=fig+1; fig=fig+1;
figure('position', [xfig+fig*dfig yfig-fig*dfig xfigw yfigw]); figure('position', [xfig+fig*dfig yfig-fig*dfig xfigw yfigw]);
figure(fig); figure(fig);
data = data_pfir_subband'; data = data_pfir_subband.';
plot(ts, data(:)) plot(ts, data(:))
title(sprintf('Subband PFIR filter output - FFT input data (WG subband %6.3f)', tb.subband_wg)); title(sprintf('Subband PFIR filter output - FFT input data (WG subband %6.3f)', tb.subband_wg));
ylim([-2 2]); % Delay tracking step when tb.subband_wg is .5 causes double range ylim([-2 2]); % Delay tracking step when tb.subband_wg is .5 causes double range
...@@ -378,7 +378,7 @@ fig=fig+1; ...@@ -378,7 +378,7 @@ fig=fig+1;
figure('position', [xfig+fig*dfig yfig-fig*dfig xfigw yfigw]); figure('position', [xfig+fig*dfig yfig-fig*dfig xfigw yfigw]);
figure(fig); figure(fig);
subplot(2,1,1); subplot(2,1,1);
data = sub_ampl'; data = sub_ampl.';
data = data(:); data = data(:);
plot(tsub_all, data, 'k', tsub_all(sub_I), data(sub_I), 'ko', tsub_all(sub_Iplus1), data(sub_Iplus1), 'kx'); plot(tsub_all, data, 'k', tsub_all(sub_I), data(sub_I), 'ko', tsub_all(sub_Iplus1), data(sub_Iplus1), 'kx');
title(sprintf('Subband data - amplitude (o,x = subband %d,%d for WG subband = %6.3f)', tb.subband_i, tb.subband_iplus1, tb.subband_wg)); title(sprintf('Subband data - amplitude (o,x = subband %d,%d for WG subband = %6.3f)', tb.subband_i, tb.subband_iplus1, tb.subband_wg));
...@@ -386,7 +386,7 @@ xlabel(sprintf('Subbands 0:%d at time 0:%d [Tsub]', tb.nof_subbands-1, tb.nof_ts ...@@ -386,7 +386,7 @@ xlabel(sprintf('Subbands 0:%d at time 0:%d [Tsub]', tb.nof_subbands-1, tb.nof_ts
ylabel('Voltage'); ylabel('Voltage');
grid on; grid on;
subplot(2,1,2); subplot(2,1,2);
data = sub_phase'; data = sub_phase.';
data = data(:); data = data(:);
plot(tsub_all, data, 'k', tsub_all(sub_I), data(sub_I), 'ko', tsub_all(sub_Iplus1), data(sub_Iplus1), 'kx'); plot(tsub_all, data, 'k', tsub_all(sub_I), data(sub_I), 'ko', tsub_all(sub_Iplus1), data(sub_Iplus1), 'kx');
ylim([-180 180]) ylim([-180 180])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment