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)


Inverting a non-sparse matrix with elements of type Cartesian in Verilog

This example shows how to invert a non sparse matrix of 500x500 elements of type VpFCartesian (complex number in Cartesian co-ordinates with fields of type real.

The WFC matrix is initialized with the values of the Fourier transformation and its inverse is compared to the known result placed in WFCI.

The distance between the inverse and the known result is displayed. The $PrintM statement is commented out in order to show its syntax in case it is needed, but not to produce over 250,000 lines of output given that the matrix has 500x500 elements.

Note: This example runs only on Linux and Solaris platforms, using FinSim version 10_0_0 or any subsequent version.

module top;
`define mod(val, n)  (val - (val/n)*n)
parameter SIZE = 500;

VpFCartesian WFC[SIZE-1:0][SIZE-1:0], WFCI[SIZE-1:0][SIZE-1:0];
real phi0, distance;
integer i, j, mone;

initial begin
  mone = -1;
  phi0 = 2*$Pi/SIZE;
  $display("phi0 = %e\n", phi0);
  $InitM(WFC, $VpCos(phi0*`mod($I1*$I2, SIZE)),
              $VpSin(phi0*`mod($I1*$I2, SIZE)));
  $InitM(WFCI, $VpCos(phi0*`mod($I1*$I2, SIZE))/SIZE,
              -$VpSin(phi0*`mod($I1*$I2, SIZE))/SIZE);
  WFC = WFC**(mone);
  /*  $PrintM(WFC, "%e");*/
  distance = $VpDistAbsMax(WFC, WFCI);
  $display("distance = %e\n", distance);