summaryrefslogtreecommitdiffstats
path: root/src/base/io/ioRead.c
blob: 8a0c11a5da1e88d04d5fa8ad3acabcfd2dae9576 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/**CFile****************************************************************

  FileName    [ioRead.c]

  SystemName  [ABC: Logic synthesis and verification system.]

  PackageName [Command processing package.]

  Synopsis    [Procedure to read network from file.]

  Author      [Alan Mishchenko]
  
  Affiliation [UC Berkeley]

  Date        [Ver. 1.0. Started - June 20, 2005.]

  Revision    [$Id: ioRead.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $]

***********************************************************************/

#include "io.h"

////////////////////////////////////////////////////////////////////////
///                        DECLARATIONS                              ///
////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////
///                     FUNCTION DEFITIONS                           ///
////////////////////////////////////////////////////////////////////////

/**Function*************************************************************

  Synopsis    [Read the network from a file.]

  Description []
               
  SideEffects []

  SeeAlso     []

***********************************************************************/
Abc_Ntk_t * Io_Read( char * pFileName, int fCheck )
{
    Abc_Ntk_t * pNtk, * pTemp;
    // set the new network
    if ( Extra_FileNameCheckExtension( pFileName, "blif" ) )
        pNtk = Io_ReadBlif( pFileName, fCheck );
    else if ( Extra_FileNameCheckExtension( pFileName, "v" ) )
        pNtk = Io_ReadVerilog( pFileName, fCheck );
    else if ( Extra_FileNameCheckExtension( pFileName, "bench" ) )
        pNtk = Io_ReadBench( pFileName, fCheck );
    else if ( Extra_FileNameCheckExtension( pFileName, "pla" ) )
        pNtk = Io_ReadPla( pFileName, fCheck );
    else 
    {
        fprintf( stderr, "Unknown file format\n" );
        return NULL;
    }
    if ( pNtk == NULL )
        return NULL;
    pNtk = Abc_NtkNetlistToLogic( pTemp = pNtk );
    Abc_NtkDelete( pTemp );
    if ( pNtk == NULL )
    {
        fprintf( stdout, "Converting to logic network after reading has failed.\n" );
        return NULL;
    }
    return pNtk;
}

////////////////////////////////////////////////////////////////////////
///                       END OF FILE                                ///
////////////////////////////////////////////////////////////////////////