emax
New Member
Offline
Posts: 1
|
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
|