Main Content

Design and Evaluate Segmented DAC

This example shows how to design and evaluate a segmented DAC using reference architecture and validate the DAC using the DAC Testbench. For this example, use the datasheet of AD9775. This is a commercial, off-the-shelf 14-bit DAC from Analog Devices.

Set Up Segmented DAC Testbench Model

Open the model SegmentedDACTestbench attached to this example as a supporting file. The model consists of a Segmented DAC block and a DAC Testbench.

model = 'SegmentedDacTestbench';
open_system(model);

Segmented DAC Block

The Segmented DAC block is composed of a number of segments, wired in parallel. These segments are each fed by a subset of the input data word. The results of the conversions from each segment DAC are summed to get the output for the full input word.

open_system([model '/Segmented DAC'], 'force');

The Logical Vector Conversion block splits the input word into its component bits. Inside each segment a Selector block picks the subset of the input word for that segment and another Logical Vector Conversion block converts it back to a scalar value for the segment DAC to convert. The individual segment DACs are Binary Weighted DAC blocks. Their parameter settings are set during model initialization by the Segmented DAC block. Finally, the segments' outputs are added and scaled to the reference of the Segmented DAC block.

Double click the Segmented DAC block to open the Block Parameters dialog box. Use the table in the center to set parameters of individual segments of the DAC. The effects of the table parameters on the overall operation of the DAC are summarized in the bottom right corner.

The Input polarity is set Unipolar, the Reference (V) is set to 1.20 V , the Bias (V) is set to 0 V, the Settling time (s) is set to 11e-9 s, and the Settling time tolerance (LSB) is set to 0.025 LSB based on the datasheet.

In the Segment settings table insert a row to have three rows to define a three-segment DAC architecture. Set the Bits of the top and bottom rows to 5 and the Bits of the middle row to 4. This sets the LSB segment (specified by the top row) and the MSB segment (specified by the bottom row) to each be a 5-bit DAC while the middle segment is a 4-bit DAC. Set the Offset error and Gain Error fields for all segments to 0. Click anywhere in a row or Shift+Click on multiple rows in the table to select them. When a row is selected, use the buttons on the right side of the table to move it up or down in the table changing where its segment is in relation to the input word. The top row's segment always converts the LSB and the bottom segment always converts the MSB. Use the buttons below the table to add or remove segments.

Measure DC Performance Metrics Using Endpoint Method

Double click the DAC Testbench block to open the Block Parameters dialog box. The Measurement option is selected as DC. Set the Start conversion frequency (Hz) to 9e6 Hz. In the Setup tab, click the Autofill setup parameters button to automatically propagate the DAC parameters to the testbench. Set the Settling time (s) to 21e-9 s to ensure the DC measurement results are not even partially based on the transitions between codes. In the Target Metric tab, click the Autofill target metric button to automatically propagate the DAC target metrics to the testbench. Apply the changes. Set the Recommended min simulation stop time (s) as model stop time by clicking the Set as model stop time button.

Run the simulation for 36.41 ms.

bdclose(model);
sim(model);

The measured offset and gain errors displayed on the icon of the DAC Testbench are within the Error tolerance (LSB) of their expected values.

$$ E_{\%FS} = \frac{100 \cdot E_{LSB}}{2^{N_{bits}}} = \frac{10}{2^{14}}
= 0.00061 \%FS $$

Double click the DAC Testbench block to open the Block Parameters dialog box. Click the Plot DC analysis results button to view the DAC transfer curve, endpoint nonlinearity and best fit nonlinearity.

Measure AC Performance Metrics Using a Single Tone

Double click the DAC Testbench block to open the Block Parameters dialog box. Set the Measurement option as AC . In the Stimulus tab, Start conversion frequency (Hz) is set to 9e6 Hz to allow the DAC's output to settle between conversions. In the Setup tab, click the Autofill setup parameters button to automatically propagate the DAC parameters to the testbench. Apply the changes. Set the Recommended min simulation stop time (s) as model stop time by clicking the Set as model stop time button.

set_param([model '/DAC Testbench'], 'MeasureOption', 'AC');

Open the Segmented DAC block parameters dialog and set the Offset error and Gain error entries in the Segment settings table to 0 for all segments. This prevents the linearity impairments from affecting harmonic performance.

mask = Simulink.Mask.get([model '/Segmented DAC']);
paramSegmentSettings = mask.getParameter('SegmentSettings');
ctrlSegmentSettings = paramSegmentSettings.DialogControl;
ctrlSegmentSettings.setTableCell([1, 3], 'Value', '0');
ctrlSegmentSettings.setTableCell([2, 3], 'Value', '0');
ctrlSegmentSettings.setTableCell([3, 3], 'Value', '0');
ctrlSegmentSettings.setTableCell([1, 5], 'Value', '0');
ctrlSegmentSettings.setTableCell([2, 5], 'Value', '0');
ctrlSegmentSettings.setTableCell([3, 5], 'Value', '0');

Run the simulation for 180 ms.

set_param(model, 'StopTime', '0.18');
sim(model);
Warning: The file containing block diagram '<a href="matlab:open_system
('msbUtilities')">msbUtilities</a>' is shadowed by a file of the same name
higher on the MATLAB path. This can cause unexpected behavior. For more
information see <a href="matlab:helpview([docroot
'/toolbox/simulink/helptargets.map'], 'shadowing')">"Avoiding Problems with
Shadowed Files"</a> in the Simulink documentation.

The file containing the block diagram is:
S:\22\jadams.Brf.DacExamples\matlab\toolbox\msblks\msblks\internal\msbUtilities.slx.
The file higher on the MATLAB path is:
S:\22\jadams.Brf.DacExamples\matlab\toolbox\msblks\msblks\msbUtilities.slx 

The harmonic distortion measurements are displayed on the icon of the DAC Testbench.