The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
Jul 16th, 2024, 1:27pm
Pages: 1
Send Topic Print
[q] in simulating verilog-a in hspice (Read 3320 times)
kidhyun
Junior Member
**
Offline



Posts: 14

[q] in simulating verilog-a in hspice
Nov 17th, 2006, 6:33pm
 
Dear,

  I wrote the following in the analog block in the verilog-a module.
 
analog begin

     @ ( initial_step ) begin
      sigout_file = $fopen( "out.m" );
      $fstrobe(sigout_file,"%% %s sampled at %g Hz.", "Sine Wave", 1/tsample);
      $fstrobe(sigout_file,"%% Generated by Spectre from instance `%M'");
                $fstrobe(sigout_file,"outv=[ ");
      next_sample_time = tsample;
     end
   

     @ ( timer( next_sample_time )) begin
      if (log_time == 1 ) begin
                    $fwrite(sigout_file, "%-.10g\t%-.10g", $abstime, V(sigin));
      end else begin
                    $fwrite(sigout_file, "%-.10g ", V(sigin));
                end
     //end
               if ($abstime >= next_sample_time)
                     next_sample_time = next_sample_time + tsample;
     end

     @ ( final_step ) begin
               $fstrobe(sigout_file, "]");
               $fclose(sigout_file);
     end
end

But the fstrobe commands in the initial block are executed twice.
(In the output file, there are 2 duplicates of sentences at the head.)
I don't get what's wrong with this initial keyword.

Thank You


Back to top
 
 
View Profile   IP Logged
Ken Kundert
Global Moderator
*****
Offline



Posts: 2386
Silicon Valley
Re: [q] in simulating verilog-a in hspice
Reply #1 - Nov 17th, 2006, 10:39pm
 
It might be because the initial_step is firing both in the IC phase and the transient phase of the transient analysis. It should not do that. You might be able to work around it either by adding "uic" to the transient analysis statement, or by adding an "if (!analysis("ic"))" to your module definition.

-Ken
Back to top
 
 
View Profile WWW   IP Logged
neoflash
Community Fellow
*****
Offline

Mixed-Signal
Designer

Posts: 397

Re: [q] in simulating verilog-a in hspice
Reply #2 - Nov 18th, 2006, 6:11am
 
how we probe those local variables inside verilog-a model in spice simulation?

This will make debug possible.
Back to top
 
 
View Profile   IP Logged
Geoffrey_Coram
Senior Fellow
******
Offline



Posts: 1999
Massachusetts, USA
Re: [q] in simulating verilog-a in hspice
Reply #3 - Nov 21st, 2006, 5:58am
 
neoflash wrote on Nov 18th, 2006, 6:11am:
how we probe those local variables inside verilog-a model in spice simulation?


Didn't you ask the same question in this thread:
http://www.designers-guide.org/Forum/YaBB.pl?num=1163655345
?
Back to top
 
 

If at first you do succeed, STOP, raise your standards, and stop wasting your time.
View Profile WWW   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.