The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
Jul 16th, 2024, 4:14pm
Pages: 1
Send Topic Print
Reading MATLAB into VerilogA (Read 142 times)
makelo
Community Member
***
Offline



Posts: 34
Hillsboro, OR
Reading MATLAB into VerilogA
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
Back to top
 
 
View Profile   IP Logged
Jess Chen
Community Fellow
*****
Offline



Posts: 380
California Bay Area
Re: Reading MATLAB into VerilogA
Reply #1 - 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.
Back to top
 
 
View Profile   IP Logged
makelo
Community Member
***
Offline



Posts: 34
Hillsboro, OR
Re: Reading MATLAB into VerilogA
Reply #2 - 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!
Back to top
 
 
View Profile   IP Logged
Jess Chen
Community Fellow
*****
Offline



Posts: 380
California Bay Area
Re: Reading MATLAB into VerilogA
Reply #3 - 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.
Back to top
 
 
View Profile   IP Logged
Pages: 1
Send Topic Print
Copyright 2002-2024 Designer’s Guide Consulting, Inc. Designer’s Guide® is a registered trademark of Designer’s Guide Consulting, Inc. All rights reserved. Send comments or questions to editor@designers-guide.org. Consider submitting a paper or model.