diff --git a/referencedmodels/soc_rfsoc_proc.slx b/referencedmodels/soc_rfsoc_proc.slx index d912b18..396b0e3 100644 Binary files a/referencedmodels/soc_rfsoc_proc.slx and b/referencedmodels/soc_rfsoc_proc.slx differ diff --git a/resources/project/d5dEC3kotuZeerJ4IRjJh3LU3nM/Sqf9uvnGiYyl02crmP5dcX378Bsd.xml b/resources/project/d5dEC3kotuZeerJ4IRjJh3LU3nM/Sqf9uvnGiYyl02crmP5dcX378Bsd.xml new file mode 100644 index 0000000..99772b4 --- /dev/null +++ b/resources/project/d5dEC3kotuZeerJ4IRjJh3LU3nM/Sqf9uvnGiYyl02crmP5dcX378Bsd.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/resources/project/d5dEC3kotuZeerJ4IRjJh3LU3nM/Sqf9uvnGiYyl02crmP5dcX378Bsp.xml b/resources/project/d5dEC3kotuZeerJ4IRjJh3LU3nM/Sqf9uvnGiYyl02crmP5dcX378Bsp.xml new file mode 100644 index 0000000..d1d0466 --- /dev/null +++ b/resources/project/d5dEC3kotuZeerJ4IRjJh3LU3nM/Sqf9uvnGiYyl02crmP5dcX378Bsp.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/resources/project/d5dEC3kotuZeerJ4IRjJh3LU3nM/jCxeCZZX-Z1DLQ1xfH3hIxhR958d.xml b/resources/project/d5dEC3kotuZeerJ4IRjJh3LU3nM/jCxeCZZX-Z1DLQ1xfH3hIxhR958d.xml new file mode 100644 index 0000000..99772b4 --- /dev/null +++ b/resources/project/d5dEC3kotuZeerJ4IRjJh3LU3nM/jCxeCZZX-Z1DLQ1xfH3hIxhR958d.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/resources/project/d5dEC3kotuZeerJ4IRjJh3LU3nM/jCxeCZZX-Z1DLQ1xfH3hIxhR958p.xml b/resources/project/d5dEC3kotuZeerJ4IRjJh3LU3nM/jCxeCZZX-Z1DLQ1xfH3hIxhR958p.xml new file mode 100644 index 0000000..ec11a57 --- /dev/null +++ b/resources/project/d5dEC3kotuZeerJ4IRjJh3LU3nM/jCxeCZZX-Z1DLQ1xfH3hIxhR958p.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/soc_rfsoc_top.slx b/soc_rfsoc_top.slx index 59cea0c..c8c5ba5 100644 Binary files a/soc_rfsoc_top.slx and b/soc_rfsoc_top.slx differ diff --git a/utilities/post_processing/checkCounterSamples.m b/utilities/post_processing/checkCounterSamples.m new file mode 100644 index 0000000..ded4cb0 --- /dev/null +++ b/utilities/post_processing/checkCounterSamples.m @@ -0,0 +1,116 @@ +%% ========================================================= +% Data +% ========================================================= +clc; +X = raw_DPW.Data; % [512 x nFrames x nTime] + +% Remove first DPW if needed (initialization artifact) +X = X(:,:,2:end); + +[nSamples, nFrames_cfg, nTime] = size(X); + +%% ========================================================= +% PARAMETERS +% ========================================================= +COUNTER_MAX = 511; % counter: 0..511 + +%% ========================================================= +% VALIDATION +% ========================================================= +for t = 1:nTime + + fprintf('\n=== Checking DPW %d ===\n', t); + + X_dpw = X(:,:,t); + + % Flatten stream + x_seq = reshape(X_dpw, [], 1); + + % Extract stored integers + real_seq = double(storedInteger(real(x_seq))); % sample counter + frame_seq = double(storedInteger(imag(x_seq))); % frame index + + %% ----------------------------------------------------- + % 1. Sample progression + % ----------------------------------------------------- + d_real = diff(real_seq); + + valid_steps = (d_real == 1) | (d_real == -COUNTER_MAX); + + if all(valid_steps) + fprintf('✔ Sample progression OK\n'); + else + idx = find(~valid_steps, 1); + fprintf('❌ Sample progression ERROR at index %d\n', idx); + end + + %% ----------------------------------------------------- + % 2. Detect counter wraps (511 → 0) + % ----------------------------------------------------- + wrap_idx = find(real_seq(1:end-1) == COUNTER_MAX & real_seq(2:end) == 0); + + fprintf('Detected wraps: %d (configured: %d)\n', ... + length(wrap_idx), nFrames_cfg); + + if length(wrap_idx) == nFrames_cfg + fprintf('✔ Wrap count matches configuration\n'); + else + fprintf('❌ Wrap count mismatch\n'); + end + + %% ----------------------------------------------------- + % 3. Check frame increment at wraps (no wrap logic) + % ----------------------------------------------------- + ok_wrap = true; + + for k = 1:length(wrap_idx) + + i = wrap_idx(k); + + f_before = frame_seq(i); + f_after = frame_seq(i+1); + + if f_after ~= f_before + 1 + fprintf('❌ Frame increment error at idx %d (%d → %d)\n', ... + i, f_before, f_after); + ok_wrap = false; + break; + end + + end + + if ok_wrap + fprintf('✔ Frame increments correctly at all wraps\n'); + end + + %% ----------------------------------------------------- + % 4. Informative: frame regions (+1 effect) + % ----------------------------------------------------- + d_frame = diff(frame_seq); + nFrames_detected = sum(d_frame == 1) + 1; + + fprintf('Frame regions (including partial): %d (expected: %d + 1)\n', ... + nFrames_detected, nFrames_cfg); + + %% ----------------------------------------------------- + % 5. Optional: per-frame sanity (≤2 indices) + % ----------------------------------------------------- + frame_idx_matrix = storedInteger(imag(X_dpw)); + + frame_ok = true; + + for f = 1:nFrames_cfg + u = unique(frame_idx_matrix(:,f)); + + if length(u) > 2 + fprintf('❌ Frame %d has >2 frame indices\n', f); + frame_ok = false; + break; + end + end + + if frame_ok + fprintf('✔ Frame structure OK (≤2 indices per frame)\n'); + end + +end \ No newline at end of file diff --git a/utilities/post_processing/checkFreqSamples.m b/utilities/post_processing/checkFreqSamples.m new file mode 100644 index 0000000..0fd456d --- /dev/null +++ b/utilities/post_processing/checkFreqSamples.m @@ -0,0 +1,87 @@ +%% ========================================================= +% Data +% ========================================================= +X = single(raw_DPW.Data); % [512 x nFrames x nTime] +X = X(:,:,2:end); % First DPW is zeroed +X = 2*X; % Rescale (see channelizer block on PL) + +[nSamples, nFrames, nTime] = size(X); +N = nSamples; + +%% ========================================================= +% Parameters +% ========================================================= +Fs = 512e6; % Hz + +f_axis = (-N/2 : N/2-1) * (Fs/N) / 1e6; % MHz + +%% ========================================================= +% Apply fftshift per frame (dim = 1) +% ========================================================= +X_shift = fftshift(X, 1); + +%% ========================================================= +% Convert to power +% ========================================================= +P = abs(X_shift).^2; + +%% ========================================================= +% OPTION 1 — Mean Spectrum (over frames AND time) +% ========================================================= +P_mean = mean(P, [2 3]); % average over frames and triggers +P_mean = squeeze(P_mean); % [512 x 1] + +figure; +plot(f_axis, 10*log10(P_mean + 1e-12), 'LineWidth', 1.5); +grid on; + +xlabel('Frequency (MHz)'); +ylabel('Power (dB)'); +title('Mean Channelized Spectrum (Frames + Time)'); + +%% ========================================================= +% OPTION 2 — Max Spectrum (detect intermittent peaks) +% ========================================================= +P_max = max(P, [], [2 3]); +P_max = squeeze(P_max); + +figure; +plot(f_axis, 10*log10(P_max + 1e-12), 'LineWidth', 1.5); +grid on; + +xlabel('Frequency (MHz)'); +ylabel('Power (dB)'); +title('Max Channelized Spectrum (Frames + Time)'); + +%% ========================================================= +% OPTION 3 — Time-Frequency Visualization +% ========================================================= +% Collapse frames → keep time evolution +P_time = squeeze(mean(P, 2)); % [512 x nTime] + +figure; +surf(1:nTime, f_axis, 10*log10(P_time + 1e-12), 'EdgeColor','none'); +view(2); +axis tight; + +xlabel('Trigger Index'); +ylabel('Frequency (MHz)'); +title('Channelizer Output Over Time'); +colorbar; + +%% ========================================================= +% OPTIONAL — Frame evolution inside a single trigger +% ========================================================= +t_sel = 5; % pick last capture + +P_frame = squeeze(P(:,:,t_sel)); % [512 x nFrames] + +figure; +surf(1:nFrames, f_axis, 10*log10(P_frame + 1e-12), 'EdgeColor','none'); +view(2); +axis tight; + +xlabel('Frame Index'); +ylabel('Frequency (MHz)'); +title(['Channelizer Output Within DPW (Trigger ', num2str(t_sel), ')']); +colorbar; \ No newline at end of file diff --git a/utilities/post_processing/checkTimeSamples.m b/utilities/post_processing/checkTimeSamples.m index 0b7fd2a..c169b19 100644 --- a/utilities/post_processing/checkTimeSamples.m +++ b/utilities/post_processing/checkTimeSamples.m @@ -2,7 +2,7 @@ % Data % ========================================================= X = single(raw_DPW.Data); -X = X(:,:,2:end); % first DPW useless (zeroed) +X = X(:,:,1:end); % first DPW useless (zeroed) %% ========================================================= % Parameters diff --git a/utilities/soc_rfsoc_init.m b/utilities/soc_rfsoc_init.m index 47771e4..4057294 100644 --- a/utilities/soc_rfsoc_init.m +++ b/utilities/soc_rfsoc_init.m @@ -23,12 +23,9 @@ NCOCountIncDT = numerictype(1,NCOAccumWL*2,NCOAccumWL); %% Test signal parameters -% Pulse width -pulseWidth = 4e-6; - % Pulse start/end frequencies pulseCentFreq = 0e6; -pulseBw = 0e6; % Pulse bandwidth +pulseBw = 32e6; % Pulse bandwidth % Number of pulses numPulses = 10; @@ -37,11 +34,14 @@ numPulses = 10; PRF = 20e3; PRI = 1/PRF; + + +% Pulse time duration +%pulseT = 10; % use very long pulse help emulate CW +pulseT = 8e-6; + % CW mode (bypass pulse generation) CwMode = true; -if CwMode - pulseWidth = 1000; % very long pulse help emulate CW -end % Counter mode (bypass pulse and CW generation) CounterMode = true; @@ -52,7 +52,7 @@ pulseGenGain = 1; %% Software parameters % Signal generator update rate -TsSW = 0.5; +TsSW = 0.0005; %% Simulation parameters