Home > Community > Forums > Custom IC Design > Tip of the Week: Easily program digital bus values for analog sims

Email

* Required Fields

Recipients email * (separate multiple addresses with commas)

Your name *

Your email *

Message *

Contact Us

* Required Fields
First Name *

Last Name *

Email *

Company / Institution *

Comments: *

 Tip of the Week: Easily program digital bus values for analog sims 

Last post Tue, Jul 17 2007 1:03 PM by archive. 7 replies.
Started by archive 17 Jul 2007 01:03 PM. Topic has 7 replies and 3431 views
Page 1 of 1 (9 items)
Sort Posts:
  • Tue, Jul 17 2007 1:03 PM

    • archive
    • Top 75 Contributor
    • Joined on Fri, Jul 4 2008
    • Posts 88
    • Points 4,930
    Tip of the Week: Easily program digital bus values for analog sims Reply

    There exists in the "bmslib" library a Veriloga test block that takes any decimal value and loads a digital bus with the binary equivalent.  Very useful for setting the value of digital buses for simulation. 
     
    The component is called "busset8" (for the 8-bit version) or "busset4" (a 4-bit version), but one nice feature is that you can easily copy it and create any arbitrary bus size simply by changing the pin on the symbol, and changing the "NUMBITS" variable inside the Veriloga.  Even a non-Veriloga writer like myself can easily do it.
     
    As an example of its use, if you wanted to set an 8-bit bus to 00001001, you would program the "setval" parameter on the symbol to "9".  (NOTE - you must set the "Tools Filter" radial button to "veriloga" to see the setval parameter to edit it.)  The output high and low levels are programmable.  The setval can also be set to a simulation parameter so that you can easily modify it in your Artist State setups.

    These components also have Verilog-AMS views (which are similarly easy to modify) if you are running AMS instead of Spectre.
     
    - Hugh


    Originally posted in cdnusers.org by Hugh
    • Post Points: 0
  • Thu, Jul 26 2007 10:42 AM

    • archive
    • Top 75 Contributor
    • Joined on Fri, Jul 4 2008
    • Posts 88
    • Points 4,930
    RE: Tip of the Week: Easily program digital bus values for analog sims Reply

    Hi Hugh, Nice tip. However, one more thing must be done when people copy it to make their own arbitrary bus sizes: rename the module within the veriloga code! For example, a 16 bit bus would need: module busset8(outbus); -> module busset16(outbus); Also, a question about these bussets. Can the setval parameter be changed at some point in time during a transient simulation? If so, what are the various options for doing so and which do you recommend? Thanks. SGG_RFIC


    Originally posted in cdnusers.org by SGG_RFIC
    • Post Points: 0
  • Thu, Jul 26 2007 10:50 AM

    • archive
    • Top 75 Contributor
    • Joined on Fri, Jul 4 2008
    • Posts 88
    • Points 4,930
    RE: Tip of the Week: Easily program digital bus values for analog sims Reply

    You are right - I guess I assumed that copying and renaming the cell (hopefully to a library under your own control!) went without saying, but I should have included that step.

    Regarding whether (or how) you would change the setval during simulation, I can not think of how you would be able to do that with the cell as it is.  Of course, you could use a couple of them, set to different values, and then analog switches to toggle between, but that's a bit messy.  I think ideally a knowledgable Veriloga writer (which I am not) would probably be better off building a version of this cell that takes a voltage input as the "setval" parameter.  Then, a vpwl or vpulse could be used to dynamically change the setval property. 

    - Hugh


    Originally posted in cdnusers.org by Hugh
    • Post Points: 0
  • Thu, Jul 26 2007 11:12 AM

    • archive
    • Top 75 Contributor
    • Joined on Fri, Jul 4 2008
    • Posts 88
    • Points 4,930
    RE: Tip of the Week: Easily program digital bus values for analog sims Reply

    Hi Hugh, Yes, I have done the messy method, but am looking for a cleaner solution. :-) Alas, I am not very experienced with Veriloga either (usually I know just enough to get by on), so I am hoping someone might help us. Hint, hint... Somehow, I was under the impression that the bit assignment was only performed at the beginning of a simulation due to the use of the 'generate' command. Thus, adding another input to be driven by a source would not help. Anyone know more about this? -SGG_RFIC


    Originally posted in cdnusers.org by SGG_RFIC
    • Post Points: 0
  • Thu, Jul 26 2007 2:05 PM

    • archive
    • Top 75 Contributor
    • Joined on Fri, Jul 4 2008
    • Posts 88
    • Points 4,930
    RE: Tip of the Week: Easily program digital bus values for analog sims Reply

    Actually, I am not thinking very clearly here - what you are really looking for is simply an ideal DAC.  There already exists such an animal in the bms library, called dac_BiOB_8.  If you set up the reference voltage correctly, then you can just feed this an analog input voltage and get whatever digital output you want.  (For this particular DAC you will also need to feed it a clock signal each time you change the value.)

    It appears that this, too, could be copied (to a different name!) and scaled to a different bus size by changing the internal SIZE parameter (plus pin names, etc., and maybe also the internal note that talks about number of states, just to be consistent).  I have not tried it though, so no guarantees!

    - Hugh


    Originally posted in cdnusers.org by Hugh
    • Post Points: 0
  • Thu, Jul 26 2007 2:09 PM

    • archive
    • Top 75 Contributor
    • Joined on Fri, Jul 4 2008
    • Posts 88
    • Points 4,930
    RE: Tip of the Week: Easily program digital bus values for analog sims Reply

    OOPS!  What I meant to say was, an ideal ADC - not a DAC!  There is one of those too in bmslib - called adc_BiOB_8.  And the parameter you would change appears to be the HIBIT parameter.

    Sorry for any confusion.

    - Hugh


    Originally posted in cdnusers.org by Hugh
    • Post Points: 0
  • Thu, Jul 26 2007 2:27 PM

    • archive
    • Top 75 Contributor
    • Joined on Fri, Jul 4 2008
    • Posts 88
    • Points 4,930
    RE: Tip of the Week: Easily program digital bus values for analog sims Reply

    Yes, I had briefly looked at that, but I disliked adding yet another clock signal just to trigger the change in value. It is cleaner than the 2 bussets + switch, though. I just wish veriloga had the same type of regular event control that verilog has, not just the analog event controls. Then a simple always @(setval) would cause the change in value. But I'm not going to switch to spectreVerilog just to get that. Sure seems like there should be a cleaner way... -SGG_RFIC


    Originally posted in cdnusers.org by SGG_RFIC
    • Post Points: 0
  • Tue, Aug 14 2007 2:20 PM

    • archive
    • Top 75 Contributor
    • Joined on Fri, Jul 4 2008
    • Posts 88
    • Points 4,930
    RE: Tip of the Week: Easily program digital bus values for analog sims Reply

    Its relatively easy to add a clock signal (or a period parameter) and make that block a "counter", or two make it switch between 2, 3 or a fixed set of numbers.. since parameters are "fixed" for a given simulation, you would have to add an input pin.

    VERILOG has a nice feature called "tasks" so in the ams version you can create and activate tasks in your tcl script to set the value to an arbitrary value.. but this doesn't work in spectre..
    HOWEVER you can pass its variable from an Artist Design Variable, so that you can do a DC or AC (or parametric ) sweep of that variable - THAT was the reason I create the first version of that, and I found I was recreating it for successive customers.. finally we got a chance to create the bmslib, and make it available to everyone.. So I'm quite glad to hear you find it useful.

    Here is an RF analysis compatible version of busset4 that counts..


    // jbdavid
    `include "constants.vams"
    `include "discipline.vams"
    `define MAXBIT 3
    /======
    (*instrument module*)
    module busset4 (outbus)
    output [`MAXBIT:0] outbus;
    electrical [`MAXBIT:0] outbus;
    parameter integer setval = 0 from [0:(1<<`MAXBIT+1)-1] ;
    parameter real vhigh = 1.5
    parameter real vlow = 0;
    parameter integer countdir = 0 from [-1:1]; //down, dont count, up
    parameter real startcounting = 5n;
    parameter real period = 5n;
    parameter real trf = 10p;
    integer outval;
    analog begin
    if (analysis("tran")) begin
    @(initial_step) begin
    outval = setval;
    end
    @timer(startcounting,period) if (countdir) begin
    outval = (outval+countdir)%(1<<`MAXBIT+1);
    end
    generate j (`MAXBIT, 0) begin
    V(outbus[j]) <+ transition(outval&1< end
    end else begin
    outval = 0; // this is required to work with RF sims
    generate j (`MAXBIT, 0) begin
    V(outbus[j]) <+ (setval&(1< end
    end
    end
    endmodule
    `UNDEF MAXBIT

    thats what I use now.. - by default it works just like the old one, but it ALSO counts in a transient if I want it to..
    HTH,
    Jonathan


    Originally posted in cdnusers.org by jbdavid
    • Post Points: 0
  • Tue, Aug 14 2007 2:21 PM

    • archive
    • Top 75 Contributor
    • Joined on Fri, Jul 4 2008
    • Posts 88
    • Points 4,930
    RE: Tip of the Week: Easily program digital bus values for analog sims Reply

    the instrument module line SB
    (* instrument_module *)
    jbd


    Originally posted in cdnusers.org by jbdavid
    • Post Points: 0
Page 1 of 1 (9 items)
Sort Posts:
Started by archive at 17 Jul 2007 01:03 PM. Topic has 7 replies.