src/map/fpga/fpga.c File Reference

#include "fpgaInt.h"
#include "main.h"
Include dependency graph for fpga.c:

Go to the source code of this file.

Functions

static int Fpga_CommandReadLibrary (Abc_Frame_t *pAbc, int argc, char **argv)
static int Fpga_CommandPrintLibrary (Abc_Frame_t *pAbc, int argc, char **argv)
void Fpga_Init (Abc_Frame_t *pAbc)
void Fpga_End ()
void Fpga_SetSimpleLutLib (int nLutSize)

Function Documentation

int Fpga_CommandPrintLibrary ( Abc_Frame_t pAbc,
int  argc,
char **  argv 
) [static]

Function*************************************************************

Synopsis [Command procedure to read LUT libraries.]

Description []

SideEffects []

SeeAlso []

Definition at line 191 of file fpga.c.

00192 {
00193     FILE * pOut, * pErr;
00194     Abc_Ntk_t * pNet;
00195     int fVerbose;
00196     int c;
00197 
00198     pNet = Abc_FrameReadNtk(pAbc);
00199     pOut = Abc_FrameReadOut(pAbc);
00200     pErr = Abc_FrameReadErr(pAbc);
00201 
00202     // set the defaults
00203     fVerbose = 1;
00204     Extra_UtilGetoptReset();
00205     while ( (c = Extra_UtilGetopt(argc, argv, "vh")) != EOF ) 
00206     {
00207         switch (c) 
00208         {
00209             case 'v':
00210                 fVerbose ^= 1;
00211                 break;
00212             case 'h':
00213                 goto usage;
00214                 break;
00215             default:
00216                 goto usage;
00217         }
00218     }
00219 
00220 
00221     if ( argc != globalUtilOptind )
00222     {
00223         goto usage;
00224     }
00225 
00226     // set the new network
00227     Fpga_LutLibPrint( Abc_FrameReadLibLut() );
00228     return 0;
00229 
00230 usage:
00231     fprintf( pErr, "\nusage: read_print [-vh]\n");
00232     fprintf( pErr, "\t          print the current LUT library\n" );  
00233     fprintf( pErr, "\t-v      : toggles enabling of verbose output [default = %s]\n", (fVerbose? "yes" : "no") );
00234     fprintf( pErr, "\t-h      : print the command usage\n");
00235     return 1;       /* error exit */
00236 }

int Fpga_CommandReadLibrary ( Abc_Frame_t pAbc,
int  argc,
char **  argv 
) [static]

CFile****************************************************************

FileName [fpga.c]

PackageName [MVSIS 1.3: Multi-valued logic synthesis system.]

Synopsis [Command file for the FPGA package.]

Author [MVSIS Group]

Affiliation [UC Berkeley]

Date [Ver. 2.0. Started - August 18, 2004.]

Revision [

Id
fpga.c,v 1.4 2004/10/28 17:36:07 alanmi Exp

] DECLARATIONS ///

Function*************************************************************

Synopsis [Command procedure to read LUT libraries.]

Description []

SideEffects []

SeeAlso []

Definition at line 98 of file fpga.c.

00099 {
00100     FILE * pFile;
00101     FILE * pOut, * pErr;
00102     Fpga_LutLib_t * pLib;
00103     Abc_Ntk_t * pNet;
00104     char * FileName;
00105     int fVerbose;
00106     int c;
00107 
00108     pNet = Abc_FrameReadNtk(pAbc);
00109     pOut = Abc_FrameReadOut(pAbc);
00110     pErr = Abc_FrameReadErr(pAbc);
00111 
00112     // set the defaults
00113     fVerbose = 1;
00114     Extra_UtilGetoptReset();
00115     while ( (c = Extra_UtilGetopt(argc, argv, "vh")) != EOF ) 
00116     {
00117         switch (c) 
00118         {
00119             case 'v':
00120                 fVerbose ^= 1;
00121                 break;
00122             case 'h':
00123                 goto usage;
00124                 break;
00125             default:
00126                 goto usage;
00127         }
00128     }
00129 
00130 
00131     if ( argc != globalUtilOptind + 1 )
00132     {
00133         goto usage;
00134     }
00135 
00136     // get the input file name
00137     FileName = argv[globalUtilOptind];
00138     if ( (pFile = fopen( FileName, "r" )) == NULL )
00139     {
00140         fprintf( pErr, "Cannot open input file \"%s\". ", FileName );
00141         if ( FileName = Extra_FileGetSimilarName( FileName, ".genlib", ".lib", ".gen", ".g", NULL ) )
00142             fprintf( pErr, "Did you mean \"%s\"?", FileName );
00143         fprintf( pErr, "\n" );
00144         return 1;
00145     }
00146     fclose( pFile );
00147 
00148     // set the new network
00149     pLib = Fpga_LutLibCreate( FileName, fVerbose );
00150     if ( pLib == NULL )
00151     {
00152         fprintf( pErr, "Reading LUT library has failed.\n" );
00153         goto usage;
00154     }
00155     // replace the current library
00156     Fpga_LutLibFree( Abc_FrameReadLibLut() );
00157     Abc_FrameSetLibLut( pLib );
00158     return 0;
00159 
00160 usage:
00161     fprintf( pErr, "\nusage: read_lut [-vh]\n");
00162     fprintf( pErr, "\t          read the LUT library from the file\n" );  
00163     fprintf( pErr, "\t-v      : toggles enabling of verbose output [default = %s]\n", (fVerbose? "yes" : "no") );
00164     fprintf( pErr, "\t-h      : print the command usage\n");
00165     fprintf( pErr, "\t                                        \n");
00166     fprintf( pErr, "\t          File format for a LUT library:\n");
00167     fprintf( pErr, "\t          (the default library is shown)\n");
00168     fprintf( pErr, "\t                                        \n");
00169     fprintf( pErr, "\t          # The area/delay of k-variable LUTs:\n");
00170     fprintf( pErr, "\t          # k  area   delay\n");
00171     fprintf( pErr, "\t          1      1      1\n");
00172     fprintf( pErr, "\t          2      2      2\n");
00173     fprintf( pErr, "\t          3      4      3\n");
00174     fprintf( pErr, "\t          4      8      4\n");
00175     fprintf( pErr, "\t          5     16      5\n");
00176     fprintf( pErr, "\t          6     32      6\n");
00177     return 1;       /* error exit */
00178 }

void Fpga_End (  ) 

Function*************************************************************

Synopsis [Package ending procedure.]

Description []

SideEffects []

SeeAlso []

Definition at line 81 of file fpga.c.

00082 {
00083     Fpga_LutLibFree( Abc_FrameReadLibLut() );
00084 }

void Fpga_Init ( Abc_Frame_t pAbc  ) 

FUNCTION DEFINITIONS ///Function*************************************************************

Synopsis [Package initialization procedure.]

Description []

SideEffects []

SeeAlso []

Definition at line 56 of file fpga.c.

00057 {
00058     // set the default library
00059     //Fpga_LutLib_t s_LutLib = { "lutlib", 6, 0, {0,1,2,4,8,16,32}, {{0},{1},{2},{3},{4},{5},{6}} };
00060 //    Fpga_LutLib_t s_LutLib = { "lutlib", 5, 0, {0,1,1,1,1,1}, {{0},{1},{1},{1},{1},{1}} };
00061     Fpga_LutLib_t s_LutLib = { "lutlib", 4, 0, {0,1,1,1,1}, {{0},{1},{1},{1},{1}} };
00062     //Fpga_LutLib_t s_LutLib = { "lutlib", 3, 0, {0,1,1,1}, {{0},{1},{1},{1}} };
00063 
00064     Abc_FrameSetLibLut( Fpga_LutLibDup(&s_LutLib) );
00065 
00066     Cmd_CommandAdd( pAbc, "FPGA mapping", "read_lut",   Fpga_CommandReadLibrary,   0 ); 
00067     Cmd_CommandAdd( pAbc, "FPGA mapping", "print_lut",  Fpga_CommandPrintLibrary,  0 ); 
00068 }

void Fpga_SetSimpleLutLib ( int  nLutSize  ) 

Function*************************************************************

Synopsis [Sets simple LUT library.]

Description []

SideEffects []

SeeAlso []

Definition at line 249 of file fpga.c.

00250 {
00251     Fpga_LutLib_t s_LutLib10= { "lutlib",10, 0, {0,1,1,1,1,1,1,1,1,1,1}, {{0},{1},{1},{1},{1},{1},{1},{1},{1},{1},{1}} };
00252     Fpga_LutLib_t s_LutLib9 = { "lutlib", 9, 0, {0,1,1,1,1,1,1,1,1,1}, {{0},{1},{1},{1},{1},{1},{1},{1},{1},{1}} };
00253     Fpga_LutLib_t s_LutLib8 = { "lutlib", 8, 0, {0,1,1,1,1,1,1,1,1}, {{0},{1},{1},{1},{1},{1},{1},{1},{1}} };
00254     Fpga_LutLib_t s_LutLib7 = { "lutlib", 7, 0, {0,1,1,1,1,1,1,1}, {{0},{1},{1},{1},{1},{1},{1},{1}} };
00255     Fpga_LutLib_t s_LutLib6 = { "lutlib", 6, 0, {0,1,1,1,1,1,1}, {{0},{1},{1},{1},{1},{1},{1}} };
00256     Fpga_LutLib_t s_LutLib5 = { "lutlib", 5, 0, {0,1,1,1,1,1}, {{0},{1},{1},{1},{1},{1}} };
00257     Fpga_LutLib_t s_LutLib4 = { "lutlib", 4, 0, {0,1,1,1,1}, {{0},{1},{1},{1},{1}} };
00258     Fpga_LutLib_t s_LutLib3 = { "lutlib", 3, 0, {0,1,1,1}, {{0},{1},{1},{1}} };
00259     Fpga_LutLib_t * pLutLib;
00260     assert( nLutSize >= 3 && nLutSize <= 10 );
00261     switch ( nLutSize )
00262     {
00263         case 3:  pLutLib = &s_LutLib3; break;
00264         case 4:  pLutLib = &s_LutLib4; break;
00265         case 5:  pLutLib = &s_LutLib5; break;
00266         case 6:  pLutLib = &s_LutLib6; break;
00267         case 7:  pLutLib = &s_LutLib7; break;
00268         case 8:  pLutLib = &s_LutLib8; break;
00269         case 9:  pLutLib = &s_LutLib9; break;
00270         case 10: pLutLib = &s_LutLib10; break;
00271         default: pLutLib = NULL; break;
00272     }
00273     if ( pLutLib == NULL )
00274         return;
00275     Fpga_LutLibFree( Abc_FrameReadLibLut() );
00276     Abc_FrameSetLibLut( Fpga_LutLibDup(pLutLib) );
00277 }


Generated on Tue Jan 5 12:19:01 2010 for abc70930 by  doxygen 1.6.1