Hello,
I wrote a code in VerilogA that models a fully-differential comparator with hysteresis, to be used in a pss.
The code works in transient simulations, but not in pss, because the variable vthaux has hidden states.
My code is the following:
Code:`include "constants.vams"
`include "disciplines.vams"
module comp_hyst_FullyDiff_NH2(outp, outn, p, n);
output outp, outn;
electrical outp, outn;
input p,n;
electrical p,n;
parameter real input_offset=0;
parameter real hyst_offset=0.1;
parameter real trise=10p;
parameter real tfall=10p;
parameter real logic_high=1;
real voutp, voutn, vthaux;
analog begin
@(initial_step) begin
voutp=logic_high*((V(p)-V(n))>input_offset);
voutn=logic_high*((V(p)-V(n))<=input_offset);
vthaux=input_offset+hyst_offset*((V(p)-V(n))<=input_offset)-hyst_offset*((V(p)-V(n))>input_offset);
end
@(cross(V(p)-V(n)-vthaux));
begin
voutp=logic_high*((V(p)-V(n))>vthaux);
voutn=logic_high*((V(p)-V(n))<=vthaux);
vthaux=input_offset+hyst_offset*((V(p)-V(n))<=vthaux)-hyst_offset*((V(p)-V(n))>vthaux);
end
V(outp) <+ transition(voutp,trise,tfall);
V(outn) <+ transition(voutn,trise,tfall);
end
endmodule
I need that the variable vthaux (i.e. the threshold+hysteresis) is set to the right value at the initial step, so I cannot initialize it with a fixed value.
If I try a pss, I get the following error:
Code: ERROR (SPCRTRF-15177): PSS analysis doesn't support behavioral module components with hidden states found in component 'comp_hyst_FullyDiff_NH2'. Skipped.
/misc/cadence/comp_hyst_FullyDiff_NH2/veriloga/veriloga.va, declared in line 22: Hidden state variable: vthaux
Do you know a way to remove the hidden states in vthaux? Thanks a lot!!!!