Product Documentation
Virtuoso Visualization and Analysis XL SKILL Reference
Product Version IC23.1, November 2023

awvDigital2Analog

awvDigital2Analog(
o_waveform
n_vHi
n_vLo
s_VX
[ ?mode s_mode ]
[ ?outWaveType s_outWaveType ]
[ ?vprevSTART s_vprevSTART ]
)
=> o_waveform / nil

Description

Returns the analog form of the specified digital waveform.

Arguments

o_waveform

Represents the digital waveform that is to be converted to analog.

This may be a simple wave or bus, a list of waves or buses, a string representing the expression yielding a wave or bus.

n_vHi

The high analog value to which the digital 1 (for single-bit waveform) or maximum possible bus value is converted.

n_vLo

The low analog value to which the digital 0 (for single-bit waveform) or minimum possible bus value is converted.

s_VX

The value to which state X of the digital wave is converted.

It can be a number or a simple expression of vhi, vlo and vprev (that is, the previous value) in the form of a string.

?mode s_mode

A string to be provided if o_waveform is a bus or it is a list with at least one bus.

Valid values are:

  • wavelist: The input bus is converted into a list of analog waves, each representing a single-bit digital waveform in the bus.
  • busvalue: The output is a single analog wave, representing the value of the input bus.

?outWaveType s_outWaveType

A string to be provided if o_waveform is a bus or it is a list with at least one bus.

Valid values are:

  • pwl: The points in the output analog waveform are joined by straight line segments.
  • zeroT: The output analog waveform has voltage transitions in zero time.

?vprevSTART s_vprevSTART

The initial value of vprev to be used.

This is required if the specified digital waveform starts at state X and vprev is used in the expression for s_VX.

This value overrides the value specified by the .cdsenv variable vprevSTART for the tool calculator.d2.

Value Returned

o_waveform

A waveform is returned if the input is a single-bit digital waveform or if the input is a bus and the specified s_mode is busvalue.

A list of waveforms is returned if the input is a list of single-bit digital waveforms or if the input is a bus and the specified s_mode is wavelist.

nil

Analog output of the specified digital input cannot be returned because of an error.

Examples

The following example returns the waveform of the signal topLevel.net[0].

w1=v("topLevel.net[0]" ?result "tran" ?resultsDir "/servers/user/design/mixed_signal.raw")
=> srrWave:0x3603d1b0

The following example returns the waveform of the signal topLevel.net[1].

w2=v("topLevel.net[1]" ?result "tran" ?resultsDir "/servers/user/design/mixed_signal.raw")
=> srrWave:0x3603d1c0

The following example converts the analog waveform w1 to a digital waveform w3.

w3=awvAnalog2Digital(w1 1.8 0 nil 20n  "hilo")
=> srrWave:0x3603d1e0

The following example converts the analog waveform w2 to a digital waveform w4.

w4=awvAnalog2Digital(w2 1.7 0 nil 20n  "hilo")
=> srrWave:0x3603d1f0

The following example creates a bus busSignal from two digital signals w3 and w4.

busSignal=awvCreateBus("myBus" list(w3 w4) "Binary")
=> srrWave:0x3603d200

Returns the analog, zero transition wave representing the specified digital bus busSignal.

w5=awvDigital2Analog(busSignal 1.8 0 "vhi+vlo/2.0" ?mode "busvalue" ?outWaveType "zeroT")
=> srrWave:0x3603d210

Returns a list of analog waveforms.

waveList=awvDigital2Analog(busSignal 1.8 0 "vhi+vlo/2.0" ?mode "wavelist" ?outWaveType "pwl")
=> (srrWave:0x3603d230 srrWave:0x3603d240)

The following examples create waveform objects wave0, wave1, wave2, and wave3 with the specified x- and y-vector values.

list0=list(list(0.0 1e-06 1e-06 3e-06) list(0.0 0.0 5.0 5.0))
    xvec=drCreateVec('double car(list0))
    yvec=drCreateVec('double cadr(list0))
    wave0=drCreateWaveform(xvec yvec)
    drGetWaveformXVec(wave0)~>units="s"
    drGetWaveformXVec(wave0)~>name="time"
=>
((0.0 1e-06 1e-06 3e-06) 
    (0.0 0.0 5.0 5.0)
)
=> srrVec:0x2d740020
=> srrVec:0x2d740030
=> srrWave:0x2d784020
=> "s"
=> "time"
list1=list(list(0.0 2e-06 2e-06 3e-06) list(0.0 0.0 5.0 5.0))
    xvec=drCreateVec('double car(list1))
    yvec=drCreateVec('double cadr(list1))
    wave1=drCreateWaveform(xvec yvec)
    drGetWaveformXVec(wave1)~>units = "s"
    drGetWaveformXVec(wave1)~>name = "time"
=>
((0.0 2e-06 2e-06 3e-06) 
    (0.0 0.0 5.0 5.0)
)
=> srrVec:0x2d740060
=> srrVec:0x2d740070
=> srrWave:0x2d784030
=> "s"
=> "time"
list2=list(list(0.0 1e-06 1e-06 3e-06) list(5.0 5.0 0.0 0.0))
    xvec=drCreateVec('double car(list2))
    yvec=drCreateVec('double cadr(list2))
    wave2=drCreateWaveform(xvec yvec)
    drGetWaveformXVec(wave2)~>units="s"
    drGetWaveformXVec(wave2)~>name="time"
=>
((0.0 1e-06 1e-06 3e-06) 
    (5.0 5.0 0.0 0.0)
)
=> srrVec:0x2d7400a0
=> srrVec:0x2d7400b0
=> srrWave:0x2d784040
=> "s"
=> "time"
list3=list(list(0.0 2e-06 2e-06 3e-06) list(5.0 5.0 0.0 0.0))
    xvec=drCreateVec('double car(list3))
    yvec=drCreateVec('double cadr(list3))
    wave3=drCreateWaveform(xvec yvec)
    drGetWaveformXVec(wave3)~>units="s"
    drGetWaveformXVec(wave3)~>name="time"
=>
((0.0 2e-06 2e-06 3e-06) 
    (5.0 5.0 0.0 0.0)
)
=>srrVec:0x2d7400e0
=> srrVec:0x2d7400f0
=> srrWave:0x2d784050
=> "s"
=> "time"

The following example creates a Waveform window and returns its window ID.

win1=awvCreatePlotWindow()
=> window:3
awvPlotWaveform(
  win1
  list(wave3 wave2 wave1 wave0)
  ?expr list("bit3" "bit2" "bit1" "bit0")
  ?color list("y6" "y12" "y18" "y24")
  ?lineType list("line" "line" "line" "line")
  ?lineStyle list("solid" "solid" "solid" "solid")
  ?lineThickness list("thick" "thick" "thick" "thick")
  ?showSymbols list(t t t t)
  ?dataSymbol list(9 6 7 3)
  )
=> t

The following examples create digital signals from the specified analog waveforms.

dig0=awvAnalog2Digital(wave0 nil nil 2.5 nil "centre")
dig1=awvAnalog2Digital(wave1 nil nil 2.5 nil "centre")
dig2=awvAnalog2Digital(wave2 nil nil 2.5 nil "centre")
dig3=awvAnalog2Digital(wave3 nil nil 2.5 nil "centre")
=> srrWave:0x2d784060
=> srrWave:0x2d784070
=> srrWave:0x2d784080
=> srrWave:0x2d784090

The following example creates a digital bus myBus from the specified list of digital signals dig0, dig1, dig2, and dig3.

myBus=awvCreateBus("myBus" list(dig0 dig1 dig2 dig3) "Binary")
=> srrWave:0x2d7840a0

The following example creates a Waveform window and returns its window ID.

win2=awvCreatePlotWindow()
=> window:4

The following example plots the bus myBus in the Waveform window win2.

awvPlotWaveform(
  win2
  list(myBus)
  ?expr list("myBus")
  ?color list("y18")
  )
=> t

The following example converts myBus into a list of analog signals, each representing a single-bit digital waveform in the bus.

analogList=awvDigital2Analog(myBus 3.5 0.5 "vhi+vlo/2.0" ?mode "wavelist" ?outWaveType "pwl")
=>
(srrWave:0x2d7840b0 srrWave:0x2d7840c0 srrWave:0x2d7840d0 srrWave:0x2d7840e0)

The following example plots analog signals contained in the list analogList. in the current Waveform window.

n=0
for(
  i 1 length(analogList)
  plot(nth(n analogList))
  ++n
 )


Return to top
 ⠀
X