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
4deaaa85
Commit
4deaaa85
authored
Nov 20, 2019
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Data reading procedure.
parent
30e2b727
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
0 deletions
+48
-0
src/base/abci/abcDec.c
+48
-0
No files found.
src/base/abci/abcDec.c
View file @
4deaaa85
...
...
@@ -460,6 +460,54 @@ void Abc_TtStoreLoadSave( char * pFileName )
/**Function*************************************************************
Synopsis [Read truth tables in binary text form and write them into file as binary data.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void
Abc_TtStoreLoadSaveBin
(
char
*
pFileName
)
{
unsigned
*
pTruth
=
ABC_CALLOC
(
unsigned
,
(
1
<<
11
)
);
char
*
pBuffer
=
ABC_CALLOC
(
char
,
(
1
<<
16
)
);
char
*
pFileInput
=
pFileName
;
char
*
pFileOutput
=
Extra_FileNameGenericAppend
(
pFileName
,
"_binary.data"
);
FILE
*
pFileI
=
fopen
(
pFileInput
,
"rb"
);
FILE
*
pFileO
=
fopen
(
pFileOutput
,
"wb"
);
int
i
,
Value
,
nVarsAll
=
-
1
;
if
(
pFileI
==
NULL
)
return
;
while
(
fgets
(
pBuffer
,
(
1
<<
16
),
pFileI
)
)
{
int
Len
=
strlen
(
pBuffer
)
-
1
;
// subtract 1 for end-of-line
int
nVars
=
Abc_Base2Log
(
Len
);
int
nInts
=
Abc_BitWordNum
(
Len
);
assert
(
Len
==
(
1
<<
nVars
)
);
if
(
nVarsAll
==
-
1
)
nVarsAll
=
nVars
;
else
assert
(
nVarsAll
==
nVars
);
memset
(
pTruth
,
0
,
sizeof
(
int
)
*
nInts
);
for
(
i
=
0
;
i
<
Len
;
i
++
)
if
(
pBuffer
[
i
]
==
'1'
)
Abc_InfoSetBit
(
pTruth
,
i
);
else
assert
(
pBuffer
[
i
]
==
'0'
);
Value
=
fwrite
(
pTruth
,
1
,
sizeof
(
int
)
*
nInts
,
pFileO
);
assert
(
Value
==
(
int
)
sizeof
(
int
)
*
nInts
);
}
ABC_FREE
(
pTruth
);
ABC_FREE
(
pBuffer
);
fclose
(
pFileI
);
fclose
(
pFileO
);
printf
(
"Input file
\"
%s
\"
was copied into output file
\"
%s
\"
.
\n
"
,
pFileInput
,
pFileOutput
);
}
/**Function*************************************************************
Synopsis [Read truth tables from input file and write them into output file.]
Description []
...
...
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