The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
May 8th, 2024, 1:10pm
Pages: 1
Send Topic Print
VerilogA code for instance name and read write fil (Read 7125 times)
CadenceUser888
New Member
*
Offline



Posts: 5

VerilogA code for instance name and read write fil
Oct 18th, 2006, 2:42am
 
I currently use verilogA (in cadence 2006) to simulate a component with non static internal variable that I'd like to load/store (read/write from/to a file) corresponding to its instance (number or name, like I0,I1...), since the same component is replicated many times, I don't know if it's possible to write some verilog A code and how to get the instance name from the netlist ?

Thanks
Back to top
 
 
View Profile   IP Logged
Geoffrey_Coram
Senior Fellow
******
Offline



Posts: 1998
Massachusetts, USA
Re: VerilogA code for instance name and read write
Reply #1 - Oct 18th, 2006, 6:53am
 
There's a percent-code, I think %m or %M, that is supposed to give you the hierarchical instance name when used in a $fprintf call.

I'm not sure if the code would also be available for $sprintf, or even if $sprintf is available to you, in order to make a filename string using the instance name.

And you might need to "fix it up" if the hierarchy specifiers are not valid as filenames.
Back to top
 
 

If at first you do succeed, STOP, raise your standards, and stop wasting your time.
View Profile WWW   IP Logged
jbdavid
Community Fellow
*****
Offline



Posts: 378
Silicon Valley
Re: VerilogA code for instance name and read write
Reply #2 - Oct 22nd, 2006, 10:31am
 
There are also a bunch of % codes that only work when opening the file (something like %C.%r for the circuit and standard extension? %T? for the time code)
I don't know if they have been worked into the standard, but I couldn't use them on the Verilog-digital side back in 2002.

But it sounds like what you want might be better accomplished with a paramset or even a simple string parameter for the file name.
that way rather then specifiying the file per instance name, you can create all the variations of files and assign them to an instance when you put it in the schematic.
Of course in older versions of Cadence you wont be able to use string parameters
jbd
Back to top
 
 

jbdavid
Mixed Signal Design Verification
View Profile WWW   IP Logged
CadenceUser888
New Member
*
Offline



Posts: 5

Re: VerilogA code for instance name and read write
Reply #3 - Oct 23rd, 2006, 6:42am
 
yes you're right, I can do $fopen("%C") then $fdisplay, but I'm only able to write something to file, and can't read variable from it ! Because there's just no function like $fread or $fscanf in Verilog-A of Cadence (it gives syntax error). Any idea ?

Thanks
Back to top
 
 
View Profile   IP Logged
Geoffrey_Coram
Senior Fellow
******
Offline



Posts: 1998
Massachusetts, USA
Re: VerilogA code for instance name and read write
Reply #4 - Oct 24th, 2006, 4:39am
 
Verilog-A was based on 1364-1995 (the committee is presently updating it to 1364-2005), and that (digital) Verilog standard did not have $fread.  It did have $readmemb and $readmemh, so you could try those functions...
Back to top
 
 

If at first you do succeed, STOP, raise your standards, and stop wasting your time.
View Profile WWW   IP Logged
CadenceUser888
New Member
*
Offline



Posts: 5

Re: VerilogA code for instance name and read write
Reply #5 - Oct 25th, 2006, 3:26am
 
Actually, I'm doing Verilog A (analog), $readmemb is only used in VerilogXL (digital)

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