The Designer's Guide Community Forum
https://designers-guide.org/forum/YaBB.pl
Design Languages >> Verilog-AMS >> Reading MATLAB into VerilogA
https://designers-guide.org/forum/YaBB.pl?num=1165850998

Message started by makelo on Dec 11th, 2006, 7:29am

Title: Reading MATLAB into VerilogA
Post by makelo on Dec 11th, 2006, 7:29am

I need help reading a test vector into Verilog-A.  I have a modulated data stream written in MATLAB that I convert to comma seperated (CSV) and upload onto my arbitrary waveform generator.  I would like to use this exact same data stream to stimulate my circuit in Cadence.

Can someone list a snippet of code to do this, an example or point me to a good reference?  Will this work in Verilog-A or do I have to use Verilog-AMS?

Thanks,
Makelo

Title: Re: Reading MATLAB into VerilogA
Post by Jess Chen on Dec 11th, 2006, 8:38am

Assuming that what you really want to do is import the Matlab waveforms into a Spectre simulation, you do not need to go through VerilogA. You may not want to use VerilogA because VerilogA in Spectre does not let you pass strings into VerilogA modules, at least the last time I checked. That means you have to change the code whenever you want to read in a different file. I think you have to open and close files and write code to read the data in line by line, or use an "include" statement. With the include statement, the included file must contain the exact syntax for defining the variables containing your data. This is all fairly clumsey in my opinion and there's a better way.

You can import the data into your simulation with Spectre primitive sources called pwlf sources. Each source imports one waveform. The data file must contain two columns of data, one column for time and the other for voltage or current. You can use spaces to separate the columns. These sources let you parameterize the file names. I don't have access to Spectre right now or I'd check, but I think you need to use double quotes around the file name.

Title: Re: Reading MATLAB into VerilogA
Post by makelo on Dec 11th, 2006, 12:18pm

So if I am reading this right.  It is better to use the PWLF to read in the MATLAB data and then either route that into a Verilog-A module or a transistor level module after that.  Sounds good!  Thanks!

Title: Re: Reading MATLAB into VerilogA
Post by Jess Chen on Dec 11th, 2006, 4:36pm

Right. I've done this many times.

I just checked. I used a port, specified the source type as pwl, and then entered the full path to the file name without quotes.

The Designer's Guide Community Forum » Powered by YaBB 2.2.2!
YaBB © 2000-2008. All Rights Reserved.