The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
Jul 17th, 2024, 12:23pm
Pages: 1
Send Topic Print
Hidden states for PSS Analysis (Read 2120 times)
emax
New Member
*
Offline



Posts: 1

Hidden states for PSS Analysis
Aug 04th, 2008, 9:13am
 
I have read the article by Ken Kundert 'Hidden States in SpectreRF' but could not get rid of the hidden states for the following code. For the PSS analysis it generates error for variable 'i' for hidden state.
Please help!

`include "constants.vams"
`include "disciplines.vams"

module SAR_CL(vin,vclk,vd9,vd8,vd7,vd6,vd5,vd4,vd3,vd2,vd1,vd0,vdb9,vdb8,vdb7,vdb6,vdb5
,vdb4,vdb3,vdb2,vdb1,vdb0);
input vin,vclk;
output vd9,vd8,vd7,vd6,vd5,vd4,vd3,vd2,vd1,vd0,vdb9,vdb8,vdb7,vdb6,vdb5,vdb4,vdb3,vdb2,
vdb1,vdb0;
electrical vin,vclk,vd9,vd8,vd7,vd6,vd5,vd4,vd3,vd2,vd1,vd0,vdb9,vdb8,vdb7,vdb6,vdb5,vdb4,v
db3,vdb2,vdb1,vdb0,hold;

parameter real trise  = 100p  from [0:inf);
parameter real tfall  = 100p  from [0:inf);
parameter real tdel   = 10p   from [0:inf);
parameter real vtrans = 0.6 from [0:inf);

real comp_out;real result[0:10];
real resultb[0:10];
integer i;

  analog
  begin
     @ (initial_step)
     begin
        i = 10;
      result[10] = 1.2;
      result[9]  = 0;
      result[8]  = 0;
      result[7]  = 0;
      result[6]  = 0;
      result[5]  = 0;
      result[4]  = 0;
      result[3]  = 0;
      result[2]  = 0;
      result[1]  = 0;
      result[0]  = 0;
     end
     @ (cross(V(vclk) - vtrans, +1))
     begin
       comp_out = V(vin);
     if (comp_out > vtrans)
     begin
        result[i]    = 1.2;
        resultb[i]   = 0.0;
        result[i-1]  = 1.2;
        resultb[i-1] = 0.0;
     end
     else
     begin
        result[i]    = 0.0;
        resultb[i]   = 1.2;
        result[i-1]  = 1.2;
        resultb[i-1] = 0.0;
     end
     
       i = i - 1;
     if (i <= 0)
     begin
        i = 10;
        result[10] = 1.2;
        result[9]  = 0;
        result[8]  = 0;
        result[7]  = 0;
        result[6]  = 0;
        result[5]  = 0;
        result[4]  = 0;
        result[3]  = 0;
        result[2]  = 0;
        result[1]  = 0;
     end
     else
     begin
        i = i;
     end              
     end

     V(vd9)  <+ transition( result[10], tdel, trise, tfall );
     V(vd8)  <+ transition( result[9],  tdel, trise, tfall );
     V(vd7)  <+ transition( result[8],  tdel, trise, tfall );
     V(vd6)  <+ transition( result[7],  tdel, trise, tfall );
     V(vd5)  <+ transition( result[6],  tdel, trise, tfall );
     V(vd4)  <+ transition( result[5],  tdel, trise, tfall );
     V(vd3)  <+ transition( result[4],  tdel, trise, tfall );
     V(vd2)  <+ transition( result[3],  tdel, trise, tfall );
     V(vd1)  <+ transition( result[2],  tdel, trise, tfall );
     V(vd0)  <+ transition( result[1],  tdel, trise, tfall );

     V(vdb9) <+ transition( resultb[10], tdel, trise, tfall );
     V(vdb8) <+ transition( resultb[9],  tdel, trise, tfall );
     V(vdb7) <+ transition( resultb[8],  tdel, trise, tfall );
     V(vdb6) <+ transition( resultb[7],  tdel, trise, tfall );
     V(vdb5) <+ transition( resultb[6],  tdel, trise, tfall );
     V(vdb4) <+ transition( resultb[5],  tdel, trise, tfall );
     V(vdb3) <+ transition( resultb[4],  tdel, trise, tfall );
     V(vdb2) <+ transition( resultb[3],  tdel, trise, tfall );
     V(vdb1) <+ transition( resultb[2],  tdel, trise, tfall );
     V(vdb0) <+ transition( resultb[1],  tdel, trise, tfall );

  end

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



Posts: 1999
Massachusetts, USA
Re: Hidden states for PSS Analysis
Reply #1 - Aug 4th, 2008, 10:59am
 
I haven't completely understood your model, but it looks like what you might want to try is to set "i" based on which voltage is above zero:
 if (V(vdb0) > 0) i = 0;
 else if (V(vdb1) > 0) i = 1;
 ..

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: Hidden states for PSS Analysis
Reply #2 - Aug 6th, 2008, 9:49am
 
you are using the variable i to "remember" the value over time.. THIS IS EXACTLY what causes a hidden state.
Save NO information , keep no HISTORY in a VARIABLE..
- instead use a capacitor as an integrator to store the information you want to keep. since a capacitor is Electrical - spectreRF can "see" it and there is no hidden state..
--
good luck
Back to top
 
 

jbdavid
Mixed Signal Design Verification
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.