The Designer's Guide Community Forum
https://designers-guide.org/forum/YaBB.pl Design Languages >> Verilog-AMS >> Programmable Resistor https://designers-guide.org/forum/YaBB.pl?num=1087197763 Message started by kayathi on Jun 14th, 2004, 12:22am |
Title: Programmable Resistor Post by kayathi on Jun 14th, 2004, 12:22am Hi All I am trying a model a programmable resistor. once certain conditions are satisfied the resistor's value is changed. i am able to notice the change in resistance if i apply a CONSTANT CURRENT(the voltage across it seems to increase or decrease as is expected). But, if i apply a CONSTANT VOLTAGE before and after programming the current that flows seems to remain constant. Is there anyother way to model a resistor other than V(X,Y) <+ res*I(X,Y); I don't know whats going on can somebody shed some light on it Thanks |
Title: Re: Programmable Resistor Post by Andrew Beckett on Jun 14th, 2004, 9:08am It might be useful if you posted your model so that we can identify what is wrong with it (and what you're trying to do). Andrew. |
Title: Re: Programmable Resistor Post by kayathi on Jun 14th, 2004, 1:33pm Hi Andrew pasted below is the veriloga model As u see there are 4 terminals. When the current through the terminals (inp,inn) is >27mA or <27mA and the current through (outp,outn) is between 3.6mA and 4.4.mA the resistance increases or decreases and the that state is held until the next event. I want to see this resistance change ONLY when i send a current -16.5mA<I(inp,inn)<-13.5mA. When i take two of these and change the state of only one of them and send same currents through both of them there is a voltage difference. But when i change the state of one of them and apply the same voltage for both of them the currents flowing through both of them is same and is equal to the current that would flow if there were no change of state (as opposed to having different currents as one would expect because of difference in resistances) I hope this would make my problem clear See if this helps Thanks Kayathi `include "constants.h" `include "discipline.h" module spinres2(inp,inn,outp,outn); inout inp,inn,outp,outn; electrical inp,inn,outp,outn; real res; real res_1 ; real res_0 ; parameter real cellres = 80 from (1:inf); parameter real GMR_change = 3 from (1:inf); analog begin res_1 = cellres + ((GMR_change/100) * (cellres)); res_0 = cellres - ((GMR_change/100) * (cellres)); begin @(cross ((I(inp,inn)-27m))) begin if ((I(outp,outn) >= 3.6m) && (I(outp,outn) <= 4.4m)) res = res_1; else res = res; end @(cross ((I(inn,inp)-27m))) begin if ((I(outp,outn) >= 3.6m) && (I(outp,outn) <= 4.4m)) res = res_0; else res = res; end end if ((I(inp,inn) <= -13.5m) && (I(inp,inn) >= -16.5m) && (I(outp,outn) >= 1m) && (I(outp,outn) <= 3m)) V(outp,outn) <+ res*I(outp,outn); else V(outp,outn) <+ cellres * I(outp,outn); end endmodule |
Title: Re: Programmable Resistor Post by Eugene on Jun 14th, 2004, 8:04pm It seems to me that the @cross statements are ambiguous because they do not include any direction options and trigger off similar expressions. If you don't specify the crossing direction (pos to neg or neg to pos), the event will trigger when the argument crosses in either direction. Thus, if +x crosses zero from positive to negative, -x will cross from negative to positive. Without a directional option, both will trigger. I think you should check the signs of your 27ma arguments and/or consider adding directions for triggering the event. |
Title: Re: Programmable Resistor Post by Andrew Beckett on Jun 15th, 2004, 10:18am In addition to Eugene's points about cross, there is something rather suspect about the logic in your code. In order to change the value of "res", the current flowing through the resistor has to be between 3.6mA and 4.4mA. However, you have an if out the resistor itself, which means that it has a constant value resistor unless the current is between 1mA and 3mA. You're going to have all sorts of discontinuous (and rather strange) behaviour at the very least. For debugging, I removed the final if, and put a $debug statement in to look at the values - see below. I'm sure that if you do this and think carefully about what you're doing you can get it to do what you want (whatever that might be!). Code:
By the way, here's the little netlist I used for testing the above: Code:
Regards, Andrew. |
The Designer's Guide Community Forum » Powered by YaBB 2.2.2! YaBB © 2000-2008. All Rights Reserved. |