Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
abc
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
abc
Commits
6db66071
Commit
6db66071
authored
Aug 27, 2014
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improvements BLIF parser.
parent
9c154cfe
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
130 additions
and
4 deletions
+130
-4
src/base/abci/abc.c
+2
-2
src/base/abci/abcPrint.c
+2
-2
src/base/io/ioReadBlifMv.c
+126
-0
No files found.
src/base/abci/abc.c
View file @
6db66071
...
...
@@ -26066,8 +26066,8 @@ int Abc_CommandAbc9Strash( Abc_Frame_t * pAbc, int argc, char ** argv )
if
(
Gia_ManHasMapping
(
pAbc
->
pGia
)
)
{
pTemp
=
(
Gia_Man_t
*
)
Dsm_ManDeriveGia
(
pAbc
->
pGia
,
fAddMuxes
);
if
(
!
Abc_FrameReadFlag
(
"silentmode"
)
)
printf
(
"Performed delay-oriented unmapping.
\n
"
);
//
if ( !Abc_FrameReadFlag("silentmode") )
//
printf( "Performed delay-oriented unmapping.\n" );
}
else
if
(
fAddMuxes
)
{
src/base/abci/abcPrint.c
View file @
6db66071
...
...
@@ -236,10 +236,10 @@ void Abc_NtkPrintStats( Abc_Ntk_t * pNtk, int fFactored, int fSaveBest, int fDum
#ifdef WIN32
SetConsoleTextAttribute
(
GetStdHandle
(
STD_OUTPUT_HANDLE
),
15
);
// bright
Abc_Print
(
1
,
"%-
13
s:"
,
pNtk
->
pName
);
Abc_Print
(
1
,
"%-
30
s:"
,
pNtk
->
pName
);
SetConsoleTextAttribute
(
GetStdHandle
(
STD_OUTPUT_HANDLE
),
7
);
// normal
#else
Abc_Print
(
1
,
"%s%-
13
s:%s"
,
"
\033
[1;37m"
,
pNtk
->
pName
,
"
\033
[0m"
);
// bright
Abc_Print
(
1
,
"%s%-
30
s:%s"
,
"
\033
[1;37m"
,
pNtk
->
pName
,
"
\033
[0m"
);
// bright
#endif
Abc_Print
(
1
,
" i/o =%5d/%5d"
,
Abc_NtkPiNum
(
pNtk
),
Abc_NtkPoNum
(
pNtk
)
);
if
(
Abc_NtkConstrNum
(
pNtk
)
)
...
...
src/base/io/ioReadBlifMv.c
View file @
6db66071
...
...
@@ -18,6 +18,8 @@
***********************************************************************/
#include "misc/zlib/zlib.h"
#include "misc/bzlib/bzlib.h"
#include "base/abc/abc.h"
#include "misc/vec/vecPtr.h"
#include "ioAbc.h"
...
...
@@ -540,12 +542,136 @@ static int Io_MvGetLine( Io_MvMan_t * p, char * pToken )
SeeAlso []
***********************************************************************/
typedef
struct
buflist
{
char
buf
[
1
<<
20
];
int
nBuf
;
struct
buflist
*
next
;
}
buflist
;
static
char
*
Io_MvLoadFileBz2
(
char
*
pFileName
,
int
*
pnFileSize
)
{
FILE
*
pFile
;
int
nFileSize
=
0
;
char
*
pContents
;
BZFILE
*
b
;
int
bzError
;
struct
buflist
*
pNext
;
buflist
*
bufHead
=
NULL
,
*
buf
=
NULL
;
pFile
=
fopen
(
pFileName
,
"rb"
);
if
(
pFile
==
NULL
)
{
Abc_Print
(
-
1
,
"Io_MvLoadFileBz2(): The file is unavailable (absent or open).
\n
"
);
return
NULL
;
}
b
=
BZ2_bzReadOpen
(
&
bzError
,
pFile
,
0
,
0
,
NULL
,
0
);
if
(
bzError
!=
BZ_OK
)
{
Abc_Print
(
-
1
,
"Io_MvLoadFileBz2(): BZ2_bzReadOpen() failed with error %d.
\n
"
,
bzError
);
return
NULL
;
}
do
{
if
(
!
bufHead
)
buf
=
bufHead
=
ABC_ALLOC
(
buflist
,
1
);
else
buf
=
buf
->
next
=
ABC_ALLOC
(
buflist
,
1
);
nFileSize
+=
buf
->
nBuf
=
BZ2_bzRead
(
&
bzError
,
b
,
buf
->
buf
,
1
<<
20
);
buf
->
next
=
NULL
;
}
while
(
bzError
==
BZ_OK
);
if
(
bzError
==
BZ_STREAM_END
)
{
// we're okay
char
*
p
;
int
nBytes
=
0
;
BZ2_bzReadClose
(
&
bzError
,
b
);
p
=
pContents
=
ABC_ALLOC
(
char
,
nFileSize
+
10
);
buf
=
bufHead
;
do
{
memcpy
(
p
+
nBytes
,
buf
->
buf
,
buf
->
nBuf
);
nBytes
+=
buf
->
nBuf
;
// } while((buf = buf->next));
pNext
=
buf
->
next
;
ABC_FREE
(
buf
);
}
while
((
buf
=
pNext
));
}
else
if
(
bzError
==
BZ_DATA_ERROR_MAGIC
)
{
// not a BZIP2 file
BZ2_bzReadClose
(
&
bzError
,
b
);
fseek
(
pFile
,
0
,
SEEK_END
);
nFileSize
=
ftell
(
pFile
);
if
(
nFileSize
==
0
)
{
Abc_Print
(
-
1
,
"Io_MvLoadFileBz2(): The file is empty.
\n
"
);
return
NULL
;
}
pContents
=
ABC_ALLOC
(
char
,
nFileSize
+
10
);
rewind
(
pFile
);
fread
(
pContents
,
nFileSize
,
1
,
pFile
);
}
else
{
// Some other error.
Abc_Print
(
-
1
,
"Io_MvLoadFileBz2(): Unable to read the compressed BLIF.
\n
"
);
return
NULL
;
}
fclose
(
pFile
);
// finish off the file with the spare .end line
// some benchmarks suddenly break off without this line
strcpy
(
pContents
+
nFileSize
,
"
\n
.end
\n
"
);
*
pnFileSize
=
nFileSize
;
return
pContents
;
}
/**Function*************************************************************
Synopsis [Reads the file into a character buffer.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
static
char
*
Io_MvLoadFileGz
(
char
*
pFileName
,
int
*
pnFileSize
)
{
const
int
READ_BLOCK_SIZE
=
100000
;
gzFile
pFile
;
char
*
pContents
;
int
amtRead
,
readBlock
,
nFileSize
=
READ_BLOCK_SIZE
;
pFile
=
gzopen
(
pFileName
,
"rb"
);
// if pFileName doesn't end in ".gz" then this acts as a passthrough to fopen
pContents
=
ABC_ALLOC
(
char
,
nFileSize
);
readBlock
=
0
;
while
((
amtRead
=
gzread
(
pFile
,
pContents
+
readBlock
*
READ_BLOCK_SIZE
,
READ_BLOCK_SIZE
))
==
READ_BLOCK_SIZE
)
{
//Abc_Print( 1,"%d: read %d bytes\n", readBlock, amtRead);
nFileSize
+=
READ_BLOCK_SIZE
;
pContents
=
ABC_REALLOC
(
char
,
pContents
,
nFileSize
);
++
readBlock
;
}
//Abc_Print( 1,"%d: read %d bytes\n", readBlock, amtRead);
assert
(
amtRead
!=
-
1
);
// indicates a zlib error
nFileSize
-=
(
READ_BLOCK_SIZE
-
amtRead
);
gzclose
(
pFile
);
*
pnFileSize
=
nFileSize
;
return
pContents
;
}
/**Function*************************************************************
Synopsis [Reads the file into a character buffer.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
static
char
*
Io_MvLoadFile
(
char
*
pFileName
)
{
FILE
*
pFile
;
int
nFileSize
;
char
*
pContents
;
int
RetValue
;
if
(
!
strncmp
(
pFileName
+
strlen
(
pFileName
)
-
4
,
".bz2"
,
4
)
)
return
Io_MvLoadFileBz2
(
pFileName
,
&
nFileSize
);
if
(
!
strncmp
(
pFileName
+
strlen
(
pFileName
)
-
3
,
".gz"
,
3
)
)
return
Io_MvLoadFileGz
(
pFileName
,
&
nFileSize
);
pFile
=
fopen
(
pFileName
,
"rb"
);
if
(
pFile
==
NULL
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment