The Designer's Guide Community Forum
https://designers-guide.org/forum/YaBB.pl Design Languages >> Verilog-AMS >> Opamp with Positive Feedback https://designers-guide.org/forum/YaBB.pl?num=1111518707 Message started by Vikram Srinivasan on Mar 22nd, 2005, 11:11am |
Title: Opamp with Positive Feedback Post by Vikram Srinivasan on Mar 22nd, 2005, 11:11am Hi everybody I could really use some help with a circuit that i am trying to simulate to generate a sigmoid function. the description of the circuit is given below, but my problem has more to do with the coding part(i think). When i run a simulation with .rise(1m) for the pulse input, i find that the simulation stalls with an error message stating that the time step used is too small. Increasing the rise parameter helps make the simulation run completely but the input voltage is not swept completely(ie: for a -2.5 to +2.5 range, i see -2.5 to -1.8v upon selecting the inputsignal in the waveform viewer). I have posted a description of the circuit below and the core portion of my code. I'd be happy to give the complete code if somebody can help me. Circuit Description: This is a voltage comparator coupled to 2 inverters. the comparator is an opamp with input sweep voltage(-2.5 to +2.5v) given through a 40kohm resistor to the +ve terminal. there is a feedback resistance of 1000kohm from output to +ve , and the neg terminal is grounded. the output of the opamp is fed to an inverter through a 600kohm resistor and the output of the inverter is again fed to another inverter through a 600kohm. there is a 100kohm resistor in the feedback loop of each inverter(from output to input). I'd like to know if I can simulate this circuit at all as such, because I read somewhere that opamps with positive feedback and grounded neg terminals are bi-stable devices with output driven to saturation state. Could somebody help me? Verilog-AMS code: opampcmos opamp1(vout1,vinp1,vinn1,vdd,vss,vref); mosinverter inv2(vinv1,vout2,vss,vdd,vref); mosinverter inv3(vinv2,vout3,vss,vdd,vref); res #(.rn(40k)) resistor1(vinr,vinp1); res #(.rn(1000k)) resistor2(vinp1,vout1); res #(.rn(600k)) resistor3(vout1,vinv1); res #(.rn(100k)) resistor4(vinv1,vout2); res #(.rn(600k)) resistor5(vout2,vinv2); res #(.rn(100k)) resistor6(vinv2,vout3); //Voltage sources and inputs vsource #(.type("pulse"),.val0(-2.5),.val1(2.5),.rise(1m))vin1(vinr,vref); vsource #(.type("dc"),.dc(15))vin2(vdd,vref); vsource #(.type("dc"),.dc(-15))vin3(vss,vref); analog V(vinn1,vref) <+ 0; endmodule My individual components(resistor,op-amp,inverter) work fine, so i am guessing that thats not the problem ! |
Title: Re: Opamp with Positive Feedback Post by Ken Kundert on Mar 22nd, 2005, 4:19pm Does the opamp model saturation? -Ken |
Title: Re: Opamp with Positive Feedback Post by Vikram Srinivasan on Mar 22nd, 2005, 5:54pm Yes, the op-amp reaches saturation state(14.something volts for a 15v supply) when tested individually. this op-amp model has been constructed using the Level-1 MOS transistor present in Cadence's verilog-A Library and using the op-amp layout described by the authors Baker,Li and Boyce in their book. I can supply the code if required. |
Title: Re: Opamp with Positive Feedback Post by Ken Kundert on Mar 22nd, 2005, 9:23pm I see two possible problems. First, your whole circuit appears to be floating (there is no ground). vref appears to be the ground node, but there is nothing in the circuit that defines it as being ground. Second, there appears to be no capacitors in the circuit. The positive feedback switching will occur in zero time because there are no capacitors. This is likely the source of you "time step too small" problem. I suggest you add a small capacitor in parallel to the 1M feedback resistor. -Ken |
Title: Re: Opamp with Positive Feedback Post by vikramts on Mar 23rd, 2005, 6:46am I'm sorry Ken. I had not supplied the entire code in my posting earlier. This is the test bench I am using. I did try adding a feedback capacitance(10pf first and then a 100 pf) but I got an error message to the effect that convergence could not be achieved.I am using the Cadence-AMS simulator for this. `include "constants.vams" `include "disciplines.vams" `timescale 10ps/1ps module cmossigvar(vinr,vinp1,vinn1,vout1,vinv1,vout2,vinv2,vout3,vdd,vss,vref); inout vinr,vinp1,vinn1,vout1,vinv1,vinv2,vout2,vout3,vdd,vss,vref; electrical vinr,vinp1,vinn1,vout1,vinv1,vinv2,vout2,vout3,vdd,vss,vref; ground vref; integer results; //Writing data into file initial begin results=$fopen("cmossigvar100.txt"); $fdisplay(results,"CMOS Sigmoid Variable Gain Model Test Bench Results:Gain=100"); forever #1000000 $fdisplay(results,"%t %f %f",$time,V(vinr),V(vout3)); $fwrite(results,"\n"); $fclose(results); end //Component Instantiation opampcmos opamp1(vout1,vinp1,vinn1,vdd,vss,vref); mosinverter inv2(vinv1,vout2,vss,vdd,vref); mosinverter inv3(vinv2,vout3,vss,vdd,vref); res #(.rn(40k)) resistor1(vinr,vinp1); res #(.rn(1000k)) resistor2(vinp1,vout1); capa #(.c(100p)) capacitf(vinp1,vout1); res #(.rn(1k)) resistor3(vout1,vinv1); res #(.rn(100k)) resistor4(vinv1,vout2); res #(.rn(1k)) resistor5(vout2,vinv2); res #(.rn(100k)) resistor6(vinv2,vout3); //Voltage sources and inputs vsource #(.type("pulse"),.val0(-2.5),.val1(2.5),.rise(1m))vin1(vinr,vref); vsource #(.type("dc"),.dc(15))vin2(vdd,vref); vsource #(.type("dc"),.dc(-15))vin3(vss,vref); analog V(vinn1,vref) <+ 0; endmodule |
Title: Re: Opamp with Positive Feedback Post by Ken Kundert on Mar 23rd, 2005, 8:39am A convergence error would suggest you are having trouble with the nonlinearities in the circuit, which would implicate opampcmos or mosinverter (assuming that res and capa are linear models). However, it would be helpful if you gave more detail about the error itself. -Ken |
Title: Re: Opamp with Positive Feedback Post by vikramts on Mar 23rd, 2005, 9:56am Hi Ken This is the error message I receive when I simulate that testbench Trying `homotopy = gmin' for initial conditions. Trying `homotopy = source' for initial conditions. Trying `homotopy = dptran' for initial conditions. Error found by spectre at time = 617.321 us during transient analysis `transient'. No convergence with minimum time step. Last acceptable solution computed at 617.321 us. The values for those nodes that did not converge on the last Newton iteration are given below. Also given is the manner in which the convergence criteria were not satisfied in the following form: Failed test: | Value | > RelTol*Ref + AbsTol V(cmossigvar.capacitf.p) = 8.41434 mV, previously 8.41599 mV. update too large: | 21.8846 uV | > 8.41434 uV + 1 uV I(cmossigvar.opamp1.resistor2:pos_neg_flow) = -9.16592 uA, previously -9.16767 uA. update too large: | -23.2304 nA | > 9.16592 nA + 1 pA V(cmossigvar.opamp1.vd11) = -14.9998 V, previously -14.9998 V. residue too large: | 633.135 pA | > 276.256 pA + 1 pA The resistor and capacitor models are linear, The opampcmos and mosinverter are gate-level descriptions of an op-amp and an inverter respectively. As such, these models work fine when tested independently.Hope this helps! |
Title: Re: Opamp with Positive Feedback Post by vikramts on Mar 23rd, 2005, 12:34pm Ken I was wondering if I could get the simulation to converge by changing the tolerance value for current and voltage. I tried to do this by writing nature Current access=I; units="A"; abstol=1e-15; endnature `include "disciplines.vams" (rest of code maintained same) Is this necessary?Will this improve the performance? I got an error message that access=I was already defined. When I specified the units and tolerance alone, the error message prompted me to supply a parameter for "access" as well. How can I correct this? Vikram |
Title: Re: Opamp with Positive Feedback Post by Ken Kundert on Mar 23rd, 2005, 1:47pm cmostsigvar is where you are having the convergence problems, but it is not found anywhere in the circuit you gave. You are still having a time step too small problem. This is because you have a jump discontintuity, which occurs if you have a region of positive feedback. You must find this and put capacitors in to slow the jump so that the simulator can follow it. If you don't want to spend the time to track it down, and if you are using Spectre, you can always use the cmin option to place capacitors everywhere. Don't play with the tolerances, the problem is with the jump. -Ken |
Title: Re: Opamp with Positive Feedback Post by vikramts on Mar 23rd, 2005, 5:36pm I'll try including capacitances at nodes and see what changes happen. I am using the AMS simulator so I dont know how to use 'cmin'. I do have another qn. What supply voltages are normally used to test op-amps in Verilog-AMS?I found that some of my models only worked for voltages around +/- 15V.Is this too high? |
Title: Re: Opamp with Positive Feedback Post by Ken Kundert on Mar 23rd, 2005, 8:25pm It is completely dependent on your model. -Ken |
Title: Re: Opamp with Positive Feedback Post by vikramts on Mar 26th, 2005, 10:16am Seems like the problem with jump discontinuities is more complex than I imagined!I found out that grounding capacitances for this purpose are usually in picofarads. However, I had to use as large as a microfarad in my model to make a simulation converge...and it still did not work the way it is supposed to. I couldnt really observe switching between saturation states. Are there any good sources I can refer to about this problem?Has anyone else had to deal with this problem?It would help to know what techniques you tried! Vikram |
The Designer's Guide Community Forum » Powered by YaBB 2.2.2! YaBB © 2000-2008. All Rights Reserved. |