Skip to content

Commit c18b9a2

Browse files
authored
Merge pull request #470 from MyskYko/btor
Btor
2 parents f833c26 + db9275b commit c18b9a2

11 files changed

Lines changed: 2164 additions & 1 deletion

File tree

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ MODULES := \
3333
src/map/amap src/map/cov src/map/scl src/map/mpm \
3434
src/misc/extra src/misc/mvc src/misc/st src/misc/util src/misc/nm \
3535
src/misc/vec src/misc/hash src/misc/tim src/misc/bzlib src/misc/zlib \
36-
src/misc/mem src/misc/bar src/misc/bbl src/misc/parse \
36+
src/misc/mem src/misc/bar src/misc/bbl src/misc/parse src/misc/btor \
3737
src/opt/cut src/opt/fxu src/opt/fxch src/opt/rwr src/opt/mfs src/opt/sim \
3838
src/opt/ret src/opt/fret src/opt/res src/opt/lpk src/opt/nwk src/opt/rwt src/opt/rar \
3939
src/opt/cgt src/opt/csw src/opt/dar src/opt/dau src/opt/dsc src/opt/sfm src/opt/sbd src/opt/eslim src/opt/ufar src/opt/untk src/opt/util \

abclib.dsp

Lines changed: 24 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/base/abci/abc.c

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -663,6 +663,8 @@ static int Abc_CommandAbc9Test ( Abc_Frame_t * pAbc, int argc, cha
663663

664664
static int Abc_CommandAbc9eSLIM ( Abc_Frame_t * pAbc, int argc, char ** argv );
665665

666+
static int Abc_CommandAbc9CatBtor ( Abc_Frame_t * pAbc, int argc, char ** argv );
667+
666668
extern int Abc_CommandAbcLivenessToSafety ( Abc_Frame_t * pAbc, int argc, char ** argv );
667669
extern int Abc_CommandAbcLivenessToSafetySim ( Abc_Frame_t * pAbc, int argc, char ** argv );
668670
extern int Abc_CommandAbcLivenessToSafetyWithLTL( Abc_Frame_t * pAbc, int argc, char ** argv );
@@ -1502,6 +1504,8 @@ void Abc_Init( Abc_Frame_t * pAbc )
15021504
Cmd_CommandAdd( pAbc, "ABC9", "&test", Abc_CommandAbc9Test, 0 );
15031505

15041506
Cmd_CommandAdd( pAbc, "ABC9", "&eslim", Abc_CommandAbc9eSLIM, 0 );
1507+
1508+
Cmd_CommandAdd( pAbc, "ABC9", "&catbtor", Abc_CommandAbc9CatBtor, 0 );
15051509
{
15061510
// extern Mf_ManTruthCount();
15071511
// Mf_ManTruthCount();
@@ -59505,6 +59509,42 @@ int Abc_CommandAbc9eSLIM( Abc_Frame_t * pAbc, int argc, char ** argv ) {
5950559509
return 1;
5950659510
}
5950759511

59512+
int Abc_CommandAbc9CatBtor( Abc_Frame_t * pAbc, int argc, char ** argv ) {
59513+
extern void Abc_BtorCat( char * pFileName, int fVerbose );
59514+
59515+
int c, fVerbose = 0;
59516+
char * pFileName;
59517+
Extra_UtilGetoptReset();
59518+
while ( ( c = Extra_UtilGetopt( argc, argv, "v" ) ) != EOF )
59519+
{
59520+
switch ( c ) {
59521+
case 'v' :
59522+
fVerbose ^= 1;
59523+
break;
59524+
default:
59525+
goto usage;
59526+
}
59527+
}
59528+
if ( argc == globalUtilOptind + 1 )
59529+
pFileName = argv[globalUtilOptind];
59530+
else
59531+
{
59532+
Abc_Print( -1, "File name is not given on the command line.\n" );
59533+
return 0;
59534+
}
59535+
59536+
Abc_BtorCat( pFileName, fVerbose );
59537+
59538+
return 0;
59539+
59540+
usage:
59541+
Abc_Print( -2, "usage: &catbtor [-v] <file>\n" );
59542+
Abc_Print( -2, "\t parse BTOR file and print to stdout.\n" );
59543+
Abc_Print( -2, "\t-v : toggle printing verbose information\n");
59544+
Abc_Print( -2, "\t<file> : input BTOR file\n");
59545+
return 1;
59546+
}
59547+
5950859548
////////////////////////////////////////////////////////////////////////
5950959549
/// END OF FILE ///
5951059550
////////////////////////////////////////////////////////////////////////

src/misc/btor/LICENSE.txt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
The Btor2Tools package provides a generic parser and tools for the BTOR2 format.
2+
3+
Copyright (c) 2012-2018 Armin Biere.
4+
Copyright (c) 2013-2018 Mathias Preiner.
5+
Copyright (c) 2015-2018 Aina Niemetz.
6+
7+
MIT License
8+
9+
Permission is hereby granted, free of charge, to any person obtaining a
10+
copy of this software and associated documentation files (the "Software"),
11+
to deal in the Software without restriction, including without limitation
12+
the rights to use, copy, modify, merge, publish, distribute, sublicense,
13+
and/or sell copies of the Software, and to permit persons to whom the
14+
Software is furnished to do so, subject to the following conditions:
15+
16+
The above copyright notice and this permission notice shall be included
17+
in all copies or substantial portions of the Software.
18+
19+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22+
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
23+
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
24+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25+
OTHER DEALINGS IN THE SOFTWARE.

src/misc/btor/VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1.0.2

src/misc/btor/btor2mem.h

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
/**
2+
* Btor2Tools: A tool package for the BTOR format.
3+
*
4+
* Copyright (C) 2007-2009 Robert Daniel Brummayer.
5+
* Copyright (C) 2007-2012 Armin Biere.
6+
* Copyright (C) 2012-2015 Mathias Preiner.
7+
* Copyright (c) 2018 Aina Niemetz.
8+
*
9+
* All rights reserved.
10+
*
11+
* This file is part of the Btor2Tools package.
12+
* See LICENSE.txt for more information on using this software.
13+
*/
14+
15+
#ifndef BTOR2MEM_H_INCLUDED
16+
#define BTOR2MEM_H_INCLUDED
17+
18+
#include "misc/util/abc_global.h"
19+
20+
ABC_NAMESPACE_HEADER_START
21+
22+
#include <stdio.h>
23+
#include <stdlib.h>
24+
#include <string.h>
25+
26+
/*------------------------------------------------------------------------*/
27+
28+
#define BTOR2_CLRN(ptr, nelems) (memset ((ptr), 0, (nelems) * sizeof *(ptr)))
29+
30+
#define BTOR2_CLR(ptr) BTOR2_CLRN ((ptr), 1)
31+
32+
#define BTOR2_DELETE(ptr) (free (ptr))
33+
34+
static inline void *
35+
btorsim_malloc (size_t size)
36+
{
37+
void *res;
38+
if (!size) return 0;
39+
res = malloc (size);
40+
if (!res)
41+
{
42+
fprintf (stderr, "[btorsim] memory allocation failed\n");
43+
abort ();
44+
}
45+
return res;
46+
}
47+
48+
static inline void *
49+
btorsim_calloc (size_t nobj, size_t size)
50+
{
51+
void *res;
52+
res = calloc (nobj, size);
53+
if (!res)
54+
{
55+
fprintf (stderr, "[btorsim] memory allocation failed\n");
56+
abort ();
57+
}
58+
return res;
59+
}
60+
61+
static inline void *
62+
btorsim_realloc (void *p, size_t new_size)
63+
{
64+
void *res;
65+
res = realloc (p, new_size);
66+
if (!res)
67+
{
68+
fprintf (stderr, "[btorsim] memory allocation failed\n");
69+
abort ();
70+
}
71+
return res;
72+
}
73+
74+
static inline char *
75+
btorsim_strdup (const char *str)
76+
{
77+
char *res = 0;
78+
if (str)
79+
{
80+
res = (char *) btorsim_malloc ((strlen (str) + 1) * sizeof (char));
81+
strcpy (res, str);
82+
}
83+
return res;
84+
}
85+
86+
ABC_NAMESPACE_HEADER_END
87+
88+
#endif

0 commit comments

Comments
 (0)