The Designer's Guide Community Forum
https://designers-guide.org/forum/YaBB.pl Design Languages >> Verilog-AMS >> wreal: modeling current and voltage in one port. How to approach/idealize ??? https://designers-guide.org/forum/YaBB.pl?num=1442224908 Message started by Zorro on Sep 14th, 2015, 3:01am |
Title: wreal: modeling current and voltage in one port. How to approach/idealize ??? Post by Zorro on Sep 14th, 2015, 3:01am Hello Community, I have a question about how to approach the situation described in the subject of this thread. I have already read this thread: http://www.designers-guide.org/Forum/YaBB.pl?num=1262766115 So it is clear to me (as Andrew Beckett wrote) that: 1. It's just that you can't model both voltage and current together, because the wreal represents a signal flow representation. 2. Yes, of course, you can have wreal_current and wreal_voltage disciplines in the same design - but a single node cannot be both (that's what I meant when I said that they can't be used together). This is the situation. I have a block (DUT) which has an inout pin, let's call it vout. The pin vout is connected to another block which is actually sinking current. See picture 1. A very basic representation of what I need to model is described below. See picture 2. If Isink=0, then vout=vmax (initially) As Isink increases, the value of vout is reduced. If Isink=Imax then vout=vmin, which is the minimum value expected for vout If Isink increases to a value higher than Imax, then vout will go to zero and this also causes Isink to go to zero or in other words no current can be sinked if vout=0 Any idea/suggestion about how to approach this using only wreal? The modeling approach can be simplified as desired. The limitation is that I cannot add a new pin to represent for example the current separately and make vout react to it. Thank you. |
Title: Re: wreal: modeling current and voltage in one port. How to approach/idealize/ Post by Zorro on Sep 14th, 2015, 3:03am picture 1 |
Title: Re: wreal: modeling current and voltage in one port. How to approach/idealize/ Post by Zorro on Sep 14th, 2015, 3:03am Picture 2 |
Title: Re: wreal: modeling current and voltage in one port. How to approach/idealize ??? Post by boe on Sep 15th, 2015, 4:23am Zotto, you could use an "out of module reference" to get access to the load current in the DUT. - B O E |
Title: Re: wreal: modeling current and voltage in one port. How to approach/idealize ??? Post by Zorro on Sep 15th, 2015, 7:25am Hi boe, thank you for your feedback. I will show you what I am doing. I don't know if this is what you are suggesting. I was thinking about different approaches to solve the problem described above. After reading some literature it became clear to me that when using wreal you have to sacrify "something" (either voltage or current for this particular example) and make an abstract representation of how that part that you are not going to explicitly model affects the behavior of the device. In this case, I decided that the pin "vout" will represent the voltage. The current at the load will be represented in an "abstract" manner. In the DUT I included the code below. This is a first approach just to show how the output voltage will react to the external current. Code inside the DUT: wreal iload; real vout_var; always @(iload) begin if (iload > 100m) begin vout_var = 0.0; end else begin vout_var = 1.0; end end In my testbench I instantiate the DUT. Code inside the Testbench real slope = 1.0; always #(2n*1e12) begin iload_ctrl = iload_ctrl + slope*5m; if (iload_ctrl>200m) begin slope = -1.0; end else if (iload_ctrl<0) begin slope = +1.0; end end assign dut.iload = iload_ctrl; Now if I run a simulation I can see how the voltage at pin vout reacts to the abstract representation of the "external current". See Picture 3 and Picture 4. That external current is of course not connected to the pin vout, but this is the abstraction that I am using in order to represent the dependency vout = f(iload) Is this similar to what you are suggesting? If not, could you please explain more in detail? Thank you! Zorro. |
Title: Re: wreal: modeling current and voltage in one port. How to approach/idealize ??? Post by Zorro on Sep 15th, 2015, 7:28am Picture 3. |
Title: Re: wreal: modeling current and voltage in one port. How to approach/idealize ??? Post by Zorro on Sep 15th, 2015, 7:28am Picture 4. |
Title: Re: wreal: modeling current and voltage in one port. How to approach/idealize ??? Post by boe on Sep 16th, 2015, 8:16am Zorro wrote on Sep 15th, 2015, 7:25am:
- B O E |
The Designer's Guide Community Forum » Powered by YaBB 2.2.2! YaBB © 2000-2008. All Rights Reserved. |