welcome to the HD camcorder video series in this video series we will learn a
popular production proven path to take a MATLAB digital signal processing
algorithm through similan fixed point designer and HDL coder to target an FPGA
in previous videos in this series we have discussed the strength of MATLAB
and Simulink created the Similan model of the pulse detection algorithm and
introduced design architecture options that accent control over speed and area
trade-offs in part 4 of the video series we will show how to convert the Similan
model to fix point data type and compare the Similan fixed point model to the
MATLAB golden reference numbers in MATLAB and Simulink default to double
precision floating point data type which is 64 bits we will convert to fixed
point data types and operations to reduce hardware resources and
computation steps in MathWorks fixed point data type is characterized by the
word size in bits the binary point and whether it is signed or unsigned the
position of the binary point is how fixed point values are scaled and
interpreted we will define our fixed point specification in the testbench
script and invoke them from the MATLAB workspace we will rename and save the
model and utilize the data type conversion block to convert the
workspace signal to fixed point the DT input specification ranges from minus 1
to 1 which is enough to represent the noisy receive signal the filter block is
set to perform multiply and add using full precision fixed point data types
and we set the coefficient data type on the filter block to DT coefficient
similan automatically propagates fixed point data types to maintain position
and visualizes it for you it is recommended to maintain full precision
until you get to a multiply and then convert it down to 18 bits so that it
maps to a single DSP slice on an FPGA to visualize the filter output
on the testbench clip pulses vector v3 TV the resultant output from the filter
block now has a word length of 40 and it's fraction length is 37 running the
test script during initial stages of conversion to fixed point will cause
errors which we will ignore for the time being in the compute power subsystem
using the data type conversion block at the input we will reduce the word length
from 40 to 18 using the DT filter specification and at the end state of
the adder reduced the word length from 36 to 18 using the DD power
specification update the model at each of the data conversion step to see the
change of the word lengths through the operations at the local peak subsystem
we will use a different method to inherit the data type by using the data
type duplicate block connect one port to the threshold constant block whose
output is set to inherit from backpropagation and under to the tab
delay block output in addition we will change the detected value in the script
of the matlab function block to true and false respectively but these changes
completed update the model and it should be error-free the error in previous
stages was due to the data type mismatch between the threshold and tap delay
block signals when comparing the two signals in MATLAB function block similan
requires the signals to be of the same type and size furthermore the detected
signal from the MATLAB function block which feeds into the unit delay enabled
block needs to be a boolean data type this is realized by changing the true
and false boolean format in the MATLAB function block script in this example we
have been able to manually convert the data types in complex designs the
fixed-point designer runs simulations and collects the required ranges and
positions from these simulations it proposes the fixed point types which one
can accept or just apply and run comparisons this is all managed in
workflow oriented graphical user interface
you can analyze and iterate quickly also keep in mind generating native
floating-point is a quick way to get started targeting hardware it will use
more resources but you can apply it to parts of your design that required a
large dynamic range to overcome tricky quantization problems using the test
branch script pulse detector v3 TB we compare the output of the MATLAB golden
reference and the fixed-point Simulink model and converting from floating-point
a fixed point we have introduced quantization errors these errors occur
due to scaling and saturation hence there is an increase error between the
MATLAB code and reference output compared to the floating-point similar
design quantization errors are expected the whole process is a trade-off between
efficiency and accuracy in the fourth part of this video series on the HDL
coder we have converted the Similan model design to fix point datatype
additionally we have showcased symlinks ability to visualize propagate data and
validate the outcome is within a tolerance in the next video we will
generate and synthesize the optimized HDL code