The Designer's Guide Community Forum
https://designers-guide.org/forum/YaBB.pl Design Languages >> Verilog-AMS >> Comparator with Hysteresis without hidden states https://designers-guide.org/forum/YaBB.pl?num=1432127699 Message started by clidre on May 20th, 2015, 6:14am |
Title: Comparator with Hysteresis without hidden states Post by clidre on May 20th, 2015, 6:14am 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:
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:
Do you know a way to remove the hidden states in vthaux? Thanks a lot!!!! |
Title: Re: Comparator with Hysteresis without hidden states Post by Peter Grove on Jun 15th, 2015, 11:51am I would avoid event driven blocks of code (cross/above/initial) and make it continious. The code below has no hidden states as none of the code is within an event driven block of code. e.g. (Untested) //Comparator model - continious time. comp_out = (Vin > (Vref + (comp_out ? -hyst_neg:hyst_pos))) ? 1:0; //Use above to create a timestep when it changes state. @(above(comp_out-0.5,...) or above(0.5-comp_out,...)); For comp_out to go high vin > vref+hyst_pos, to then go neg vin < vref-hyst_neg. |
The Designer's Guide Community Forum » Powered by YaBB 2.2.2! YaBB © 2000-2008. All Rights Reserved. |