Added draft to TBm_chirp model. Added init function script to testbench

This commit is contained in:
canisio
2026-04-02 12:03:59 -03:00
parent 790c2fdb37
commit 8e397fa41e
6 changed files with 138 additions and 0 deletions

BIN
chirp_block/TBm_chirp.slx Normal file

Binary file not shown.

122
chirp_block/soc_resm_init.m Normal file
View File

@@ -0,0 +1,122 @@
%% Rate setup
fs = 4096e6;
Ts = 1/fs;
%% Host Sample Time in Simulation
TsHost = 5e-5;
SamplesPerCycle = 16;
FPGAClkRate = fs/SamplesPerCycle;
TsFPGA = 1/FPGAClkRate;
%% Channelizer parameters
% Number of channels, maximally decimated channelizer M/D=1
nChan = 128;
% Taps per band
nTapsPerBand = 12;
% Create channelizer object
channelizer = dsp.Channelizer('NumFrequencyBands',nChan,...
'DecimationFactor',nChan,...
'NumTapsPerBand',nTapsPerBand);
% Channelizer coefficients
channelizerCoeffs = channelizer.coeffs.Numerator;
% Channel bandwidth
chanBW = fs/nChan;
% Starting frequency for each channel
chanFStart = chanBW/2:chanBW:(fs/2-chanBW/2);
% Number of frames out of channelzier
nFrames = nChan/SamplesPerCycle;
% Frame size after serializing x2
frameSize = SamplesPerCycle/2;
%% Detection parameters
% Moving average window length
movingAverageWindowLength = 64;
% Moving average comparison offset
movingAverageCompareOffset = 32;
% Threshold for ratio of current moving average to offset
thresholdScale = 500;
thresholdScaleDT = fixdt(1,18,-6);
thresholdScaleFi = fi(thresholdScale, thresholdScaleDT);
%% Tx signal generator parameters
% NCO accumulator word length
NCOAccumWL = 16;
% NCO phase increment scale factor
NCOIncScale = Ts*2^NCOAccumWL;
% NCO phase increments datatype
NCOIncDT = numerictype(1,NCOAccumWL,0);
% NCO counter increment datatype
NCOCountIncDT = numerictype(1,NCOAccumWL*2,NCOAccumWL);
%% Test signal parameters
% Pulse width
pulseWidth = 8e-6;
% Pulse start/end frequencies
pulseStartFreq = 1305e6;
pulseEndFreqOffset = 15e6;
% Number of pulses
numPulses = 2;
% Pulse repetition interval
PRI = 50e-6;
% Output gain
pulseGenGain = 1;
%% Capture parameters
% Time to capture after a detection
captureDuration = 10e-6;
captureLength = round(captureDuration*chanBW);
% Length of capture frame
% Contains I/Q data plus channel number and two words of timestamp
captureFrameLength = captureLength+3;
% Max number of capture frames in a DMA packet
captureFramesPerPacket = 50;
% Timeout to transfer a DMA packet if number of frames less than max
capturePacketTimeout = 1e-3;
%% DMA parameters
% DMA packet length
DMAPacketLength = captureFrameLength*captureFramesPerPacket;
DMAPacketSize = captureFrameLength*captureFramesPerPacket;
% Number of DMA buffers
DMANumBuffers = 8;
% DMA FIFO depth
DMAFIFODepth = 4096;
%% Software parameters
% Signal generator update rate
TsSW = 0.25;
%% Simulation parameters
% Sim run time
% stoptime = PRI*numPulses + 1e-3;
stoptime = PRI*captureFramesPerPacket + 1e-5;

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Info>
<Category UUID="FileClassCategory">
<Label UUID="design"/>
</Category>
</Info>

View File

@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<Info location="TBm_chirp.slx" type="File"/>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Info>
<Category UUID="FileClassCategory">
<Label UUID="design"/>
</Category>
</Info>

View File

@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<Info location="soc_resm_init.m" type="File"/>