Main Content

DAC Testbench

Measure DC and AC performance metrics of DAC output

Since R2020a

  • DAC Testbench block

Libraries:
Mixed-Signal Blockset / DAC / Measurements & Testbenches

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.

Examples

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

External start conversion clock for DAC, returned as a scalar. The rising edge of this signal starts the conversion process in the DAC block.

Data Types: double

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 Start conversion frequency (Hz).

Dependencies

To enable this parameter, set Measurement to AC.

Programmatic Use

Block parameter: InputFrequency
Type: character vector
Values: positive real scalar
Default: 1e3

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

Block parameter: StartFreq
Type: character vector
Values: positive real scalar
Default: 1e6

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.

Programmatic Use

Block parameter: ErrorTolerance
Type: character vector
Values: positive scalar in the range (0, 1]
Default: 0.1

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

Block parameter: NBits
Type: character vector
Values: positive real integer
Default: 10

Data Types: double

Polarity of the input signal to the DAC.

Programmatic Use

Block parameter: Polarity
Type: character vector
Values: Bipolar|Unipolar
Default: Bipolar

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

Block parameter: Ref
Type: character vector
Values: real scalar
Default: 1

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

Block parameter: Bias
Type: character vector
Values: real scalar
Default: 0

Data Types: double

The time required for the output of the DAC to settle to within some fraction of its final value, specified as a nonnegative real scalar in seconds.

Dependencies

To enable this parameter, set Measurement to DC.

Programmatic Use

Block parameter: SettlingTime
Type: character vector
Values: real scalar
Default: 0.25/1e-6

Data Types: double

The tolerance allowed for calculating settling time, specified as a positive real scalar in LSB. The output of the DAC must settle within the Settling time tolerance (LSB) by Settling time (s).

Dependencies

To enable this parameter, set Measurement to AC.

Programmatic Use

Block parameter: SettlingTimeTolerance
Type: character vector
Values: positive real scalar
Default: 0.5

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.

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).

Note

The full scale range of the converter is defined as the difference between the last and first code on the +0.5 LSB compensated transfer curve. In a +0.5 LSB compensated transfer curve, first code is 0.5 LSB wide while the last code is 1.5 LSB wide. The input values must be considered within the full scale range of the converter.

Note

LSB is calculated by the equation LSB = Full scale range of converter2NBits.

Dependencies

To enable this parameter, set Measurement to DC.

Programmatic Use

Block parameter: TargetOffsetError
Type: character vector
Values: real scalar
Default: 0 LSB

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).

Note

The full scale range of the converter is defined as the difference between the last and first code on the +0.5 LSB compensated transfer curve. In a +0.5 LSB compensated transfer curve, first code is 0.5 LSB wide while the last code is 1.5 LSB wide. The input values must be considered within the full scale range of the converter.

Note

LSB is calculated by the equation LSB = Full scale range of converter2NBits.

Dependencies

To enable this parameter, set Measurement to DC.

Programmatic Use

Programmatic Use

Block parameter: TargetGainError
Type: character vector
Values: real scalar
Default: 0 LSB

Data Types: double

References

Version History

Introduced in R2020a