The Designer's Guide Community Forum
https://designers-guide.org/forum/YaBB.pl
Design Languages >> Verilog-AMS >> Using $table_model with time as one axis
https://designers-guide.org/forum/YaBB.pl?num=1353589209

Message started by RolfK on Nov 22nd, 2012, 5:00am

Title: Using $table_model with time as one axis
Post by RolfK on Nov 22nd, 2012, 5:00am

Dear Experts,

I would like to trigger a curent wave by some event.
The event could by a kind of clock signal or an abstract verilog named event.

My questions is a conceptual one.
In case I would use a table model like shown below, I could imagine to assign it to a signal.
The constant inputs are MIN|TYP|MAX (as enumerator 0,1,2) and the current simulation dtime (time - the start time of this process ).
This way I hope the simulator interpolates the current given by the table dependent on simulation time.
This is quite similar to a PWL. BUT, I do not know how to start a PWL on some event and additinally it looks very benefitial to me to have the option of more consatnt parameters in one table.

Here is some PSEUDO CODE snipet:
analog
     @(starting event) begin
           start_time = 0 ;
           always(@ $current_time ) begin
                 dtime = $current_time - start_time ;
                 I(p,n) n <+ $table_model (TYP, dtime , "iwave.tbl", "?,?,?") ;
           end
     end
end

######### table file #########################
// Look up table for i(t) 2d with time
//      Index      mtm            time      current
     1            0            0                  0
     2            0            1.00e-12      0.1
     3            0            2.00e-12      0.3
     4            0            10.00e-12      0.05
     5            1            0                  0  
     6            1            1.00e-12      0.15      
     7            1            2.00e-12      0.35
     8            1            10.00e-12      0.06
     9            2            0                  0  
     10            2            1.00e-12      0.2
     11            2            2.00e-12      0.4
     12            2            10.00e-12      0.07


If there is some alternative or better idea I wopuld like to learn about it.
Additionally I need to learmn more about the control string.
I had a look into the Cadence Verilog-A Reference model, but did not find an exhaustive explantion there.

Thanks a lot

RolfK

Title: Re: Using $table_model with time as one axis
Post by Geoffrey_Coram on Nov 26th, 2012, 6:30am

Your pseudo-code isn't right; you shouldn't have everything inside the @(starting event), and you shouldn't have contributions inside an event.  I've re-written it below, assuming you want 0 current up until the trigger event.

analog begin
     @(initial_step) begin
           start_time = 0;
           enable = 0;
     end
     @(starting event) begin
           start_time = $abstime;
           enable = 1;
     end
     if (enable) begin
           dtime = $abstime - start_time ;
           ival = $table_model (TYP, dtime , "iwave.tbl", "?,?,?") ;
     end else begin
           ival = 0 ;
     end

     I(p,n) n <+ ival;

end // analog

The Designer's Guide Community Forum » Powered by YaBB 2.2.2!
YaBB © 2000-2008. All Rights Reserved.