The Designer's Guide Community Forum
https://designers-guide.org/forum/YaBB.pl Design Languages >> Verilog-AMS >> how to implement solver with digital outputs https://designers-guide.org/forum/YaBB.pl?num=1279631291 Message started by Ari on Jul 20th, 2010, 6:08am |
Title: how to implement solver with digital outputs Post by Ari on Jul 20th, 2010, 6:08am I am trying to implement in Verilog-A something doable with standard analogLib cells. I wish to implement Verilog-A cell with two inputs: vin,vref and digital output bus :vsel[5:0] (fig. A) The cell should set vsel[5:0] control bits such that vin-vref is minimal. vsel[5:0] connects/disconnects 6 resistor finger (monotonically increasing in size), by than changing vin. While it is relatively easy to implement such cell in analogLib cell, using successive approximation method, I was unsuccessful implementing it in Verilog-A. To make my point clear : had the variable resistor been continuous varistor (fig. B), it would be easy to implement such controller through the implicit assignment: V(vout) : V(vin)=V(vref) ![]() Any ideas on how to implement such discrete controller (successive approximation or other method), and general suggest a method for discrete optimization? Regards, Ari |
Title: Re: how to implement solver with digital outputs Post by boe on Jul 20th, 2010, 9:50am Ari wrote on Jul 20th, 2010, 6:08am:
Quote:
It would help if you could give a bit more information (see also Forum guidelines): What did you do that did not work? Can you post the code? What type of simulations do you want to perform? What effects do you want to model? Which simulator do you use (Spectre?)? ... BOE |
Title: Re: how to implement solver with digital outputs Post by Ari on Jul 21st, 2010, 2:11am Boe, Thank you for your reply. Since I have analogLib implementation, I am more interested at the capabilities of Verilog-A, rather than getting it implemented. I always through Verilog-A can do better than standard analogLib structures, but now I am skeptic. I am attaching the schematics of the analogLib implementation. As you can see, I use several instances of the discrete varistor to perform the binary search. As for my Verilog-A attempts, I would like to have something like this, which is totally illegal in Verilog-A... Code:
|
Title: Re: how to implement solver with digital outputs Post by boe on Jul 21st, 2010, 4:49am Ari, Using several instances of dividers, you could of course replicate this in Verilog-A. Another possibility is to feed bus of all taps of the resistive divider to the Verilog-A model. Trying to use one resistive divider and run an instantaneous search over the digital control signals for every simulation time point without access to internal states is unphysical (i.e. you cannot do this in reality) anyway. If you want to model a successive approximation algorithm you need some kind of timing/clock (timer event or external clock): After every clock you do a comparision, change the output until algorithm converges. BOE PS: You could also exploit knowledge of the divider characteristics in your Verilog-A controller. PPS: Does this help? |
Title: Re: how to implement solver with digital outputs Post by Geoffrey_Coram on Jul 21st, 2010, 5:11am Ari wrote on Jul 21st, 2010, 2:11am:
That for-loop doesn't make any sense... I'm still not entirely clear on what you are trying to do: the original schematic looked like you wanted the Verilog-A module to set some control bits, but I don't understand how those bits would affect the resistor. Are you intending to write the resistor in Verilog-A also? It sort of seems like you are writing an ADC -- taking the analog vref and converting it to a set of digital bits that set the resistor; you just happen to use the resistor to then generate vin. |
Title: Re: how to implement solver with digital outputs Post by Ari on Jul 21st, 2010, 6:31am Hi, My hope was to avoid the multiple instantiation when using Verilog-A. I thought I could propagate the intermediate values within the DC operating point internal stage. So, in the current situation, I am left with the following clumsy code: Code:
any ideas on how to make this code a bit more elegant? |
Title: Re: how to implement solver with digital outputs Post by boe on Jul 21st, 2010, 7:34am Ari, For a asynchronous solution I'd try somethig like: Code:
BOE PS: This is the lazy implementation, you could of course add binary search. |
Title: Re: how to implement solver with digital outputs Post by Ari on Jul 21st, 2010, 8:37am Boe, I think you code is missing something : 1. The number of taps should be equal to the number of select bits. We duplicate the divider N times (2^N is the divider resolution) each instance decides on single bit. Therefore rtap_in should be : Code:
2. You should also have N duplicates of the select outputs, each controlling one of the dividers. As for your last comment : I think my implementation is based on binary search. Was that what you were referring to ? Thanks, Ari |
Title: Re: how to implement solver with digital outputs Post by boe on Jul 21st, 2010, 10:29am Ari, Your approach is a pipelined binary weighted approach generating 1 bit per divider. I suggested a flash approach: compare input signal to all signal thresholds and translate resulting thermometer code to binary weighted result. You could also modify this to a successive approximation approach by adding some event control and an iterative binary search over the code space. Since I don't know what you want to model, I cannot propose the "right" solution for your problem... I referred to binary search in order to point out implementation options of conversion to binary coded output. BOE Does this help? |
Title: Re: how to implement solver with digital outputs Post by Ari on Jul 21st, 2010, 1:47pm Boe, First - thank you ! Let's see if I understand you correctly : in your flash implementation you need 2^N (N number of divider control bits) instantiation of the divider, each with different hard wire select bits. In this implementation, there is not loop : you just iterate through the different instances (each with its select bits) till you find the 1st tap which is lower than vref (you assume monotonicity, of course) While this approach uses very elegant and small Verilog-A code, it affects dramatically the OP calculation when N is large. Am I correct ? I am still bothered with the question whether implicit function can be used in such case, avoiding the multiple instance of the divider. .. Thanks again, Ari |
Title: Re: how to implement solver with digital outputs Post by boe on Jul 22nd, 2010, 7:04am Ari, No, I'd use one divider consisting of 2^N resistors (resistor string) creating 2^N output voltages (I assume this is what you use in your controllable divider anyway). Just instead of using switches to select one voltage I'd output all of them and compare each to the input voltage. Such a resistor string is inherently monotonic, so I used this in the decoder. BOE (Added) PS: If you use another topology, you can of course adapt the code accordingly. PPS: What kind of ADC do you want to model? |
Title: Re: how to implement solver with digital outputs Post by boe on Jul 22nd, 2010, 10:06am Ari, One more thing: If you want to do successive approximation with only one divider, you need some kind of clock/timing to define sequence of operations (for each bit set reference, settling, compare). This can be done using either external clock and cross event or using timer event (internal clock). BOE |
The Designer's Guide Community Forum » Powered by YaBB 2.2.2! YaBB © 2000-2008. All Rights Reserved. |