Main Content

DAC Testbench

Measure DC and AC performance metrics of DAC output

  • Library:
  • Mixed-Signal Blockset / DAC / Measurements & Testbenches

  • DAC Testbench block

Description

The DAC Testbench block measures both DC and AC performance metrics of a DAC (digital to analog converter). DC performance metrics include offset error and gain error. AC performance metrics include signal-to-noise ratio (SNR), signal to noise and distortion radio (SINAD), spurious-free dynamic range (SFDR), effective number of bits (ENOB), and noise floor.

The DAC Testbench block generates the stimulus to drive the device under test (DUT) from the Stimulus tab. The setup parameters for validating the DUT are defined on the Setup tab. The target validation metrics are defined on the Target Metric tab.

You can use the DAC Testbench block to validate the DAC architecture models provided in Mixed-Signal Blockset™, or you can validate a DAC of your own implementation.

Ports

Input

expand all

Analog input signal from the DAC output, specified as a scalar.

Data Types: double

Output

expand all

Digital output stimulus signal for the DAC input, returned as a scalar.

Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32 | fixed point

Parameters

expand all

Select whether to measure static (DC) or dynamic (AC) performance metrics:

  • Select DC to measure offset error and gain error.

  • Select AC to measure SNR, SINAD, SFDR, ENOB, and noise floor.

Minimum time for which the simulation must run to obtain meaningful results, specified as a positive real scalar in seconds.

  • To measure DC performance, the simulation must run so that the DAC can sample each digital code 20 times. Based on this assumption, the Recommended min. simulation stop time (s) T is given by:

    T=Samples per bit(StartFreq/2Nbits+1)+Hold off time,

    where StartFreq is the frequency of the conversion-start clock and Nbits is the resolution of the DAC.

    The number of samples per bit is calculated using the equation:

    Samples per bit = max(1Error tolerance,10).

  • To measure AC performance, the simulation must run so that the DAC can generate six spectral updates of the DAC output. So, the Recommended min. simulation stop time (s) T is given by [1]:

    T=6(1.5RBW+Hold off time),

    where RBW is the resolution bandwidth of the spectrum estimator inside the DAC Testbench block and is given by the equation: RBW=[min(Input frequency)0.1].

This parameter is only reported by the testbench and is not editable.

Data Types: double

Click to automatically set the Recommended min. simulation stop time (s) as the stop time of the Simulink® model.

Measure the differential nonlinearity (DNL) error and integral nonlinearity (INL) error using the endpoint method. This method uses the endpoints of the actual transfer function to measure the DNL and INL errors.

Dependencies

To enable this parameter, set Measurement to DC.

Measure the differential nonlinearity (DNL) error and integral nonlinearity (INL) error using the best fit method. This method uses a standard curve-fitting technique to find the best fit to measure the DNL and INL errors.

Dependencies

To enable this parameter, set Measurement to DC.

Click to plot DC analysis result for further analysis. To perform a complete DC analysis including integral nonlinearity (INL) and differential nonlinearity (DNL), use the DAC DC Measurement block.

Dependencies

To enable this parameter, set Measurement to DC.

Click to store detailed test results to a spreadsheet (XLS file) or as comma-separated values (CSV file) for further processing.

Stimulus

Frequency of the digital input signal to the DAC block, specified as a positive real scalar in hertz. Digital input frequency (Hz) must match the input frequency of the DAC device under test.

Digital input frequency (Hz) needs to satisfy two requirements:

  • All the output codes of the DAC must be activated.

  • The Digital input frequency (Hz) must not share any common multiples other than 1 with the Conversion start frequency (Hz).

Dependencies

To enable this parameter, set Measurement to AC.

Programmatic Use

  • Use get_param(gcb,'InputFrequency') to view the current value of Digital input frequency (Hz).

  • Use set_param(gcb,'InputFrequency',value) to set Digital input frequency (Hz) to a specific value.

Data Types: double

Frequency of internal start-conversion clock, specified as a positive real scalar in Hz. Start conversion frequency (Hz) determines the rate of the DAC.

Programmatic Use

  • Use get_param(gcb,'StartFreq') to view the current value of Start conversion frequency (Hz).

  • Use set_param(gcb,'StartFreq',value) to set Start conversion frequency (Hz) to a specific value.

Data Types: double

Maximum allowed difference in the amplitude of successive samples of the digital input signal, specified as a positive real scalar in least significant bit (LSB).

Dependencies

To enable this parameter, set Measurement to DC.

Data Types: double

Setup

Click to automatically propagate setup parameters from the DAC.

Dependencies

The DAC must be a Binary Weighted DAC from the Mixed-Signal Blockset.

Number of bits in the input word, specified as a unitless positive real integer. Number of bits determines the resolution of the DAC.

Programmatic Use

  • Use get_param(gcb,'NBits') to view the current Number of bits.

  • Use set_param(gcb,'NBits',value) to set Number of bits to a specific value.

Data Types: double

Polarity of the input signal to the DAC.

Programmatic Use

  • Use get_param(gcb,'Polarity') to view the current Input polarity.

  • Use set_param(gcb,'Polarity',value) to set Input polarity to a specific value.

Reference voltage of the DAC, specified as a real scalar in volts. Reference (V) helps determine the output from the input digital code, Number of bits, and Bias (V) using the equation:

DAC output = ((Digital input code2Number of bits)Reference)+Bias.

Dependencies

To enable this parameter, set Measurement to DC.

Programmatic Use

  • Use get_param(gcb,'Ref') to view the current value of Reference (V).

  • Use set_param(gcb,'Ref',value) to set Reference (V) to a specific value.

Data Types: double

Bias voltage added to the output of the DAC, specified as a real scalar in volts. Bias (V) helps determine the output from the input digital code, Number of bits, and Reference (V) using the equation:

DAC output = ((Digital input code2Number of bits)Reference)+Bias

Dependencies

To enable this parameter, set Measurement to DC.

Programmatic Use

  • Use get_param(gcb,'Bias') to view the current value of Bias (V).

  • Use set_param(gcb,'Bias',value) to set Bias (V) to a specific value.

Data Types: double

Delay before measurement analysis to avoid corruption by transients, specified as a nonnegative real scalar in seconds.

Programmatic Use

  • Use get_param(gcb,'HoldOffTime') to view the current value of Hold off time (s).

  • Use set_param(gcb,'HoldOffTime',value) to set Hold off time (s) to a specific value.

Data Types: double

Select this parameter to display the Spectrum Analyzer window during simulation. By default, this parameter is deselected.

Dependencies

To enable this parameter, set Measurement to AC.

Select this parameter to enable increased buffer size during simulation. By default, this parameter is deselected.

Number of samples of input buffering available during simulation, specified as a positive integer scalar.

Selecting different simulation solver or sampling strategies can change the number of input samples needed to produce an accurate output sample. Set the Buffer size to a large enough value so that the input buffer contains all the input samples required.

Dependencies

To enable this parameter, select Enable increased buffer size in the Setup tab.

Programmatic Use

  • Use get_param(gcb,'NBuffer') to view the current value of Buffer size.

  • Use set_param(gcb,'NBuffer',value) to set Buffer size to a specific value.

Data Types: double

Target Metric

Click to automatically propagate target metrics from the DAC.

Dependencies

  • To enable this parameter, set Measurement to DC.

  • The DAC must be a Binary Weighted DAC from the Mixed-Signal Blockset.

Shifts quantization steps by a specific value, specified as a real scalar in %FS (percentage of full scale), FS (full scale), or LSB (least significant bit).

Dependencies

To enable this parameter, set Measurement to DC.

Programmatic Use

  • Use get_param(gcb,'TargetOffsetError') to view the current value of Offset error (LSB).

  • Use set_param(gcb,'TargetOffsetError',value) to set Offset error (LSB) to a specific value.

Data Types: double

Error in the slope of the straight line interpolating the DAC transfer curve, specified as a real scalar in %FS (percentage of full scale), FS (full scale), or LSB (least significant bit).

Dependencies

To enable this parameter, set Measurement to DC.

Programmatic Use

  • Use get_param(gcb,'TargetGainError') to view the current value of Gain error.

  • Use set_param(gcb,'TargetGainError',value) to set Gain error to a specific value.

Data Types: double

References

Introduced in R2020a