The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
Jul 19th, 2024, 4:24am
Pages: 1
Send Topic Print
Getting convergence info from Spectre (Read 1183 times)
Marq Kole
Senior Member
****
Offline

Hmmm. That's
weird...

Posts: 122
Eindhoven, The Netherlands
Getting convergence info from Spectre
Sep 20th, 2007, 7:08am
 
Hi,

I would like to verify the performance of a behavioral model in transient by checking out how much time the simulation that I use it in needs for the implicit DC, as well as how many Newton iterations it performs during each transient step. Is there a way to get that information from Spectre? I tried to search the documentation that comes through spectre -h, but couldn't find any reference.

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



Posts: 1999
Massachusetts, USA
Re: Getting convergence info from Spectre
Reply #1 - Sep 24th, 2007, 9:02am
 
Hi, Marq -
I've had success in some simulators using the $debug system task, which prints something for every newton iteration.  Pipe the output to a file and use the unix "wc" to count the lines that contain your magic string.  $strobe prints on convergence; you'd probably need a perl script to count how many $debugs happen between successive $strobes.

-Geoffrey
Back to top
 
 

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

Hmmm. That's
weird...

Posts: 122
Eindhoven, The Netherlands
Re: Getting convergence info from Spectre
Reply #2 - Sep 24th, 2007, 11:53pm
 
Hi Geoffrey,

Thanks - I had already considered that approach, but I had hoped there might be some built-in debug output from Spectre that could help me. The Verilog-A $debug approach will obviously have an effect on throughput time. I guess I will have to try the $debug approach.

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



Posts: 1999
Massachusetts, USA
Re: Getting convergence info from Spectre
Reply #3 - Sep 25th, 2007, 4:18am
 
You could try "audit=full" on the options line.  Do spectre -help options and scroll down to the Annotation parameters section.
Back to top
 
 

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

Hmmm. That's
weird...

Posts: 122
Eindhoven, The Netherlands
Re: Getting convergence info from Spectre
Reply #4 - Sep 26th, 2007, 1:18am
 
OK, for the benefit of the community here is the $debug Verilog-A code as well as a very kludgy shell script that does the extraction of the iteration data. It now returns the average number of iterations and the maximum number of iterations. With a little more work the variation (in terms of a Poisson distribution, of course) could be extracted as well.

This is the Verilog-A code of a simple module that writes the data out to the logfile in case of Spectre.

Code:
module stepcount;

  integer count;

  analog
    begin
	if (analysis("static")) begin
	  $debug("MINOR (DC)");
	  $strobe("MAJOR (DC) %d", count);
	end
	else
	if (analysis("tran") && !analysis("static")) begin
	  $debug("MINOR (TRAN)");
	  $strobe("MAJOR (TRAN) %d", count);
	end
	count = count + 1;
    end

endmodule // stepcount
 



And this is a function in Korn shell (/bin/ksh) style that extracts the data from the log file and creates a number of local variables that can be written out at a later stage. With some minor effort this can be turned into a more efficient Perl or Python script that does all of it and more.

Code:
IterationCount() {		# count the number of major and minor steps in
				# the logfile $2 and number of accepted steps $3
					  # if the flag $1 is 1.
  if [[ $1 -gt 0 ]]
  then \
    (( hasstepcount=1-$(grep -q -e '^MAJOR ' $2 ; echo $?) ))
    if [[ ${hasstepcount} -gt 0 ]]
    then \
	(( nminordc=$(grep -c -e '^MINOR (DC)' $2) ))
	(( nmajordc=$(grep -c -e '^MAJOR (DC)' $2) ))

	(( nminortr=$(grep -c -e '^MINOR (TRAN)' $2) ))
	(( nmajortr=$(grep -c -e '^MAJOR (TRAN)' $2) ))
	(( aveminortr=${nminortr}*1.0/${nmajortr} ))
	(( maxminortr=0 ))
	linetext0=$(grep -n -m 1 -e '^MINOR (TRAN)' $2)
	(( linenr0=$(python -c 'import sys ; s=sys.argv[1] ; r1=s.split(":")[0] ; print r1,' ${linetext0})-1 ))
	for (( count=1 ; $3-${count} ; count=${count}+1 ))
	do \
	  findtext="^MAJOR (TRAN) ${count}"
	  linetext1=$(grep -n -m 1 -e "${findtext}" $2)
	  (( linenr1=$(python -c 'import sys ; s=sys.argv[1] ; r1=s.split(":")[0] ; print r1,' ${linetext1}) ))
	  (( nlines=${linenr1}-${linenr0}-1 ))
	  if [[ ${maxminortr} -lt ${nlines} ]]
	  then \
	    (( maxminortr=${nlines} ))
	  fi
	  (( linenr0=${linenr1} ))
	done
    else \
	IterationCount 0 $2 $3
    fi
  else \
    (( nminordc=0 ))
    (( nmajordc=1 ))
    (( nminortr=0 ))
    (( nmajortr=$3 ))
    (( aveminortr=0.0 ))
    (( maxminortr=0 ))
  fi
}
 

Back to top
 
 
View Profile   IP Logged
JoRobins
New Member
*
Offline

Give and it shall be
given unto you!

Posts: 6
San Diego, CA
Re: Getting convergence info from Spectre
Reply #5 - Sep 29th, 2007, 6:00am
 
Thanks Marq. This looks fantastic. I'll try it out and see how it works for me.

Jose Smiley
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.