W elcome to
Fintronic USA

redball.gif (326 bytes)About Fintronic USA

redball.gif (326 bytes)Main announcements

redball.gif (326 bytes)What's new at Fintronic

redball.gif (326 bytes)What our customers are saying...

redball.gif (326 bytes)Support for SystemC

redball.gif (326 bytes)Support for Verilog 2001

redball.gif (326 bytes)Third party tools integrated with FinSim(Specman, Denali, Debussy, Undertow, Vera, VirSim, HDL Score, Comet, Meteor, NelSim, Pivot, DeskPOD, @Designer 2.1)

home.htmlProductsSupportEvaluateContact

Symbolic evaluation, differentiation, integration and Laplace Transform in Verilog


This example works on FinSim 10_05_28 and subsequent versions.

This example shows symbolic expression evaluation, differentiation, integration, and Laplace Transform.

module top;
`include "finsimmath.h"
   VpReg [0:200]r;
   VpReg [0:200]val_vp;
   VpDescriptor d1;
   real val;
   reg [0:30000] symbExpr1;
   reg [0:30000] symbExpr2;
   real x;

initial begin
   $VpSetDescriptorInfo(d1, 5, 7, `FLOATING,
                        `TO_NEAREST_INTEGER_IF_TIE_TO_MINUS_INF, 
                        `SATURATION+`WARNING, 1);
   $VpSetDefaultOptions(5, 7, `FLOATING,
                        `TO_NEAREST_INTEGER_IF_TIE_TO_MINUS_INF, 
                        `SATURATION+`WARNING, 1);

   $VpAssocDescrToData(r, d1);
   $VpAssocDescrToData(val_vp, d1);

   r = $Pi/6;
   x = $Pi/6;

   symbExpr1 = "$VpSin(r*x)";
   $Eval(symbExpr1, val);
   $display("$Eval(%0s) = %e, for x = %e, r = %y\n", symbExpr1, val, x, r);

   symbExpr2 = $Dif(3, symbExpr1, "x");
   $Eval(symbExpr2, val_vp);
   $display("*** SDif(SDif(SDif(%0s))) is %0s and its value for x = %e is %y\n", 
            symbExpr1, symbExpr2, x, val_vp);

   symbExpr2 = $Int(1, symbExpr1, "x");
   $Eval(symbExpr2, val_vp);
   $display("$SInt(%0s) = %0s and its value for x = %e is = %y\n", 
            symbExpr1, symbExpr2, x, val_vp);

   symbExpr2 = $Lap(1, symbExpr1, "x");
   $display("$LaplaceT(%0s) = %0s\n", symbExpr1, symbExpr2);

   symbExpr1 = "x**4 * $VpSin(x)";
   symbExpr2 = $Lap(1,symbExpr1, "x");   
   $display("*** Lap(%0s) is %0s \n", symbExpr1, symbExpr2);
end
endmodule // top


© Copyright 1999-2021, Fintronic USA, Inc.   All rights reserved.