Product Documentation
Real Number Modeling Guide
Product Version 22.09, September 2022

Wreal Table Models

You can use the Verilog-AMS $table_model function known from analog Verilog-A , Verilog-AMS blocks and digital context (such as in an initial or an always block) with wreal independent variables.

The following is an example illustrating how to use the $table_model function and the different options to the function. 

`include "disciplines.vams"
`timescale 1ns / 1ps

module top();
  wreal s, vdd;
  logic out;
  real r;
  vco f1 (out, vdd, s);

  initial begin
    #10 r = 1.234;
    #10 r = 5;
    #10 r = 0.45;
    #10 r = 23;
    #10 r = 4.2;
    #1 $stop;
  end
  assign s = r;
  assign vdd = 1.1;

endmodule

module vco(out, vdd, vctrl);
  output out;
  logic out;
  input vdd, vctrl;
  wreal vdd, vctrl;
  reg      osc = 1'b0;
  real tableFreq, halfper;

  always @(vdd, vctrl) begin
    tableFreq = $table_model(vdd, vctrl,"./vcoFreq.tbl",
    "3CC,1EL");
    halfper = 1/(2*tableFreq);
  end

  always begin
    #halfper osc = !osc;
  end

  assign out = osc;
endmodule

The example above calculates the VCO output frequency according to the table in the text file vcoFrep.tbl. This file is shown below:

#VDD      VCNTL      Freq/GHz
1         0          9.81
1         0.4        1.05
1         0.8        1.41
1.1       0          9.88
1.1       0.45       1.29
1.1       0.9        1.52
1.2       0          9.95
1.2       0.5        1.37
1.2       1          1.69

Assuming that the VDD=1.1 and VCNTRL=0.45, the output frequency would be 1.29 GHz. For values between the definition points (for example, VCNTRL=0.687), a linear or third-order spline interpolation is used.

Also, you can use the $table_model function to model the behavior of a design by interpolating between and extrapolating outside of data points. The syntax of the table model file, as shown in the example below, is identical to the $table_model function

The following example uses the control string ""3CC,1EL"", which specifies a 3rd order spline interpolation of the vdd variable, while the vctrl variable entries in the table are interpolated in a linear method. Input values for vdd below 1.0 or above 1.2 are clamped to 1.0 and 1.2 respectively. Input values below 0.0 for vctrl results in an error, while larger value than 1.0 is extrapolated linearly.

table_model_declaration ::=  
$table_model(variables , table_source [ , ctrl_string ] )

sub_ctrl_string ::=
              I
        |     D
        |     [ degree_char ] [ extrap_char [ extrap_char ]]

degree_char ::=
        1 | 2 | 3

extrap_char ::=
        C | L | S | E

where:

Related Topics:




 ⠀
X