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)


Finding roots of polynomials as well as finding polynomials given roots. A polynomial of order 5131 is exemplified

This example works on FinSim 10_07_15 and subsequent versions.

This example shows how to find the roots of a polynomial and how to find the polynomial given the roots. Note that the polynomial is not sparse, as all its coefficients are non-zero, which make the problem more difficult. Also note that the coefficients are in a close range: -6 to 15, which makes the problem easier.

This example run on a laptop with core i7 at 2.4GHz in 13.89 seconds.

module top;
parameter size = 5131;
   real d, p[0:size-1], p1[0:size-1];
   VpFCartesian r[0:size-2];

   initial begin
      /* set the values of the coefficients of the polynomial p */
      $InitM(p, 1.5);
      p[0] = 15;
      p[1000] = 2;
      p [size-2] = 3;
      p [size-1] = -6;
      /* compute the roots r of polynomial p */
      r = $Roots(p);
      $PrintM(r, "%e");
      /* compute the polynomial p1 corresponding to the roots r */
      p1 = $Poly(r);
      /* denormalize the polynomial so that the coefficient of the highest order is not one but the same as in polynomial p */
      p1 = p1*p[0];
      $PrintM(p1, "%e");
      /* compare p and p1 */
      d = $VpDistAbsMax(p, p1);
      $display("distance = %e\n", d);
endmodule // top

Copyright 1999-2011, Fintronic USA, Inc.   All rights reserved.