Hello,
I would like to model with verilog A a fully differential Schmitt trigger, to be used in a pss.
It's a very simple code. At the initial step, the threshold is set to the right value, depending on the inputs. At every subsequent crossing, the threshold is set to a new value, to take into account the hysteresis.
Unfortunately there are hidden states. Below the code:
`include "constants.vams"
`include "disciplines.vams"
module comp_hyst_FullyDiff_NH(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;
real voutp, voutn, vthaux;
analog begin
@(initial_step) begin
voutp=1.2*((V(p)-V(n))>input_offset);
voutn=1.2*((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=1.2*((V(p)-V(n))>vthaux);
voutn=1.2*((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
This module works without the red semicolon, but it has 3 hidden states: voutp, voutn and vthaux. I added the red semicolon, according with the good hint from Andrew here: http://community.cadence.com/cadence_technology_forums/f/33/t/26712 , but the behaviour is different: by adding the red semicolon in my code, it seems the initial step is skipped; moreover vthaux is still hidden.
I would like to keep the behaviuor that i get without the red semicolon and remove all the hidden states. Any suggestion about how to modify my code?
Thanks a lot!