Bug: `PWL file=*.wav` prevents `.func` resolution in behavioral source

Bug: PWL file=*.wav prevents .func resolution in behavioral source

I found what appears to be a parsing issue involving:

  • A voltage source using a WAV file as PWL input
  • A behavioral source
  • A user-defined .func

The behavioral source and function work correctly when the voltage source uses chirp or other directive sine etc… Replacing the source with PWL file=sweep.wav:1 causes QSPICE to report that the function does not exist.

QSPICE version/build: July 23

Working case

* this_works.qsch

V1 1 0 chirp 1 0 20 3 2K log
B1 out 0 V=foo(v(2))
R1 2 0 1K
V2 2 1 0
.tran 500m
.func foo(X)=x**2
.end
* this_works_too.qsch

V1 1 0 PWL file=sweep.wav:1
B1 out 0 V=v(2)
R1 2 0 1K
V2 2 1 0
.tran 500m
.end

This netlist runs successfully.

Failing case

* Failing.qsch

V1 1 0 PWL file=sweep.wav:1
B1 out 0 V=foo(v(2))
R1 2 0 1K
V2 2 1 0
.tran 500m
.func foo(x)=x**2
.end

The output window reports:

Fatal error: Error: no such function 'foo'
The problem occured while parsing the line:
   B1 OUT 0 V=FOO(V(2))

It appears that using a WAV-backed PWL voltage source prevents the .func declaration from being recognized by the behavioral source.

The WAV source itself works when the behavioral expression does not call the user-defined function.

Can anyone confirm whether this is reproducible?

1 Like

I think your observation is correct, and I just emailed Mike. I was able to recreate your issue with another .wav file, but the forum does not allow uploading .wav files. I thought it would be faster to just send that email.

In addition to the bug report, this is a reminder when reading an external file in PWL.

Update Qspice, and this problem should be resolved.
07/24/2026 Fixed a problem with user parameters in decks that include waveforms from other simulations.

thanks this is great info. This page/slide where is the documentation, this is helpful

I update Qspice, and it is working properly thanks for the ultra-fast turn around!

Hi, Mark. Maybe mark one of Kelvin’s responses as a solution?

–robert

1 Like

I wrote unofficial guidelines and upload to my Github. This particular slide can be found in Device Guideline, V-Source section.
https://github.com/KSKelvin-Github/Qspice/blob/main/Guideline/README.md

Since you work on .wav file, just in case you not aware Listen to Trace feature yet.
https://forum.qorvo.com/t/where-has-the-opportunity-to-listen-to-signals-disappeared/24767/2

awesome resources, thanks!

1 Like