Skip to content
Merged

Btor #470

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ MODULES := \
src/map/amap src/map/cov src/map/scl src/map/mpm \
src/misc/extra src/misc/mvc src/misc/st src/misc/util src/misc/nm \
src/misc/vec src/misc/hash src/misc/tim src/misc/bzlib src/misc/zlib \
src/misc/mem src/misc/bar src/misc/bbl src/misc/parse \
src/misc/mem src/misc/bar src/misc/bbl src/misc/parse src/misc/btor \
src/opt/cut src/opt/fxu src/opt/fxch src/opt/rwr src/opt/mfs src/opt/sim \
src/opt/ret src/opt/fret src/opt/res src/opt/lpk src/opt/nwk src/opt/rwt src/opt/rar \
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 \
Expand Down
24 changes: 24 additions & 0 deletions abclib.dsp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 40 additions & 0 deletions src/base/abci/abc.c
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,8 @@ static int Abc_CommandAbc9Test ( Abc_Frame_t * pAbc, int argc, cha

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

static int Abc_CommandAbc9CatBtor ( Abc_Frame_t * pAbc, int argc, char ** argv );

extern int Abc_CommandAbcLivenessToSafety ( Abc_Frame_t * pAbc, int argc, char ** argv );
extern int Abc_CommandAbcLivenessToSafetySim ( Abc_Frame_t * pAbc, int argc, char ** argv );
extern int Abc_CommandAbcLivenessToSafetyWithLTL( Abc_Frame_t * pAbc, int argc, char ** argv );
Expand Down Expand Up @@ -1502,6 +1504,8 @@ void Abc_Init( Abc_Frame_t * pAbc )
Cmd_CommandAdd( pAbc, "ABC9", "&test", Abc_CommandAbc9Test, 0 );

Cmd_CommandAdd( pAbc, "ABC9", "&eslim", Abc_CommandAbc9eSLIM, 0 );

Cmd_CommandAdd( pAbc, "ABC9", "&catbtor", Abc_CommandAbc9CatBtor, 0 );
{
// extern Mf_ManTruthCount();
// Mf_ManTruthCount();
Expand Down Expand Up @@ -59462,6 +59466,42 @@ int Abc_CommandAbc9eSLIM( Abc_Frame_t * pAbc, int argc, char ** argv ) {
return 1;
}

int Abc_CommandAbc9CatBtor( Abc_Frame_t * pAbc, int argc, char ** argv ) {
extern void Abc_BtorCat( char * pFileName, int fVerbose );

int c, fVerbose = 0;
char * pFileName;
Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "v" ) ) != EOF )
{
switch ( c ) {
case 'v' :
fVerbose ^= 1;
break;
default:
goto usage;
}
}
if ( argc == globalUtilOptind + 1 )
pFileName = argv[globalUtilOptind];
else
{
Abc_Print( -1, "File name is not given on the command line.\n" );
return 0;
}

Abc_BtorCat( pFileName, fVerbose );

return 0;

usage:
Abc_Print( -2, "usage: &catbtor [-v] <file>\n" );
Abc_Print( -2, "\t parse BTOR file and print to stdout.\n" );
Abc_Print( -2, "\t-v : toggle printing verbose information\n");
Abc_Print( -2, "\t<file> : input BTOR file\n");
return 1;
}

////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
Expand Down
25 changes: 25 additions & 0 deletions src/misc/btor/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
The Btor2Tools package provides a generic parser and tools for the BTOR2 format.

Copyright (c) 2012-2018 Armin Biere.
Copyright (c) 2013-2018 Mathias Preiner.
Copyright (c) 2015-2018 Aina Niemetz.

MIT License

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
1 change: 1 addition & 0 deletions src/misc/btor/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.0.2
88 changes: 88 additions & 0 deletions src/misc/btor/btor2mem.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
/**
* Btor2Tools: A tool package for the BTOR format.
*
* Copyright (C) 2007-2009 Robert Daniel Brummayer.
* Copyright (C) 2007-2012 Armin Biere.
* Copyright (C) 2012-2015 Mathias Preiner.
* Copyright (c) 2018 Aina Niemetz.
*
* All rights reserved.
*
* This file is part of the Btor2Tools package.
* See LICENSE.txt for more information on using this software.
*/

#ifndef BTOR2MEM_H_INCLUDED
#define BTOR2MEM_H_INCLUDED

#include "misc/util/abc_global.h"

ABC_NAMESPACE_HEADER_START

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

/*------------------------------------------------------------------------*/

#define BTOR2_CLRN(ptr, nelems) (memset ((ptr), 0, (nelems) * sizeof *(ptr)))

#define BTOR2_CLR(ptr) BTOR2_CLRN ((ptr), 1)

#define BTOR2_DELETE(ptr) (free (ptr))

static inline void *
btorsim_malloc (size_t size)
{
void *res;
if (!size) return 0;
res = malloc (size);
if (!res)
{
fprintf (stderr, "[btorsim] memory allocation failed\n");
abort ();
}
return res;
}

static inline void *
btorsim_calloc (size_t nobj, size_t size)
{
void *res;
res = calloc (nobj, size);
if (!res)
{
fprintf (stderr, "[btorsim] memory allocation failed\n");
abort ();
}
return res;
}

static inline void *
btorsim_realloc (void *p, size_t new_size)
{
void *res;
res = realloc (p, new_size);
if (!res)
{
fprintf (stderr, "[btorsim] memory allocation failed\n");
abort ();
}
return res;
}

static inline char *
btorsim_strdup (const char *str)
{
char *res = 0;
if (str)
{
res = (char *) btorsim_malloc ((strlen (str) + 1) * sizeof (char));
strcpy (res, str);
}
return res;
}

ABC_NAMESPACE_HEADER_END

#endif
Loading
Loading