mirror of https://github.com/YosysHQ/abc.git
Version abc60611
This commit is contained in:
parent
7d0921330b
commit
3db1557f45
7
Makefile
7
Makefile
|
|
@ -9,14 +9,15 @@ PROG := abc
|
|||
MODULES := src/base/abc src/base/abci src/base/seq src/base/cmd src/base/io src/base/main \
|
||||
src/bdd/cudd src/bdd/dsd src/bdd/epd src/bdd/mtr src/bdd/parse src/bdd/reo \
|
||||
src/map/fpga src/map/pga src/map/mapper src/map/mio src/map/super \
|
||||
src/misc/extra src/misc/mvc src/misc/st src/misc/util src/misc/espresso src/misc/vec \
|
||||
src/misc/extra src/misc/mvc src/misc/st src/misc/util src/misc/espresso src/misc/nm src/misc/vec \
|
||||
src/opt/cut src/opt/dec src/opt/fxu src/opt/rwr src/opt/sim \
|
||||
src/temp/esop src/temp/ivy src/temp/player \
|
||||
src/sat/asat src/sat/csat src/sat/msat src/sat/fraig
|
||||
|
||||
default: $(PROG)
|
||||
|
||||
OPTFLAGS := -DNDEBUG -O3
|
||||
#OPTFLAGS := -g -O
|
||||
#OPTFLAGS := -DNDEBUG -O3
|
||||
OPTFLAGS := -g -O
|
||||
|
||||
CFLAGS += -Wall -Wno-unused-function $(OPTFLAGS) $(patsubst %, -I%, $(MODULES))
|
||||
CXXFLAGS += $(CFLAGS)
|
||||
|
|
|
|||
228
abc.dsp
228
abc.dsp
|
|
@ -42,7 +42,7 @@ RSC=rc.exe
|
|||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /I "src\base\abc" /I "src\base\abci" /I "src\base\abcs" /I "src\base\seq" /I "src\base\cmd" /I "src\base\io" /I "src\base\main" /I "src\bdd\cudd" /I "src\bdd\epd" /I "src\bdd\mtr" /I "src\bdd\parse" /I "src\bdd\dsd" /I "src\bdd\reo" /I "src\sop\ft" /I "src\sat\aig" /I "src\sat\asat" /I "src\sat\msat" /I "src\sat\fraig" /I "src\opt\cut" /I "src\opt\dec" /I "src\opt\fxu" /I "src\opt\sim" /I "src\opt\rwr" /I "src\map\fpga" /I "src\map\pga" /I "src\map\mapper" /I "src\map\mio" /I "src\map\super" /I "src\misc\extra" /I "src\misc\st" /I "src\misc\mvc" /I "src\misc\util" /I "src\misc\npn" /I "src\misc\vec" /I "src\misc\espresso" /I "src\misc\nm" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "__STDC__" /FR /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /I "src\base\abc" /I "src\base\abci" /I "src\base\abcs" /I "src\base\seq" /I "src\base\cmd" /I "src\base\io" /I "src\base\main" /I "src\bdd\cudd" /I "src\bdd\epd" /I "src\bdd\mtr" /I "src\bdd\parse" /I "src\bdd\dsd" /I "src\bdd\reo" /I "src\sop\ft" /I "src\sat\aig" /I "src\sat\asat" /I "src\sat\msat" /I "src\sat\fraig" /I "src\opt\cut" /I "src\opt\dec" /I "src\opt\fxu" /I "src\opt\sim" /I "src\opt\rwr" /I "src\map\fpga" /I "src\map\pga" /I "src\map\mapper" /I "src\map\mio" /I "src\map\super" /I "src\misc\extra" /I "src\misc\st" /I "src\misc\mvc" /I "src\misc\util" /I "src\misc\npn" /I "src\misc\vec" /I "src\misc\espresso" /I "src\misc\nm" /I "src\temp\ivy" /I "src\temp\esop" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "__STDC__" /FR /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
|
|
@ -66,7 +66,7 @@ LINK32=link.exe
|
|||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "src\base\abc" /I "src\base\abci" /I "src\base\abcs" /I "src\base\seq" /I "src\base\cmd" /I "src\base\io" /I "src\base\main" /I "src\bdd\cudd" /I "src\bdd\epd" /I "src\bdd\mtr" /I "src\bdd\parse" /I "src\bdd\dsd" /I "src\bdd\reo" /I "src\sop\ft" /I "src\sat\aig" /I "src\sat\asat" /I "src\sat\msat" /I "src\sat\fraig" /I "src\opt\cut" /I "src\opt\dec" /I "src\opt\fxu" /I "src\opt\sim" /I "src\opt\rwr" /I "src\map\fpga" /I "src\map\pga" /I "src\map\mapper" /I "src\map\mio" /I "src\map\super" /I "src\misc\extra" /I "src\misc\st" /I "src\misc\mvc" /I "src\misc\util" /I "src\misc\npn" /I "src\misc\vec" /I "src\misc\espresso" /I "src\misc\nm" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "__STDC__" /FR /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "src\base\abc" /I "src\base\abci" /I "src\base\abcs" /I "src\base\seq" /I "src\base\cmd" /I "src\base\io" /I "src\base\main" /I "src\bdd\cudd" /I "src\bdd\epd" /I "src\bdd\mtr" /I "src\bdd\parse" /I "src\bdd\dsd" /I "src\bdd\reo" /I "src\sop\ft" /I "src\sat\aig" /I "src\sat\asat" /I "src\sat\msat" /I "src\sat\fraig" /I "src\opt\cut" /I "src\opt\dec" /I "src\opt\fxu" /I "src\opt\sim" /I "src\opt\rwr" /I "src\map\fpga" /I "src\map\pga" /I "src\map\mapper" /I "src\map\mio" /I "src\map\super" /I "src\misc\extra" /I "src\misc\st" /I "src\misc\mvc" /I "src\misc\util" /I "src\misc\npn" /I "src\misc\vec" /I "src\misc\espresso" /I "src\misc\nm" /I "src\temp\ivy" /I "src\temp\esop" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "__STDC__" /FR /YX /FD /GZ /c
|
||||
# SUBTRACT CPP /X
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
|
|
@ -218,6 +218,10 @@ SOURCE=.\src\base\abci\abcGen.c
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\base\abci\abcIvy.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\base\abci\abcMap.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
|
@ -226,6 +230,10 @@ SOURCE=.\src\base\abci\abcMiter.c
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\base\abci\abcMv.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\base\abci\abcNtbdd.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
|
@ -1286,6 +1294,10 @@ SOURCE=.\src\opt\rwr\rwrPrint.c
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\opt\rwr\rwrTemp.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\opt\rwr\rwrUtil.c
|
||||
# End Source File
|
||||
# End Group
|
||||
|
|
@ -1421,50 +1433,6 @@ SOURCE=.\src\opt\sim\simSymStr.c
|
|||
SOURCE=.\src\opt\sim\simUtils.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "xyz"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\opt\xyz\xyz.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\opt\xyz\xyzBuild.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\opt\xyz\xyzCore.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\opt\xyz\xyzInt.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\opt\xyz\xyzMan.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\opt\xyz\xyzMinEsop.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\opt\xyz\xyzMinMan.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\opt\xyz\xyzMinSop.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\opt\xyz\xyzMinUtil.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\opt\xyz\xyzTest.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# End Group
|
||||
# Begin Group "map"
|
||||
|
||||
|
|
@ -2098,6 +2066,174 @@ SOURCE=.\src\misc\nm\nmTable.c
|
|||
# End Source File
|
||||
# End Group
|
||||
# End Group
|
||||
# Begin Group "temp"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Group "ivy"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\temp\ivy\ivy.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\temp\ivy\ivyBalance.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\temp\ivy\ivyCanon.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\temp\ivy\ivyCheck.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\temp\ivy\ivyCut.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\temp\ivy\ivyDfs.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\temp\ivy\ivyDsd.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\temp\ivy\ivyMan.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\temp\ivy\ivyMulti.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\temp\ivy\ivyObj.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\temp\ivy\ivyOper.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\temp\ivy\ivyRewrite.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\temp\ivy\ivySeq.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\temp\ivy\ivyTable.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\temp\ivy\ivyUndo.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\temp\ivy\ivyUtil.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "player"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\temp\player\player.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\temp\player\playerAbc.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\temp\player\playerBuild.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\temp\player\playerCore.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\temp\player\playerMan.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\temp\player\playerUtil.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "esop"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\temp\esop\esop.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\temp\esop\esopMan.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\temp\esop\esopMem.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\temp\esop\esopMin.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\temp\esop\esopUtil.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "xyz"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\temp\xyz\xyz.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\temp\xyz\xyzBuild.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\temp\xyz\xyzCore.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\temp\xyz\xyzInt.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\temp\xyz\xyzMan.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\temp\xyz\xyzMinEsop.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\temp\xyz\xyzMinMan.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\temp\xyz\xyzMinSop.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\temp\xyz\xyzMinUtil.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\src\temp\xyz\xyzTest.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# End Group
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
|
|
|
|||
1
abc.rc
1
abc.rc
|
|
@ -80,6 +80,7 @@ alias sharem "b; ren -m; fx; b"
|
|||
alias sharedsd "b; ren; dsd -g; sw; fx; b"
|
||||
alias resyn "b; rw; rwz; b; rwz; b"
|
||||
alias resyn2 "b; rw; rf; b; rw; rwz; b; rfz; rwz; b"
|
||||
alias resyn2a "b; rw; b; rw; rwz; b; rwz; b"
|
||||
alias resyn3 "b; rs; rs -K 6; b; rsz; rsz -K 6; b; rsz -K 5; b"
|
||||
alias compress "b -l; rw -l; rwz -l; b -l; rwz -l; b -l"
|
||||
alias compress2 "b -l; rw -l; rf -l; b -l; rw -l; rwz -l; b -l; rfz -l; rwz -l; b -l"
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,443 @@
|
|||
.i 9
|
||||
.o 19
|
||||
.p 438
|
||||
010110011 0100000000000000011
|
||||
100100001 0110000000000000000
|
||||
100010100 0100010000000000000
|
||||
100101001 0100001000000000000
|
||||
001101010 0000001000000001001
|
||||
00-0-0001 0000000000001011100
|
||||
110101010 0000000000010100000
|
||||
010111100 0100000001000000110
|
||||
011010111 0100000001000000000
|
||||
010111010 0000110000000000000
|
||||
110000001 0100000000001010000
|
||||
0110-0011 0001100000000000000
|
||||
10011-010 0100000000000000000
|
||||
101000110 0011000000000000000
|
||||
100110110 0000101000000000000
|
||||
101110100 0001100000000000000
|
||||
111000101 0100000000100000000
|
||||
100100100 0000000001100000000
|
||||
111001110 0100000000100000000
|
||||
111111001 0000000000001100000
|
||||
001100100 0000000000100110000
|
||||
001101101 0010000000010100000
|
||||
-01111101 0100000000000000000
|
||||
010001110 0100000010100000000
|
||||
001011111 0000010100000000110
|
||||
100101110 0100100100000000000
|
||||
001011011 0000000010010010000
|
||||
011111000 0010100000000000000
|
||||
100110100 0000001000001100000
|
||||
001101110 0000000100010010000
|
||||
010011100 0000000001000110000
|
||||
101111101 0000100100000000000
|
||||
111010000 0100000000000110000
|
||||
101011010 0000010100000000000
|
||||
011000001 0000100000000110000
|
||||
101101101 0000100001000000000
|
||||
011011011 0001000000010010000
|
||||
010011111 0000010001000001010
|
||||
10111111- 0100000000000000000
|
||||
010101010 0010000001000001001
|
||||
011101010 0010000000001100000
|
||||
11011111- 0100000000000000000
|
||||
111111011 0001100000000000000
|
||||
001010101 0000010000010101100
|
||||
001110111 0010000000000111001
|
||||
1001100-1 0010000000000000000
|
||||
100100111 0100000000110010000
|
||||
011101011 0101000001000000000
|
||||
011011101 0000100000010010000
|
||||
101110101 0101000001000000000
|
||||
001110100 0010000000010011001
|
||||
001110010 0001000110000000000
|
||||
110011100 0000000000110010000
|
||||
110101111 0000001000001100000
|
||||
100111111 0001000110000000000
|
||||
10-110000 0100000000000010000
|
||||
101101100 0100001010000000000
|
||||
010000011 0001000010000110000
|
||||
-11000011 0001000000000000000
|
||||
100001101 0000101100000000000
|
||||
010000010 0000100000110100000
|
||||
1-0001001 0100100000000000000
|
||||
001001110 0001010010000001100
|
||||
001110001 0000100011000000000
|
||||
00101001- 0000000100000001100
|
||||
100100010 0010000001100000000
|
||||
011011110 0001110000000000000
|
||||
110110000 0000100100001000000
|
||||
101000101 0000011000001000000
|
||||
100101111 0101010010000000000
|
||||
101110110 0100000000110010000
|
||||
001110000 0000010001100000000
|
||||
011001110 0100000001000110000
|
||||
010010100 0000010001100000000
|
||||
100010010 0001000001001010000
|
||||
100011000 0000100010000110000
|
||||
-01001100 0000000000010010000
|
||||
001001111 0010100010000001100
|
||||
110111110 0001110000000000000
|
||||
100110001 0000001110000000000
|
||||
001100000 0000101000100000101
|
||||
100110101 0000010011000000000
|
||||
010010010 0010000000110010000
|
||||
111100110 0000010000010010000
|
||||
100-10001 0001100000000000000
|
||||
100111101 0010010000000110000
|
||||
011010100 0001000011000000000
|
||||
101011101 0001100000011000000
|
||||
010101011 0001001100000001001
|
||||
110101100 0001100000000110000
|
||||
110101000 0001010001000000000
|
||||
001001101 0000101010000001110
|
||||
110010100 0000110100000000000
|
||||
011000101 0100000001001101100
|
||||
111000111 0100001001000000000
|
||||
001010000 0010000010001101100
|
||||
100011101 0100011010000000000
|
||||
1-0110000 0000000000100100000
|
||||
10000-011 0001000001000000000
|
||||
001011100 0000000011010010000
|
||||
101111001 0000000110100000000
|
||||
0010100-1 0000000010100000000
|
||||
010001-01 0010000000100000000
|
||||
110-11011 0000000000010010000
|
||||
1110-1011 0000010000000000000
|
||||
1001-1011 0000100000100000000
|
||||
00110001- 0010000000100000000
|
||||
100100110 0101000001010010000
|
||||
101010101 0010000000100110000
|
||||
-01101011 0001010000000000000
|
||||
001001000 0000000011100100000
|
||||
110000100 0000010011000000000
|
||||
101000-00 0000000010001000000
|
||||
010011110 0000000111000001100
|
||||
110111100 0000110001000000000
|
||||
001101001 0000010100001011010
|
||||
10011-001 0010000000100000000
|
||||
0100-0001 0000010010000000000
|
||||
100111-10 0000100100000000000
|
||||
110101101 0010001100000000000
|
||||
001101000 0000001010001101100
|
||||
-01111011 0001000100000000000
|
||||
001000-11 0000000011000000000
|
||||
110000101 0000101000010100000
|
||||
011100100 0000011001000000000
|
||||
011100110 0000100001000110000
|
||||
1011-0000 0010000000010000000
|
||||
100011011 0010000101001000000
|
||||
101-00000 0000001000000100000
|
||||
0011-1111 0000001000100000000
|
||||
011011100 0010000010010010000
|
||||
001010111 0001010001100000000
|
||||
110000010 0010000001011000000
|
||||
00-000-00 0000000000000010001
|
||||
0-1100110 0000000010100000000
|
||||
1001010-0 0000000011000000000
|
||||
11-001011 0010000000001000000
|
||||
011111-01 0011000000000000000
|
||||
01-110100 0010000000100000000
|
||||
101011001 0000001001001100000
|
||||
011101110 0000011000011000000
|
||||
101100001 0000000101000110000
|
||||
011111011 0010000001011000000
|
||||
011101100 0100000011100000000
|
||||
1-1001011 0000000010000010000
|
||||
-01011010 0000000001100000000
|
||||
0-1001011 0000001100000000000
|
||||
0110-0000 0000100010000000000
|
||||
111001101 0101010010000000000
|
||||
111000110 0010000011000000000
|
||||
011-00111 0000100010000000000
|
||||
01100-011 0000010000100000000
|
||||
1101-1011 0000001000000010000
|
||||
-11001010 0001010000000000000
|
||||
01110011- 0001001000000000000
|
||||
100011110 0010110001000000000
|
||||
110001-01 0000100100000000000
|
||||
011010110 0100000100111000000
|
||||
100010110 0001000110010100000
|
||||
100001011 0010110000000110000
|
||||
110-10010 0000110000000000000
|
||||
101-01101 0010010000000000000
|
||||
0-1100111 0000000101000000000
|
||||
110100-00 0010000000100000000
|
||||
01001100- 0000000010010010000
|
||||
110101-10 0010000000100000000
|
||||
111010100 0000101000001100000
|
||||
110-11001 0010000000100000000
|
||||
1100-1100 0010010000000000000
|
||||
1010101-0 0000010100000000000
|
||||
100001111 0010010010001100000
|
||||
11000011- 0001000000000110000
|
||||
111100011 0000010101000000000
|
||||
01010111- 0000010000100001001
|
||||
010111111 0010010110000000000
|
||||
011110000 0011000010100000000
|
||||
111110001 0010000000111000000
|
||||
100100011 0000000111100000000
|
||||
011100000 0011100001000000000
|
||||
011111110 0100001101000000000
|
||||
010110101 0010011010000000000
|
||||
010100011 0000110010001010000
|
||||
111111000 0000010101000000000
|
||||
111111101 0010000000111000000
|
||||
11101100- 0100000000011000000
|
||||
011111100 0001110100000000000
|
||||
001111011 0000101010001100000
|
||||
-11100001 0010000000100000000
|
||||
0111-1000 0000001000100000000
|
||||
100100000 0101110000011000000
|
||||
010100111 0000100110010100000
|
||||
101000010 0001011100000000000
|
||||
11001-010 0000001010000000000
|
||||
010001000 0010010001001100000
|
||||
-11110011 0010000000100000000
|
||||
010100101 0000001011100000000
|
||||
100--1000 0010000000000000000
|
||||
010101000 0001001001000110000
|
||||
010010101 0000100101100000110
|
||||
111101001 0000001010000110000
|
||||
111000100 0101000001000110000
|
||||
011001101 0001100100000110000
|
||||
001111111 0010010100011000000
|
||||
1010-1000 0000001001000000000
|
||||
100101100 0001000101010010000
|
||||
001110101 0001001110000001001
|
||||
0100-101- 0000000010000000000
|
||||
011100101 0000110100100000000
|
||||
110010001 0001011100000000000
|
||||
0-110-010 0000100000000000000
|
||||
111001100 0100100100011000000
|
||||
101100101 0001000110001100000
|
||||
10-001-01 0000000000100000000
|
||||
111111010 0000001001001100000
|
||||
101111110 0001010010001100000
|
||||
1-0001-00 0010000000000000000
|
||||
011001000 0001000110001010000
|
||||
001--0101 0000000001000000000
|
||||
010000101 0100101011000000000
|
||||
011011010 0010011000100000000
|
||||
110011110 0000111000100000000
|
||||
001110011 0010001100010010000
|
||||
111010110 0011110000000000000
|
||||
11101-111 0010000000100000000
|
||||
111011-00 0000100100000000000
|
||||
-01-11111 0000000000100000000
|
||||
111100111 0001110000100000000
|
||||
-10011000 0001110000000000000
|
||||
110001110 0001000110011000000
|
||||
01011-010 0001000110000000000
|
||||
-01100001 0001010000100000000
|
||||
010100100 0000000111011000000
|
||||
01--00010 0000000100000000000
|
||||
011011001 0010101001000000000
|
||||
1101110-1 0000000010010010000
|
||||
10-10-100 0000010000000000000
|
||||
--1011000 0000100000000000000
|
||||
-010-0110 0000000001000000000
|
||||
10--01011 0000001000000000000
|
||||
110110100 0001000110011000000
|
||||
100010011 0100010110011000000
|
||||
101110010 0000000111100000000
|
||||
001001100 0000010110001101110
|
||||
110100001 0010000111000000000
|
||||
110100011 0010010100001100000
|
||||
010100-10 0000010100100000000
|
||||
010100000 0000100101001101001
|
||||
11101-110 0000001010000000000
|
||||
1-01010-1 0000000001000000000
|
||||
001111000 0000001101100001001
|
||||
00101100- 0010000001100000000
|
||||
0100010-0 0000001100100000000
|
||||
010000110 0001110011000000000
|
||||
001-11110 0000001010100000000
|
||||
101101111 0101110000010010000
|
||||
-1-011101 0000000010000000000
|
||||
00101-101 0000000101100000000
|
||||
0101-0010 0010011000000000000
|
||||
10100010- 0000100001010000000
|
||||
-1011001- 0000000001000000000
|
||||
10111100- 0100001001000000000
|
||||
1111-1100 0000001100000000000
|
||||
10000000- 0000100000110010000
|
||||
110100101 0000011101000000000
|
||||
010-01111 0000001110000000000
|
||||
001010110 0000101000110011111
|
||||
001111100 0011011100000000000
|
||||
101100-11 0010100010000000000
|
||||
11101111- 0000000000110010000
|
||||
010111011 0011101001000000000
|
||||
11001-1-1 0000000001000000000
|
||||
101110111 0010000011010010000
|
||||
111001001 0000101001100000000
|
||||
0-1001010 0000000111000000000
|
||||
100011010 0010101110000000000
|
||||
01110100- 0011000001000000000
|
||||
11-111-00 0010000000000000000
|
||||
11-1-1111 0010000000000000000
|
||||
110110-10 0010100010000000000
|
||||
011101101 0000001011001010000
|
||||
1-110110- 0000010000000000000
|
||||
0-1001001 0000000100111000000
|
||||
100100101 0011101000010010000
|
||||
1-0111011 0100011000010000000
|
||||
111110010 0010011100000000000
|
||||
11-010-10 0000001000000000000
|
||||
111101101 0000101000101100000
|
||||
010111001 0000111100100000000
|
||||
011001-01 0010001010000000000
|
||||
010110001 0001110001011000000
|
||||
10100000- 0010000000101100000
|
||||
01110-111 0000110001000000000
|
||||
111010001 0010000001100110000
|
||||
1-1101011 0010010000100000000
|
||||
100-11011 0000010010100100000
|
||||
100111100 0010100110000110000
|
||||
111000000 0010000001110010000
|
||||
100010101 0010011101000000000
|
||||
01011011- 0000010001010010000
|
||||
10100101- 0010000000110010000
|
||||
010010110 0001001101100000101
|
||||
01111001- 0010000000100110000
|
||||
-11000010 0000010001100000000
|
||||
101-10001 0010000000110010000
|
||||
010000100 0010010101000110000
|
||||
10-00-100 0010000000100000000
|
||||
110000111 0010111010000000000
|
||||
1-00100-0 0010000000100000000
|
||||
-100-0000 0010000000100000000
|
||||
011000000 0001011101000000000
|
||||
011-10011 0000001101000000000
|
||||
1111011-0 0000100010100000000
|
||||
-11010011 0000010011000000000
|
||||
101000111 0010001110100000000
|
||||
011010001 0001000101101100000
|
||||
1-1100100 0010000101000000000
|
||||
010010011 0000000111110010000
|
||||
001111010 0000110111000001001
|
||||
111-11010 0000100110000000000
|
||||
010001011 0000011101011000000
|
||||
01110001- 0010000001010010000
|
||||
1010--011 0010000000100000000
|
||||
010010001 0010001101010010000
|
||||
110-01011 0000100110000100000
|
||||
10-011001 0001010110000000000
|
||||
10-1100-1 0000000001100000000
|
||||
010001111 0011110001100000000
|
||||
001111001 0000011011100001001
|
||||
001110110 0010011101000001001
|
||||
0101000-1 0001001101000000000
|
||||
01100-01- 0000101000000000000
|
||||
110110101 0010101101000000000
|
||||
010101100 0010011010001101001
|
||||
11001-01- 0010000000100000000
|
||||
110001111 0010001010111000000
|
||||
010110000 0000111010011001001
|
||||
1-1-00011 0010100000000000000
|
||||
0101101-0 0000111100000000000
|
||||
011010101 0010000011111000000
|
||||
110010110 0010000110110010000
|
||||
11-01-101 0001000100000000000
|
||||
101--0100 0010001000000000000
|
||||
001010100 0000001011111001100
|
||||
10-000101 0010100101000000000
|
||||
101111010 0000101001100110000
|
||||
101-01000 0001010110000000000
|
||||
111011001 0000111010100000000
|
||||
1010--110 0000001100000000000
|
||||
01-000110 0010001100100000000
|
||||
101010010 0010000111010010000
|
||||
11-10-010 0010000000100000000
|
||||
1011--011 0000010001000000000
|
||||
110110011 0010011100011000000
|
||||
110001010 0100111010001100000
|
||||
01011-110 0001001010010010000
|
||||
110-10111 0001010110000000000
|
||||
100011111 0001111000111000000
|
||||
10100111- 0000111000100000000
|
||||
11111111- 0010001000011000000
|
||||
00-0000-- 0000000000000110001
|
||||
100111000 0001111010011000000
|
||||
011000100 0011101110000000000
|
||||
-1100101- 0000000101000000000
|
||||
0110-1111 0010001100100000000
|
||||
111100000 0001011100010010000
|
||||
011111111 0011111000100000000
|
||||
1111-100- 0010000000100000000
|
||||
100-01010 0100001101100000000
|
||||
010010111 0010011101100000000
|
||||
1101-1000 0000101110000000000
|
||||
111010101 0010001001101100000
|
||||
110010-11 0000101011000000000
|
||||
1-1100001 0000111010000000000
|
||||
111000001 0000000111110010000
|
||||
1100--0-0 0000000000100000000
|
||||
011001100 0001111000110100000
|
||||
001111110 0010110101001010000
|
||||
1010-100- 0001110000000000000
|
||||
111110000 0010000111001010000
|
||||
100010111 0010101101000110000
|
||||
011110101 0001111101000000000
|
||||
01111110- 0000001011100000000
|
||||
-1--00011 0000001000000000000
|
||||
011111010 0011010110011000000
|
||||
101010111 0000111011100000000
|
||||
010111101 0010011100110010000
|
||||
-11-01-11 0000000000100000000
|
||||
111110100 0000011101010100000
|
||||
010101001 0010001111000110000
|
||||
1-1011-1- 0010000000000000000
|
||||
011110001 0011011100010100000
|
||||
100000111 0000011111010010000
|
||||
101111100 0010010111100000000
|
||||
110100111 0001111001011000000
|
||||
101100010 0001011011000110000
|
||||
111100-10 0000101011000000000
|
||||
101101001 0010101110011000000
|
||||
10-000011 0000111010100000000
|
||||
11001010- 0010001001010010000
|
||||
101100110 0010101101001100000
|
||||
101-01110 0001111000100000000
|
||||
011010010 0010001101101100000
|
||||
10-001110 0001011011000000000
|
||||
10000-000 0001011100010010000
|
||||
110-11101 0001111000100000000
|
||||
101011100 0000101111001010000
|
||||
1-0000110 0010001101100000000
|
||||
100011100 0011011001101100000
|
||||
111110110 0001111001000110000
|
||||
0110111-1 0001011101000000000
|
||||
010000111 0001001111101100000
|
||||
11011000- 0001011011000000000
|
||||
101010000 0001101111100000000
|
||||
100110111 0011001101101010000
|
||||
1101-1001 0010010101100000000
|
||||
111100101 0010001110110010000
|
||||
110011111 0001101110100110000
|
||||
100101101 0010010111110010000
|
||||
111001000 0100001111101100000
|
||||
0010001-- 0000000011011101110
|
||||
010111000 0000011111110010000
|
||||
1-0000000 0001101111000000000
|
||||
110111010 0011011001110010000
|
||||
101101010 0010010111111000000
|
||||
011110111 0010101111001100000
|
||||
110100110 0000111011101010000
|
||||
111110111 0001111111000000000
|
||||
01-011000 0001011111000000000
|
||||
00-00-0-- 0000000000011001110
|
||||
11110-1-0 0001001101000000000
|
||||
111110101 0000111011100110000
|
||||
001101100 0010011111111000000
|
||||
010101101 0001111111001101001
|
||||
010001100 0000111111111000011
|
||||
111001111 0011101111010100000
|
||||
1000000-0 0000111111010010000
|
||||
011110110 0001111111101100000
|
||||
000------ 0000000000011111111
|
||||
.e
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,353 @@
|
|||
.model s444
|
||||
.inputs G0 G1 G2
|
||||
.outputs G118 G167 G107 G119 G168 G108
|
||||
|
||||
.latch G11_in G11 0
|
||||
.latch G12_in G12 0
|
||||
.latch G13_in G13 0
|
||||
.latch G14_in G14 0
|
||||
.latch G15_in G15 0
|
||||
.latch G16_in G16 0
|
||||
.latch G17_in G17 0
|
||||
.latch G18_in G18 0
|
||||
.latch G19_in G19 0
|
||||
.latch G20_in G20 0
|
||||
.latch G21_in G21 0
|
||||
.latch G22_in G22 0
|
||||
.latch G23_in G23 0
|
||||
.latch G24_in G24 0
|
||||
.latch G25_in G25 0
|
||||
.latch G26_in G26 0
|
||||
.latch G27_in G27 0
|
||||
.latch G28_in G28 0
|
||||
.latch G29_in G29 0
|
||||
.latch G30_in G30 0
|
||||
.latch G31_in G31 0
|
||||
|
||||
.names G12 G13 [25]
|
||||
00 1
|
||||
.names G11 [25] [26]
|
||||
01 1
|
||||
.names G14 [26] [27]
|
||||
10 1
|
||||
.names G0 G11 [28]
|
||||
00 1
|
||||
.names [27] [28] G11_in
|
||||
01 1
|
||||
.names G11 G12 [30]
|
||||
11 1
|
||||
.names G12 [30] [31]
|
||||
10 1
|
||||
.names G11 [30] [32]
|
||||
10 1
|
||||
.names [31] [32] [33]
|
||||
00 1
|
||||
.names G0 [33] [34]
|
||||
00 1
|
||||
.names [27] [34] G12_in
|
||||
01 1
|
||||
.names G13 [30] [36]
|
||||
11 1
|
||||
.names G13 [36] [37]
|
||||
10 1
|
||||
.names [30] [36] [38]
|
||||
10 1
|
||||
.names [37] [38] [39]
|
||||
00 1
|
||||
.names G0 [39] [40]
|
||||
00 1
|
||||
.names [27] [40] G13_in
|
||||
01 1
|
||||
.names G12 G13 [42]
|
||||
11 1
|
||||
.names G11 [42] [43]
|
||||
11 1
|
||||
.names G14 [43] [44]
|
||||
11 1
|
||||
.names G14 [44] [45]
|
||||
10 1
|
||||
.names [43] [44] [46]
|
||||
10 1
|
||||
.names [45] [46] [47]
|
||||
00 1
|
||||
.names G0 [47] [48]
|
||||
00 1
|
||||
.names [27] [48] G14_in
|
||||
01 1
|
||||
.names G31 [27] [50]
|
||||
00 1
|
||||
.names G16 G17 [51]
|
||||
00 1
|
||||
.names G15 [51] [52]
|
||||
01 1
|
||||
.names [50] [52] [53]
|
||||
00 1
|
||||
.names G18 [53] [54]
|
||||
11 1
|
||||
.names G15 [50] [55]
|
||||
10 1
|
||||
.names G15 [55] [56]
|
||||
10 1
|
||||
.names [50] [55] [57]
|
||||
00 1
|
||||
.names [56] [57] [58]
|
||||
00 1
|
||||
.names G0 [58] [59]
|
||||
00 1
|
||||
.names [54] [59] G15_in
|
||||
01 1
|
||||
.names G16 [55] [61]
|
||||
11 1
|
||||
.names G16 [61] [62]
|
||||
10 1
|
||||
.names [55] [61] [63]
|
||||
10 1
|
||||
.names [62] [63] [64]
|
||||
00 1
|
||||
.names G0 [64] [65]
|
||||
00 1
|
||||
.names [54] [65] G16_in
|
||||
01 1
|
||||
.names G16 [50] [67]
|
||||
10 1
|
||||
.names G15 [67] [68]
|
||||
11 1
|
||||
.names G17 [68] [69]
|
||||
11 1
|
||||
.names G17 [69] [70]
|
||||
10 1
|
||||
.names [68] [69] [71]
|
||||
10 1
|
||||
.names [70] [71] [72]
|
||||
00 1
|
||||
.names G0 [72] [73]
|
||||
00 1
|
||||
.names [54] [73] G17_in
|
||||
01 1
|
||||
.names G15 G16 [75]
|
||||
11 1
|
||||
.names G17 [50] [76]
|
||||
10 1
|
||||
.names [75] [76] [77]
|
||||
11 1
|
||||
.names G18 [77] [78]
|
||||
11 1
|
||||
.names G18 [78] [79]
|
||||
10 1
|
||||
.names [77] [78] [80]
|
||||
10 1
|
||||
.names [79] [80] [81]
|
||||
00 1
|
||||
.names G0 [81] [82]
|
||||
00 1
|
||||
.names [54] [82] G18_in
|
||||
01 1
|
||||
.names G20 G21 [84]
|
||||
00 1
|
||||
.names G19 [84] [85]
|
||||
01 1
|
||||
.names [54] [85] [86]
|
||||
10 1
|
||||
.names G22 [86] [87]
|
||||
11 1
|
||||
.names G19 [54] [88]
|
||||
11 1
|
||||
.names G19 [88] [89]
|
||||
10 1
|
||||
.names [54] [88] [90]
|
||||
10 1
|
||||
.names [89] [90] [91]
|
||||
00 1
|
||||
.names G0 [91] [92]
|
||||
00 1
|
||||
.names [87] [92] G19_in
|
||||
01 1
|
||||
.names G20 [88] [94]
|
||||
11 1
|
||||
.names G20 [94] [95]
|
||||
10 1
|
||||
.names [88] [94] [96]
|
||||
10 1
|
||||
.names [95] [96] [97]
|
||||
00 1
|
||||
.names G0 [97] [98]
|
||||
00 1
|
||||
.names [87] [98] G20_in
|
||||
01 1
|
||||
.names G20 [54] [100]
|
||||
11 1
|
||||
.names G19 [100] [101]
|
||||
11 1
|
||||
.names G21 [101] [102]
|
||||
11 1
|
||||
.names G21 [102] [103]
|
||||
10 1
|
||||
.names [101] [102] [104]
|
||||
10 1
|
||||
.names [103] [104] [105]
|
||||
00 1
|
||||
.names G0 [105] [106]
|
||||
00 1
|
||||
.names [87] [106] G21_in
|
||||
01 1
|
||||
.names G19 G20 [108]
|
||||
11 1
|
||||
.names G21 [54] [109]
|
||||
11 1
|
||||
.names [108] [109] [110]
|
||||
11 1
|
||||
.names G22 [110] [111]
|
||||
11 1
|
||||
.names G22 [111] [112]
|
||||
10 1
|
||||
.names [110] [111] [113]
|
||||
10 1
|
||||
.names [112] [113] [114]
|
||||
00 1
|
||||
.names G0 [114] [115]
|
||||
00 1
|
||||
.names [87] [115] G22_in
|
||||
01 1
|
||||
.names G2 G23 [117]
|
||||
00 1
|
||||
.names G2 G23 [118]
|
||||
11 1
|
||||
.names [117] [118] [119]
|
||||
00 1
|
||||
.names G0 [119] G23_in
|
||||
01 1
|
||||
.names G20 G21 [121]
|
||||
01 1
|
||||
.names G0 G23 [122]
|
||||
01 1
|
||||
.names [121] [122] [123]
|
||||
11 1
|
||||
.names G19 [123] [124]
|
||||
01 1
|
||||
.names G21 G22 [126]
|
||||
10 1
|
||||
.names G19 G20 [125]
|
||||
10 1
|
||||
.names G23 [125] [127]
|
||||
01 1
|
||||
.names [126] [127] [128]
|
||||
11 1
|
||||
.names G0 G24 [129]
|
||||
01 1
|
||||
.names [128] [129] [130]
|
||||
01 1
|
||||
.names [124] [130] [131]
|
||||
00 1
|
||||
.names G22 G23 [132]
|
||||
00 1
|
||||
.names [125] [132] [133]
|
||||
11 1
|
||||
.names G24 [133] [134]
|
||||
10 1
|
||||
.names G19 G20 [135]
|
||||
00 1
|
||||
.names G23 [135] [136]
|
||||
11 1
|
||||
.names G22 G23 [137]
|
||||
11 1
|
||||
.names [136] [137] [138]
|
||||
00 1
|
||||
.names G0 G21 [139]
|
||||
01 1
|
||||
.names [138] [139] [140]
|
||||
11 1
|
||||
.names [134] [140] G25_in
|
||||
01 1
|
||||
.names G19 G22 [142]
|
||||
01 1
|
||||
.names G0 [142] [143]
|
||||
01 1
|
||||
.names G0 [108] [144]
|
||||
01 1
|
||||
.names [143] [144] [145]
|
||||
00 1
|
||||
.names [129] [139] [146]
|
||||
00 1
|
||||
.names [145] [146] G26_in
|
||||
11 1
|
||||
.names G21 G24 [148]
|
||||
00 1
|
||||
.names [125] [148] [149]
|
||||
11 1
|
||||
.names G21 G22 [150]
|
||||
00 1
|
||||
.names G24 [150] [151]
|
||||
01 1
|
||||
.names G0 [151] [152]
|
||||
00 1
|
||||
.names [149] [152] [153]
|
||||
01 1
|
||||
.names G0 G22 [154]
|
||||
01 1
|
||||
.names [135] [154] [155]
|
||||
11 1
|
||||
.names [146] [155] [156]
|
||||
10 1
|
||||
.names [131] [156] [157]
|
||||
00 1
|
||||
.names G17 [157] [158]
|
||||
01 1
|
||||
.names [131] [156] [159]
|
||||
10 1
|
||||
.names [158] [159] G28_in
|
||||
00 1
|
||||
.names [122] [126] [161]
|
||||
11 1
|
||||
.names G21 G22 [162]
|
||||
01 1
|
||||
.names G0 [162] [163]
|
||||
01 1
|
||||
.names [161] [163] [164]
|
||||
00 1
|
||||
.names G20 [164] [165]
|
||||
00 1
|
||||
.names G19 [165] [166]
|
||||
01 1
|
||||
.names [130] [166] [167]
|
||||
00 1
|
||||
.names [131] [167] [168]
|
||||
00 1
|
||||
.names G17 [168] [169]
|
||||
01 1
|
||||
.names [131] [167] [170]
|
||||
10 1
|
||||
.names [169] [170] G29_in
|
||||
00 1
|
||||
.names G20 G21 [172]
|
||||
10 1
|
||||
.names G0 G24 [173]
|
||||
00 1
|
||||
.names [172] [173] [174]
|
||||
11 1
|
||||
.names G19 [174] G30_in
|
||||
11 1
|
||||
.names G1 G31 [176]
|
||||
00 1
|
||||
.names G1 G31 [177]
|
||||
11 1
|
||||
.names [176] [177] [178]
|
||||
00 1
|
||||
.names G0 [178] G31_in
|
||||
01 1
|
||||
.names [131] G24_in
|
||||
0 1
|
||||
.names [153] G27_in
|
||||
0 1
|
||||
.names G27 G118
|
||||
1 1
|
||||
.names G29 G167
|
||||
0 1
|
||||
.names G25 G107
|
||||
1 1
|
||||
.names G28 G119
|
||||
0 1
|
||||
.names G30 G168
|
||||
1 1
|
||||
.names G26 G108
|
||||
1 1
|
||||
.end
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
13
readme
13
readme
|
|
@ -4,15 +4,20 @@ The following steps may be needed to compile it on UNIX:
|
|||
>> dos2unix Makefile Makefile
|
||||
>> dos2unix depends.sh depends.sh
|
||||
>> chmod 755 depends.sh
|
||||
>> make
|
||||
>> make // on Solaris, try "gmake"
|
||||
|
||||
If compiling as a static library, it is necessary to uncomment
|
||||
#define _LIB in "src/abc/main/main.c"
|
||||
|
||||
|
||||
Several things to try if it does not compile on your platform:
|
||||
- Try running all code through dos2unix (Solaris)
|
||||
- Try removing flags from the libs line (LIBS :=) in Makefile (Mac)
|
||||
- Try running all code (not only Makefile and depends.sh) through dos2unix
|
||||
- Try the following actions:
|
||||
(a) Remove flags from the libs line (LIBS :=) in Makefile
|
||||
(b) Remove "src\base\main\libSupport.c" from "src\base\main\module.make"
|
||||
(c) Comment calls to Libs_Init() and Libs_End() in "src\base\main\mainInit.c"
|
||||
- Try linking with gcc (rather than g++)
|
||||
For this replace "LD := g++" with "LD := gcc -lm" in Makefile
|
||||
|
||||
|
||||
Finally, run regression test:
|
||||
abc>>> so regtest.script
|
||||
|
|
|
|||
|
|
@ -0,0 +1,97 @@
|
|||
UC Berkeley, ABC 1.01 (compiled May 9 2006 09:22:13)
|
||||
abc 02> so regtest.script
|
||||
abc - > r examples/apex4.pla; resyn; sharem; fpga; cec; ps; clp; share; resyn; map; cec; ps
|
||||
Networks are equivalent.
|
||||
examples/apex4: i/o = 9/ 19 lat = 0 nd = 1183 cube = 2195 lev = 7
|
||||
The shared BDD size is 900 nodes.
|
||||
A simple supergate library is derived from gate library "mcnc_temp.genlib".
|
||||
Loaded 20 unique 5-input supergates from "mcnc_temp.super". Time = 0.03 sec
|
||||
Networks are equivalent.
|
||||
examples/apex4: i/o = 9/ 19 lat = 0 nd = 1789 area = 4554.00 delay = 11.50 lev = 11
|
||||
abc - > r examples/C2670.blif; resyn; fpga; cec; ps; u; map; cec; ps
|
||||
Networks are equivalent.
|
||||
C2670.iscas : i/o = 233/ 140 lat = 0 nd = 218 cube = 444 lev = 7
|
||||
Networks are equivalent.
|
||||
C2670.iscas : i/o = 233/ 140 lat = 0 nd = 471 area = 1166.00 delay = 15.50 lev = 14
|
||||
abc - > r examples/frg2.blif; dsd; muxes; cec; clp; share; resyn; map; cec; ps
|
||||
Networks are equivalent.
|
||||
The shared BDD size is 1111 nodes.
|
||||
Networks are equivalent.
|
||||
frg2 : i/o = 143/ 139 lat = 0 nd = 540 area = 1373.00 delay = 9.70 lev = 9
|
||||
abc - > r examples/pj1.blif; resyn; fpga; cec; ps; u; map; cec; ps
|
||||
Networks are equivalent.
|
||||
exCombCkt : i/o = 1769/1063 lat = 0 nd = 5582 cube = 10389 lev = 15
|
||||
Networks are equivalent.
|
||||
exCombCkt : i/o = 1769/1063 lat = 0 nd = 10291 area = 24781.00 delay = 29.80 lev = 27
|
||||
abc - > r examples/s38584.bench; resyn; fpga; cec; ps; u; map; cec; ps
|
||||
Networks are equivalent.
|
||||
examples/s38584: i/o = 12/ 278 lat = 1452 nd = 4404 cube = 7515 lev = 9
|
||||
Networks are equivalent.
|
||||
examples/s38584: i/o = 12/ 278 lat = 1452 nd = 8506 area = 19313.00 delay = 20.60 lev = 17
|
||||
abc - > r examples/ac.v; resyn; fpga; cec; ps; u; map; cec; ps
|
||||
Networks are equivalent.
|
||||
ac97_ctrl : i/o = 84/ 48 lat = 2199 nd = 4082 cube = 7776 lev = 4
|
||||
Networks are equivalent.
|
||||
ac97_ctrl : i/o = 84/ 48 lat = 2199 nd = 8274 area = 19707.00 delay = 8.10 lev = 8
|
||||
abc - > r examples/s444.blif; b; esd -v; dsd; cec; ps
|
||||
The shared BDD size is 181 nodes.
|
||||
BDD nodes in the transition relation before reordering 557.
|
||||
BDD nodes in the transition relation after reordering 456.
|
||||
Reachability analysis completed in 151 iterations.
|
||||
The number of minterms in the reachable state set = 8865.
|
||||
BDD nodes in the unreachable states before reordering 124.
|
||||
BDD nodes in the unreachable states after reordering 113.
|
||||
Networks are equivalent.
|
||||
s444 : i/o = 3/ 6 lat = 21 nd = 81 cube = 119 lev = 7
|
||||
abc - > r examples/i10.blif; fpga; cec; ps; u; map; cec; ps
|
||||
The network was strashed and balanced before FPGA mapping.
|
||||
Networks are equivalent.
|
||||
i10 : i/o = 257/ 224 lat = 0 nd = 890 cube = 1593 lev = 13
|
||||
The network was strashed and balanced before mapping.
|
||||
Networks are equivalent.
|
||||
i10 : i/o = 257/ 224 lat = 0 nd = 1700 area = 4245.00 delay = 30.80 lev = 28
|
||||
abc - > r examples/i10.blif; choice; fpga; cec; ps; u; map; cec; ps
|
||||
Currently stored 3 networks with 5794 nodes will be fraiged.
|
||||
Total fraiging time = 0.74 sec
|
||||
Performing FPGA mapping with choices.
|
||||
Networks are equivalent.
|
||||
i10 : i/o = 257/ 224 lat = 0 nd = 799 cube = 1484 lev = 12
|
||||
Performing mapping with choices.
|
||||
Networks are equivalent.
|
||||
i10 : i/o = 257/ 224 lat = 0 nd = 1485 area = 3528.00 delay = 25.40 lev = 23
|
||||
abc - > r examples/s6669.blif; fpga; ps; sec; u; sfpga; ps; sec; u; fpga; ret; ps; sec
|
||||
The network was strashed and balanced before FPGA mapping.
|
||||
s6669 : i/o = 83/ 55 lat = 239 nd = 679 bdd = 3060 lev = 20
|
||||
Networks are equivalent after fraiging.
|
||||
The network was strashed and balanced before FPGA mapping/retiming.
|
||||
The number of LUTs with incompatible edges = 25.
|
||||
The number of LUTs with more than 4 inputs = 18.
|
||||
s6669 : i/o = 83/ 55 lat = 404 nd = 829 bdd = 3867 lev = 6
|
||||
Networks are equivalent after fraiging.
|
||||
The network was strashed and balanced before FPGA mapping.
|
||||
s6669 : i/o = 83/ 55 lat = 347 nd = 773 bdd = 3262 lev = 9
|
||||
Networks are equivalent after fraiging.
|
||||
abc - > r examples/s5378.blif; map -s; ps; sec; u; smap; ps; sec; u; map; ret; ps; sec
|
||||
The network was strashed and balanced before mapping.
|
||||
s5378 : i/o = 35/ 49 lat = 164 nd = 1009 area = 2352.00 delay = 12.40 lev = 11
|
||||
Networks are equivalent after fraiging.
|
||||
The number of nodes with equal fanins = 5.
|
||||
The network was strashed and balanced before SC mapping/retiming.
|
||||
The mininum clock period computed is 10.00.
|
||||
The resulting network is derived as BDD logic network (this is temporary).
|
||||
s5378 : i/o = 35/ 49 lat = 399 nd = 1230 bdd = 4548 lev = 7
|
||||
Networks are equivalent after fraiging.
|
||||
The network was strashed and balanced before mapping.
|
||||
s5378 : i/o = 35/ 49 lat = 359 nd = 1083 area = 2426.00 delay = 13.00 lev = 11
|
||||
Networks are equivalent after fraiging.
|
||||
abc - > time
|
||||
elapse: 188.97 seconds, total: 188.97 seconds
|
||||
abc 123>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -53,7 +53,6 @@ typedef enum {
|
|||
ABC_NTK_LOGIC, // 2: network with PIs/POs, latches, and nodes
|
||||
ABC_NTK_STRASH, // 3: structurally hashed AIG (two input AND gates with c-attributes on edges)
|
||||
ABC_NTK_SEQ, // 4: sequential AIG (two input AND gates with c- and latch-attributes on edges)
|
||||
ABC_NTK_BLACKBOX, // 5: black box about which nothing is known
|
||||
ABC_NTK_OTHER // 6: unused
|
||||
} Abc_NtkType_t;
|
||||
|
||||
|
|
@ -89,8 +88,9 @@ typedef enum {
|
|||
ABC_OBJ_LATCH, // 3: latch
|
||||
ABC_OBJ_PI, // 4: primary input terminal
|
||||
ABC_OBJ_PO, // 5: primary output terminal
|
||||
ABC_OBJ_BOX, // 6: abstract box
|
||||
ABC_OBJ_OTHER // 7: unused
|
||||
ABC_OBJ_ASSERT, // 6: assertion output
|
||||
ABC_OBJ_BOX, // 7: box
|
||||
ABC_OBJ_OTHER // 8: unused
|
||||
} Abc_ObjType_t;
|
||||
|
||||
// latch initial values
|
||||
|
|
@ -107,9 +107,11 @@ typedef enum {
|
|||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//typedef int bool;
|
||||
#ifndef __cplusplus
|
||||
#ifndef bool
|
||||
#define bool int
|
||||
#endif
|
||||
#endif
|
||||
|
||||
typedef struct Abc_Obj_t_ Abc_Obj_t;
|
||||
typedef struct Abc_Ntk_t_ Abc_Ntk_t;
|
||||
|
|
@ -120,101 +122,82 @@ typedef struct Abc_Time_t_ Abc_Time_t;
|
|||
|
||||
struct Abc_Time_t_
|
||||
{
|
||||
float Rise;
|
||||
float Fall;
|
||||
float Worst;
|
||||
float Rise;
|
||||
float Fall;
|
||||
float Worst;
|
||||
};
|
||||
|
||||
struct Abc_Obj_t_ // 12 words
|
||||
{
|
||||
// high-level information
|
||||
Abc_Ntk_t * pNtk; // the host network
|
||||
int Id; // the object ID
|
||||
Abc_Ntk_t * pNtk; // the host network
|
||||
int Id; // the object ID
|
||||
// internal information
|
||||
unsigned Type : 3; // the object type
|
||||
unsigned fMarkA : 1; // the multipurpose mark
|
||||
unsigned fMarkB : 1; // the multipurpose mark
|
||||
unsigned fMarkC : 1; // the multipurpose mark
|
||||
unsigned fPhase : 1; // the flag to mark the phase of equivalent node
|
||||
unsigned fExor : 1; // marks AIG node that is a root of EXOR
|
||||
unsigned fCompl0 : 1; // complemented attribute of the first fanin in the AIG
|
||||
unsigned fCompl1 : 1; // complemented attribute of the second fanin in the AIG
|
||||
unsigned TravId : 10; // the traversal ID (if changed, update Abc_NtkIncrementTravId)
|
||||
unsigned Level : 12; // the level of the node
|
||||
unsigned Type : 3; // the object type
|
||||
unsigned fMarkA : 1; // the multipurpose mark
|
||||
unsigned fMarkB : 1; // the multipurpose mark
|
||||
unsigned fMarkC : 1; // the multipurpose mark
|
||||
unsigned fPhase : 1; // the flag to mark the phase of equivalent node
|
||||
unsigned fExor : 1; // marks AIG node that is a root of EXOR
|
||||
unsigned fPersist: 1; // marks the persistant AIG node
|
||||
unsigned fCompl0 : 1; // complemented attribute of the first fanin in the AIG
|
||||
unsigned fCompl1 : 1; // complemented attribute of the second fanin in the AIG
|
||||
unsigned TravId : 9; // the traversal ID (if changed, update Abc_NtkIncrementTravId)
|
||||
unsigned Level : 12; // the level of the node
|
||||
// connectivity
|
||||
Vec_Int_t vFanins; // the array of fanins
|
||||
Vec_Int_t vFanouts; // the array of fanouts
|
||||
Vec_Int_t vFanins; // the array of fanins
|
||||
Vec_Int_t vFanouts; // the array of fanouts
|
||||
// miscellaneous
|
||||
void * pData; // the network specific data (SOP, BDD, gate, equiv class, etc)
|
||||
Abc_Obj_t * pNext; // the next pointer in the hash table
|
||||
Abc_Obj_t * pCopy; // the copy of this object
|
||||
void * pData; // the network specific data (SOP, BDD, gate, equiv class, etc)
|
||||
Abc_Obj_t * pNext; // the next pointer in the hash table
|
||||
Abc_Obj_t * pCopy; // the copy of this object
|
||||
};
|
||||
|
||||
struct Abc_Ntk_t_
|
||||
{
|
||||
// general information
|
||||
Abc_NtkType_t ntkType; // type of the network
|
||||
Abc_NtkFunc_t ntkFunc; // functionality of the network
|
||||
char * pName; // the network name
|
||||
char * pSpec; // the name of the spec file if present
|
||||
int Id; // network ID
|
||||
// name representation
|
||||
// stmm_table * tName2Net; // the table hashing net names into net pointer
|
||||
// stmm_table * tObj2Name; // the table hashing PI/PO/latch pointers into names
|
||||
Abc_NtkType_t ntkType; // type of the network
|
||||
Abc_NtkFunc_t ntkFunc; // functionality of the network
|
||||
char * pName; // the network name
|
||||
char * pSpec; // the name of the spec file if present
|
||||
int Id; // network ID
|
||||
Nm_Man_t * pManName; // name manager (stores names of objects)
|
||||
// components of the network
|
||||
Vec_Ptr_t * vObjs; // the array of all objects (net, nodes, latches)
|
||||
Vec_Ptr_t * vCis; // the array of combinational inputs (PIs followed by latches)
|
||||
Vec_Ptr_t * vCos; // the array of combinational outputs (POs followed by latches)
|
||||
Vec_Ptr_t * vAsserts; // the array of assertions
|
||||
Vec_Ptr_t * vLats; // the array of latches (or the cutset in the sequential network)
|
||||
Vec_Ptr_t * vCutSet; // the array of cutset nodes (used in the sequential AIG)
|
||||
// the stats about the number of living objects
|
||||
int nObjs; // the number of live objs
|
||||
int nNets; // the number of live nets
|
||||
int nNodes; // the number of live nodes
|
||||
int nBoxes; // the number of live nodes
|
||||
int nLatches; // the number of live latches
|
||||
int nPis; // the number of primary inputs
|
||||
int nPos; // the number of primary outputs
|
||||
int nAsserts; // the number of assertion primary outputs
|
||||
// the functionality manager
|
||||
void * pManFunc; // AIG manager, BDD manager, or memory manager for SOPs
|
||||
// the global functions (BDDs)
|
||||
void * pManGlob; // the BDD manager
|
||||
Vec_Ptr_t * vFuncsGlob; // the BDDs of CO functions
|
||||
// the timing manager (for mapped networks)
|
||||
Abc_ManTime_t * pManTime; // stores arrival/required times for all nodes
|
||||
// the cut manager (for AIGs)
|
||||
void * pManCut; // stores information about the cuts computed for the nodes
|
||||
// level information (for AIGs)
|
||||
int LevelMax; // maximum number of levels
|
||||
Vec_Int_t * vLevelsR; // level in the reverse topological order
|
||||
// support information
|
||||
Vec_Ptr_t * vSupps;
|
||||
// the satisfiable assignment of the miter
|
||||
int * pModel;
|
||||
// the external don't-care if given
|
||||
Abc_Ntk_t * pExdc; // the EXDC network
|
||||
// miscellaneous data members
|
||||
unsigned nTravIds; // the unique traversal IDs of nodes
|
||||
Vec_Ptr_t * vPtrTemp; // the temporary array
|
||||
Vec_Int_t * vIntTemp; // the temporary array
|
||||
Vec_Str_t * vStrTemp; // the temporary array
|
||||
void * pData; // the temporary pointer
|
||||
// name manager
|
||||
Nm_Man_t * pManName;
|
||||
Vec_Ptr_t * vObjs; // the array of all objects (net, nodes, latches, etc)
|
||||
Vec_Ptr_t * vCis; // the array of combinational inputs (PIs, latches)
|
||||
Vec_Ptr_t * vCos; // the array of combinational outputs (POs, asserts, latches)
|
||||
Vec_Ptr_t * vPis; // the array of PIs
|
||||
Vec_Ptr_t * vPos; // the array of POs
|
||||
Vec_Ptr_t * vLatches; // the array of latches (or the cutset in the sequential network)
|
||||
Vec_Ptr_t * vAsserts; // the array of assertions
|
||||
Vec_Ptr_t * vCutSet; // the array of cutset nodes (used in the sequential AIG)
|
||||
// the number of living objects
|
||||
int nObjs; // the number of live objs
|
||||
int nNets; // the number of live nets
|
||||
int nNodes; // the number of live nodes
|
||||
int nBoxes; // the number of live nodes
|
||||
// the backup network and the step number
|
||||
Abc_Ntk_t * pNetBackup; // the pointer to the previous backup network
|
||||
int iStep; // the generation number for the given network
|
||||
// hierarchical design
|
||||
stmm_table * tName2Model; // the table hashing names into network pointers (or NULL if no hierarchy)
|
||||
Vec_Int_t * pBlackBoxes; // stores pairs (PI num, PO num) for each model, including the base model (or NULL if no hierarchy)
|
||||
short fHieVisited; // flag to mark the visited network
|
||||
short fHiePath; // flag to mark the network on the path
|
||||
// memory management
|
||||
// Extra_MmFlex_t * pMmNames; // memory manager for net names
|
||||
Extra_MmFixed_t* pMmObj; // memory manager for objects
|
||||
Extra_MmStep_t * pMmStep; // memory manager for arrays
|
||||
Abc_Ntk_t * pNetBackup; // the pointer to the previous backup network
|
||||
int iStep; // the generation number for the given network
|
||||
// hierarchy
|
||||
stmm_table * tName2Model; // the table hashing names into network pointers (or NULL if no hierarchy)
|
||||
Vec_Int_t * pBlackBoxes; // stores pairs (PI num, PO num) for each model, including the base model (or NULL if no hierarchy)
|
||||
short fHieVisited; // flag to mark the visited network
|
||||
short fHiePath; // flag to mark the network on the path
|
||||
// miscellaneous data members
|
||||
unsigned nTravIds; // the unique traversal IDs of nodes
|
||||
Extra_MmFixed_t * pMmObj; // memory manager for objects
|
||||
Extra_MmStep_t * pMmStep; // memory manager for arrays
|
||||
void * pManFunc; // functionality manager (AIG manager, BDD manager, or memory manager for SOPs)
|
||||
void * pManGlob; // the global BDD manager
|
||||
Vec_Ptr_t * vFuncsGlob; // the global BDDs of CO functions
|
||||
Abc_ManTime_t * pManTime; // the timing manager (for mapped networks) stores arrival/required times for all nodes
|
||||
void * pManCut; // the cut manager (for AIGs) stores information about the cuts computed for the nodes
|
||||
int LevelMax; // maximum number of levels
|
||||
Vec_Int_t * vLevelsR; // level in the reverse topological order (for AIGs)
|
||||
Vec_Ptr_t * vSupps; // CO support information
|
||||
int * pModel; // counter-example (for miters)
|
||||
Abc_Ntk_t * pExdc; // the EXDC network (if given)
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -236,7 +219,6 @@ static inline bool Abc_NtkIsNetlist( Abc_Ntk_t * pNtk ) { return pN
|
|||
static inline bool Abc_NtkIsLogic( Abc_Ntk_t * pNtk ) { return pNtk->ntkType == ABC_NTK_LOGIC; }
|
||||
static inline bool Abc_NtkIsStrash( Abc_Ntk_t * pNtk ) { return pNtk->ntkType == ABC_NTK_STRASH; }
|
||||
static inline bool Abc_NtkIsSeq( Abc_Ntk_t * pNtk ) { return pNtk->ntkType == ABC_NTK_SEQ; }
|
||||
static inline bool Abc_NtkIsBlackbox( Abc_Ntk_t * pNtk ) { return pNtk->ntkType == ABC_NTK_BLACKBOX;}
|
||||
|
||||
static inline bool Abc_NtkHasSop( Abc_Ntk_t * pNtk ) { return pNtk->ntkFunc == ABC_FUNC_SOP; }
|
||||
static inline bool Abc_NtkHasBdd( Abc_Ntk_t * pNtk ) { return pNtk->ntkFunc == ABC_FUNC_BDD; }
|
||||
|
|
@ -249,7 +231,7 @@ static inline bool Abc_NtkIsMappedNetlist( Abc_Ntk_t * pNtk ) { return pN
|
|||
static inline bool Abc_NtkIsSopLogic( Abc_Ntk_t * pNtk ) { return pNtk->ntkFunc == ABC_FUNC_SOP && pNtk->ntkType == ABC_NTK_LOGIC ; }
|
||||
static inline bool Abc_NtkIsBddLogic( Abc_Ntk_t * pNtk ) { return pNtk->ntkFunc == ABC_FUNC_BDD && pNtk->ntkType == ABC_NTK_LOGIC ; }
|
||||
static inline bool Abc_NtkIsMappedLogic( Abc_Ntk_t * pNtk ) { return pNtk->ntkFunc == ABC_FUNC_MAP && pNtk->ntkType == ABC_NTK_LOGIC ; }
|
||||
static inline bool Abc_NtkIsComb( Abc_Ntk_t * pNtk ) { return pNtk->nLatches == 0; }
|
||||
static inline bool Abc_NtkIsComb( Abc_Ntk_t * pNtk ) { return Vec_PtrSize(pNtk->vLatches) == 0; }
|
||||
|
||||
// reading data members of the network
|
||||
static inline char * Abc_NtkName( Abc_Ntk_t * pNtk ) { return pNtk->pName; }
|
||||
|
|
@ -258,7 +240,7 @@ static inline int Abc_NtkTravId( Abc_Ntk_t * pNtk ) { return pN
|
|||
static inline Abc_Ntk_t * Abc_NtkExdc( Abc_Ntk_t * pNtk ) { return pNtk->pExdc; }
|
||||
static inline Abc_Ntk_t * Abc_NtkBackup( Abc_Ntk_t * pNtk ) { return pNtk->pNetBackup; }
|
||||
static inline int Abc_NtkStep ( Abc_Ntk_t * pNtk ) { return pNtk->iStep; }
|
||||
static inline Abc_Obj_t * Abc_NtkConst1( Abc_Ntk_t * pNtk ) { return pNtk->vObjs->pArray[0]; }
|
||||
static inline Abc_Obj_t * Abc_NtkConst1( Abc_Ntk_t * pNtk ) { return (Abc_Obj_t *)Vec_PtrEntry( pNtk->vObjs, 0 ); }
|
||||
|
||||
// setting data members of the network
|
||||
static inline void Abc_NtkSetName ( Abc_Ntk_t * pNtk, char * pName ) { pNtk->pName = pName; }
|
||||
|
|
@ -267,25 +249,27 @@ static inline void Abc_NtkSetBackup( Abc_Ntk_t * pNtk, Abc_Ntk_t * pNetBa
|
|||
static inline void Abc_NtkSetStep ( Abc_Ntk_t * pNtk, int iStep ) { pNtk->iStep = iStep; }
|
||||
|
||||
// getting the number of objects
|
||||
static inline int Abc_NtkObjNumMax( Abc_Ntk_t * pNtk ) { return pNtk->vObjs->nSize; }
|
||||
static inline int Abc_NtkObjNum( Abc_Ntk_t * pNtk ) { return pNtk->nObjs; }
|
||||
static inline int Abc_NtkNetNum( Abc_Ntk_t * pNtk ) { return pNtk->nNets; }
|
||||
static inline int Abc_NtkNodeNum( Abc_Ntk_t * pNtk ) { return pNtk->nNodes; }
|
||||
static inline int Abc_NtkLatchNum( Abc_Ntk_t * pNtk ) { return pNtk->nLatches; }
|
||||
static inline int Abc_NtkCutSetNodeNum( Abc_Ntk_t * pNtk ) { return Vec_PtrSize(pNtk->vCutSet); }
|
||||
static inline int Abc_NtkPiNum( Abc_Ntk_t * pNtk ) { return pNtk->nPis; }
|
||||
static inline int Abc_NtkPoNum( Abc_Ntk_t * pNtk ) { return pNtk->nPos; }
|
||||
static inline int Abc_NtkCiNum( Abc_Ntk_t * pNtk ) { return pNtk->vCis->nSize; }
|
||||
static inline int Abc_NtkCoNum( Abc_Ntk_t * pNtk ) { return pNtk->vCos->nSize; }
|
||||
static inline int Abc_NtkObjNumMax( Abc_Ntk_t * pNtk ) { return Vec_PtrSize(pNtk->vObjs); }
|
||||
static inline int Abc_NtkObjNum( Abc_Ntk_t * pNtk ) { return pNtk->nObjs; }
|
||||
static inline int Abc_NtkNetNum( Abc_Ntk_t * pNtk ) { return pNtk->nNets; }
|
||||
static inline int Abc_NtkNodeNum( Abc_Ntk_t * pNtk ) { return pNtk->nNodes; }
|
||||
static inline int Abc_NtkLatchNum( Abc_Ntk_t * pNtk ) { return Vec_PtrSize(pNtk->vLatches); }
|
||||
static inline int Abc_NtkAssertNum( Abc_Ntk_t * pNtk ) { return Vec_PtrSize(pNtk->vAsserts); }
|
||||
static inline int Abc_NtkCutSetNodeNum( Abc_Ntk_t * pNtk ) { return Vec_PtrSize(pNtk->vCutSet); }
|
||||
static inline int Abc_NtkPiNum( Abc_Ntk_t * pNtk ) { return Vec_PtrSize(pNtk->vPis); }
|
||||
static inline int Abc_NtkPoNum( Abc_Ntk_t * pNtk ) { return Vec_PtrSize(pNtk->vPos); }
|
||||
static inline int Abc_NtkCiNum( Abc_Ntk_t * pNtk ) { return Vec_PtrSize(pNtk->vCis); }
|
||||
static inline int Abc_NtkCoNum( Abc_Ntk_t * pNtk ) { return Vec_PtrSize(pNtk->vCos); }
|
||||
|
||||
// reading objects
|
||||
static inline Abc_Obj_t * Abc_NtkObj( Abc_Ntk_t * pNtk, int i ) { return Vec_PtrEntry( pNtk->vObjs, i ); }
|
||||
static inline Abc_Obj_t * Abc_NtkLatch( Abc_Ntk_t * pNtk, int i ) { return Vec_PtrEntry( pNtk->vLats, i ); }
|
||||
static inline Abc_Obj_t * Abc_NtkCutSetNode( Abc_Ntk_t * pNtk, int i){ return Vec_PtrEntry( pNtk->vCutSet, i ); }
|
||||
static inline Abc_Obj_t * Abc_NtkCi( Abc_Ntk_t * pNtk, int i ) { return Vec_PtrEntry( pNtk->vCis, i ); }
|
||||
static inline Abc_Obj_t * Abc_NtkCo( Abc_Ntk_t * pNtk, int i ) { return Vec_PtrEntry( pNtk->vCos, i ); }
|
||||
static inline Abc_Obj_t * Abc_NtkPi( Abc_Ntk_t * pNtk, int i ) { assert( i < Abc_NtkPiNum(pNtk) ); return Abc_NtkCi( pNtk, i ); }
|
||||
static inline Abc_Obj_t * Abc_NtkPo( Abc_Ntk_t * pNtk, int i ) { assert( i < Abc_NtkPoNum(pNtk) ); return Abc_NtkCo( pNtk, i ); }
|
||||
static inline Abc_Obj_t * Abc_NtkObj( Abc_Ntk_t * pNtk, int i ) { return (Abc_Obj_t *)Vec_PtrEntry( pNtk->vObjs, i ); }
|
||||
static inline Abc_Obj_t * Abc_NtkLatch( Abc_Ntk_t * pNtk, int i ) { return (Abc_Obj_t *)Vec_PtrEntry( pNtk->vLatches, i );}
|
||||
static inline Abc_Obj_t * Abc_NtkAssert( Abc_Ntk_t * pNtk, int i ) { return (Abc_Obj_t *)Vec_PtrEntry( pNtk->vAsserts, i );}
|
||||
static inline Abc_Obj_t * Abc_NtkCutSetNode( Abc_Ntk_t * pNtk, int i){ return (Abc_Obj_t *)Vec_PtrEntry( pNtk->vCutSet, i ); }
|
||||
static inline Abc_Obj_t * Abc_NtkCi( Abc_Ntk_t * pNtk, int i ) { return (Abc_Obj_t *)Vec_PtrEntry( pNtk->vCis, i ); }
|
||||
static inline Abc_Obj_t * Abc_NtkCo( Abc_Ntk_t * pNtk, int i ) { return (Abc_Obj_t *)Vec_PtrEntry( pNtk->vCos, i ); }
|
||||
static inline Abc_Obj_t * Abc_NtkPi( Abc_Ntk_t * pNtk, int i ) { return (Abc_Obj_t *)Vec_PtrEntry( pNtk->vPis, i ); }
|
||||
static inline Abc_Obj_t * Abc_NtkPo( Abc_Ntk_t * pNtk, int i ) { return (Abc_Obj_t *)Vec_PtrEntry( pNtk->vPos, i ); }
|
||||
|
||||
// reading data members of the object
|
||||
static inline unsigned Abc_ObjType( Abc_Obj_t * pObj ) { return pObj->Type; }
|
||||
|
|
@ -298,26 +282,27 @@ static inline Abc_Ntk_t * Abc_ObjNtk( Abc_Obj_t * pObj ) { return pO
|
|||
static inline void * Abc_ObjData( Abc_Obj_t * pObj ) { return pObj->pData; }
|
||||
|
||||
// setting data members of the network
|
||||
static inline void Abc_ObjSetCopy( Abc_Obj_t * pObj, Abc_Obj_t * pCopy ) { pObj->pCopy = pCopy; }
|
||||
static inline void Abc_ObjSetData( Abc_Obj_t * pObj, void * pData ) { pObj->pData = pData; }
|
||||
static inline void Abc_ObjSetCopy( Abc_Obj_t * pObj, Abc_Obj_t * pCopy ) { pObj->pCopy = pCopy; }
|
||||
static inline void Abc_ObjSetData( Abc_Obj_t * pObj, void * pData ) { pObj->pData = pData; }
|
||||
|
||||
// working with complemented attributes of objects
|
||||
static inline bool Abc_ObjIsComplement( Abc_Obj_t * p ) { return (bool)(((unsigned)p) & 01); }
|
||||
static inline Abc_Obj_t * Abc_ObjRegular( Abc_Obj_t * p ) { return (Abc_Obj_t *)((unsigned)(p) & ~01); }
|
||||
static inline Abc_Obj_t * Abc_ObjNot( Abc_Obj_t * p ) { return (Abc_Obj_t *)((unsigned)(p) ^ 01); }
|
||||
static inline Abc_Obj_t * Abc_ObjNotCond( Abc_Obj_t * p, int c ) { return (Abc_Obj_t *)((unsigned)(p) ^ (c)); }
|
||||
static inline bool Abc_ObjIsComplement( Abc_Obj_t * p ) { return (bool)((unsigned long)p & (unsigned long)01); }
|
||||
static inline Abc_Obj_t * Abc_ObjRegular( Abc_Obj_t * p ) { return (Abc_Obj_t *)((unsigned long)p & ~(unsigned long)01); }
|
||||
static inline Abc_Obj_t * Abc_ObjNot( Abc_Obj_t * p ) { return (Abc_Obj_t *)((unsigned long)p ^ (unsigned long)01); }
|
||||
static inline Abc_Obj_t * Abc_ObjNotCond( Abc_Obj_t * p, int c ) { return (Abc_Obj_t *)((unsigned long)p ^ (unsigned long)(c!=0)); }
|
||||
|
||||
// checking the object type
|
||||
static inline bool Abc_ObjIsNode( Abc_Obj_t * pObj ) { return pObj->Type == ABC_OBJ_NODE; }
|
||||
static inline bool Abc_ObjIsBox( Abc_Obj_t * pObj ) { return pObj->Type == ABC_OBJ_BOX; }
|
||||
static inline bool Abc_ObjIsNet( Abc_Obj_t * pObj ) { return pObj->Type == ABC_OBJ_NET; }
|
||||
static inline bool Abc_ObjIsLatch( Abc_Obj_t * pObj ) { return pObj->Type == ABC_OBJ_LATCH; }
|
||||
static inline bool Abc_ObjIsAssert( Abc_Obj_t * pObj ) { return pObj->Type == ABC_OBJ_ASSERT; }
|
||||
static inline bool Abc_ObjIsPi( Abc_Obj_t * pObj ) { return pObj->Type == ABC_OBJ_PI; }
|
||||
static inline bool Abc_ObjIsPo( Abc_Obj_t * pObj ) { return pObj->Type == ABC_OBJ_PO; }
|
||||
static inline bool Abc_ObjIsPio( Abc_Obj_t * pObj ) { return pObj->Type == ABC_OBJ_PI || pObj->Type == ABC_OBJ_PO; }
|
||||
static inline bool Abc_ObjIsCi( Abc_Obj_t * pObj ) { return pObj->Type == ABC_OBJ_PI || pObj->Type == ABC_OBJ_LATCH; }
|
||||
static inline bool Abc_ObjIsCo( Abc_Obj_t * pObj ) { return pObj->Type == ABC_OBJ_PO || pObj->Type == ABC_OBJ_LATCH; }
|
||||
static inline bool Abc_ObjIsCio( Abc_Obj_t * pObj ) { return pObj->Type == ABC_OBJ_PI || pObj->Type == ABC_OBJ_PO || pObj->Type == ABC_OBJ_LATCH; }
|
||||
static inline bool Abc_ObjIsCo( Abc_Obj_t * pObj ) { return pObj->Type == ABC_OBJ_PO || pObj->Type == ABC_OBJ_LATCH || pObj->Type == ABC_OBJ_ASSERT; }
|
||||
static inline bool Abc_ObjIsCio( Abc_Obj_t * pObj ) { return pObj->Type == ABC_OBJ_PI || pObj->Type == ABC_OBJ_PO || pObj->Type == ABC_OBJ_LATCH || pObj->Type == ABC_OBJ_ASSERT; }
|
||||
|
||||
// working with fanin/fanout edges
|
||||
static inline int Abc_ObjFaninNum( Abc_Obj_t * pObj ) { return pObj->vFanins.nSize; }
|
||||
|
|
@ -331,8 +316,8 @@ static inline Abc_Obj_t * Abc_ObjFanout0( Abc_Obj_t * pObj ) { return (A
|
|||
static inline Abc_Obj_t * Abc_ObjFanin( Abc_Obj_t * pObj, int i ) { return (Abc_Obj_t *)pObj->pNtk->vObjs->pArray[ pObj->vFanins.pArray[i] ]; }
|
||||
static inline Abc_Obj_t * Abc_ObjFanin0( Abc_Obj_t * pObj ) { return (Abc_Obj_t *)pObj->pNtk->vObjs->pArray[ pObj->vFanins.pArray[0] ]; }
|
||||
static inline Abc_Obj_t * Abc_ObjFanin1( Abc_Obj_t * pObj ) { return (Abc_Obj_t *)pObj->pNtk->vObjs->pArray[ pObj->vFanins.pArray[1] ]; }
|
||||
static inline Abc_Obj_t * Abc_ObjFanin0Ntk( Abc_Obj_t * pObj ) { return (Abc_Obj_t *)(Abc_NtkIsNetlist(pObj->pNtk)? Abc_ObjFanin0(pObj) : pObj); }
|
||||
static inline Abc_Obj_t * Abc_ObjFanout0Ntk( Abc_Obj_t * pObj ) { return (Abc_Obj_t *)(Abc_NtkIsNetlist(pObj->pNtk)? Abc_ObjFanout0(pObj) : pObj); }
|
||||
static inline Abc_Obj_t * Abc_ObjFanin0Ntk( Abc_Obj_t * pObj ) { return (Abc_NtkIsNetlist(pObj->pNtk)? Abc_ObjFanin0(pObj) : pObj); }
|
||||
static inline Abc_Obj_t * Abc_ObjFanout0Ntk( Abc_Obj_t * pObj ) { return (Abc_NtkIsNetlist(pObj->pNtk)? Abc_ObjFanout0(pObj) : pObj); }
|
||||
static inline bool Abc_ObjFaninC0( Abc_Obj_t * pObj ) { return pObj->fCompl0; }
|
||||
static inline bool Abc_ObjFaninC1( Abc_Obj_t * pObj ) { return pObj->fCompl1; }
|
||||
static inline bool Abc_ObjFaninC( Abc_Obj_t * pObj, int i ) { assert( i >=0 && i < 2 ); return i? pObj->fCompl1 : pObj->fCompl0; }
|
||||
|
|
@ -354,6 +339,11 @@ extern bool Abc_NodeIsConst1( Abc_Obj_t * pNode );
|
|||
extern bool Abc_NodeIsBuf( Abc_Obj_t * pNode );
|
||||
extern bool Abc_NodeIsInv( Abc_Obj_t * pNode );
|
||||
|
||||
// handling persistent nodes
|
||||
static inline int Abc_NodeIsPersistant( Abc_Obj_t * pNode ) { assert( Abc_NodeIsAigAnd(pNode) ); return pNode->fPersist; }
|
||||
static inline void Abc_NodeSetPersistant( Abc_Obj_t * pNode ) { assert( Abc_NodeIsAigAnd(pNode) ); pNode->fPersist = 1; }
|
||||
static inline void Abc_NodeClearPersistant( Abc_Obj_t * pNode ) { assert( Abc_NodeIsAigAnd(pNode) ); pNode->fPersist = 0; }
|
||||
|
||||
// working with the traversal ID
|
||||
static inline void Abc_NodeSetTravId( Abc_Obj_t * pNode, int TravId ) { pNode->TravId = TravId; }
|
||||
static inline void Abc_NodeSetTravIdCurrent( Abc_Obj_t * pNode ) { pNode->TravId = pNode->pNtk->nTravIds; }
|
||||
|
|
@ -386,28 +376,29 @@ static inline int Abc_LatchInit( Abc_Obj_t * pLatch ) { assert(Ab
|
|||
#define Abc_NtkForEachNet( pNtk, pNet, i ) \
|
||||
for ( i = 0; (i < Vec_PtrSize((pNtk)->vObjs)) && (((pNet) = Abc_NtkObj(pNtk, i)), 1); i++ ) \
|
||||
if ( (pNet) == NULL || !Abc_ObjIsNet(pNet) ) {} else
|
||||
#define Abc_NtkForEachLatch( pNtk, pLatch, i ) \
|
||||
for ( i = 0; (i < Vec_PtrSize((pNtk)->vLats)) && (((pLatch) = Abc_NtkLatch(pNtk, i)), 1); i++ )\
|
||||
if ( (pLatch) == NULL ) {} else
|
||||
#define Abc_NtkForEachNode( pNtk, pNode, i ) \
|
||||
for ( i = 0; (i < Vec_PtrSize((pNtk)->vObjs)) && (((pNode) = Abc_NtkObj(pNtk, i)), 1); i++ ) \
|
||||
if ( (pNode) == NULL || !Abc_ObjIsNode(pNode) ) {} else
|
||||
#define Abc_NtkForEachBox( pNtk, pNode, i ) \
|
||||
for ( i = 0; (i < Vec_PtrSize((pNtk)->vObjs)) && (((pNode) = Abc_NtkObj(pNtk, i)), 1); i++ ) \
|
||||
if ( (pNode) == NULL || !Abc_ObjIsBox(pNode) ) {} else
|
||||
#define Abc_AigForEachAnd( pNtk, pNode, i ) \
|
||||
for ( i = 0; (i < Vec_PtrSize((pNtk)->vObjs)) && (((pNode) = Abc_NtkObj(pNtk, i)), 1); i++ ) \
|
||||
if ( (pNode) == NULL || !Abc_NodeIsAigAnd(pNode) ) {} else
|
||||
#define Abc_NtkForEachBox( pNtk, pNode, i ) \
|
||||
for ( i = 0; (i < Vec_PtrSize((pNtk)->vObjs)) && (((pNode) = Abc_NtkObj(pNtk, i)), 1); i++ ) \
|
||||
if ( (pNode) == NULL || !Abc_ObjIsBox(pNode) ) {} else
|
||||
#define Abc_SeqForEachCutsetNode( pNtk, pNode, i ) \
|
||||
for ( i = 0; (i < Abc_NtkCutSetNodeNum(pNtk)) && (((pNode) = Abc_NtkCutSetNode(pNtk, i)), 1); i++ )\
|
||||
if ( (pNode) == NULL ) {} else
|
||||
// inputs and outputs
|
||||
#define Abc_NtkForEachPi( pNtk, pPi, i ) \
|
||||
for ( i = 0; (i < Abc_NtkPiNum(pNtk)) && (((pPi) = Abc_NtkPi(pNtk, i)), 1); i++ )
|
||||
#define Abc_NtkForEachPo( pNtk, pPo, i ) \
|
||||
for ( i = 0; (i < Abc_NtkPoNum(pNtk)) && (((pPo) = Abc_NtkPo(pNtk, i)), 1); i++ )
|
||||
#define Abc_NtkForEachCi( pNtk, pCi, i ) \
|
||||
for ( i = 0; (i < Abc_NtkCiNum(pNtk)) && (((pCi) = Abc_NtkCi(pNtk, i)), 1); i++ )
|
||||
#define Abc_NtkForEachPo( pNtk, pPo, i ) \
|
||||
for ( i = 0; (i < Abc_NtkPoNum(pNtk)) && (((pPo) = Abc_NtkPo(pNtk, i)), 1); i++ )
|
||||
#define Abc_NtkForEachAssert( pNtk, pAssert, i ) \
|
||||
for ( i = 0; (i < Vec_PtrSize((pNtk)->vAsserts)) && (((pAssert) = Abc_NtkAssert(pNtk, i)), 1); i++ )
|
||||
#define Abc_NtkForEachLatch( pNtk, pLatch, i ) \
|
||||
for ( i = 0; (i < Vec_PtrSize((pNtk)->vLatches)) && (((pLatch) = Abc_NtkLatch(pNtk, i)), 1); i++ )
|
||||
#define Abc_NtkForEachCo( pNtk, pCo, i ) \
|
||||
for ( i = 0; (i < Abc_NtkCoNum(pNtk)) && (((pCo) = Abc_NtkCo(pNtk, i)), 1); i++ )
|
||||
// fanin and fanouts
|
||||
|
|
@ -533,6 +524,7 @@ extern Abc_Obj_t * Abc_NtkCreateBox( Abc_Ntk_t * pNtk );
|
|||
extern Abc_Obj_t * Abc_NtkCreatePi( Abc_Ntk_t * pNtk );
|
||||
extern Abc_Obj_t * Abc_NtkCreatePo( Abc_Ntk_t * pNtk );
|
||||
extern Abc_Obj_t * Abc_NtkCreateLatch( Abc_Ntk_t * pNtk );
|
||||
extern Abc_Obj_t * Abc_NtkCreateAssert( Abc_Ntk_t * pNtk );
|
||||
extern Abc_Obj_t * Abc_NodeCreateConst0( Abc_Ntk_t * pNtk );
|
||||
extern Abc_Obj_t * Abc_NodeCreateConst1( Abc_Ntk_t * pNtk );
|
||||
extern Abc_Obj_t * Abc_NodeCreateInv( Abc_Ntk_t * pNtk, Abc_Obj_t * pFanin );
|
||||
|
|
@ -545,8 +537,6 @@ extern Abc_Obj_t * Abc_ObjAlloc( Abc_Ntk_t * pNtk, Abc_ObjType_t Type );
|
|||
extern void Abc_ObjRecycle( Abc_Obj_t * pObj );
|
||||
extern void Abc_ObjAdd( Abc_Obj_t * pObj );
|
||||
/*=== abcNames.c ====================================================*/
|
||||
//extern char * Abc_NtkRegisterName( Abc_Ntk_t * pNtk, char * pName );
|
||||
//extern char * Abc_NtkRegisterNamePlus( Abc_Ntk_t * pNtk, char * pName, char * pSuffix );
|
||||
extern char * Abc_ObjName( Abc_Obj_t * pNode );
|
||||
extern char * Abc_ObjNameSuffix( Abc_Obj_t * pObj, char * pSuffix );
|
||||
extern char * Abc_ObjNameDummy( char * pPrefix, int Num, int nDigits );
|
||||
|
|
@ -562,6 +552,7 @@ extern int Abc_NodeCompareNames( Abc_Obj_t ** pp1, Abc_Obj_t ** p
|
|||
extern void Abc_NtkOrderObjsByName( Abc_Ntk_t * pNtk, int fComb );
|
||||
extern void Abc_NtkAddDummyPiNames( Abc_Ntk_t * pNtk );
|
||||
extern void Abc_NtkAddDummyPoNames( Abc_Ntk_t * pNtk );
|
||||
extern void Abc_NtkAddDummyAssertNames( Abc_Ntk_t * pNtk );
|
||||
extern void Abc_NtkAddDummyLatchNames( Abc_Ntk_t * pNtk );
|
||||
extern void Abc_NtkShortNames( Abc_Ntk_t * pNtk );
|
||||
/*=== abcNetlist.c ==========================================================*/
|
||||
|
|
@ -581,8 +572,6 @@ extern Abc_Ntk_t * Abc_NtkAlloc( Abc_NtkType_t Type, Abc_NtkFunc_t Func )
|
|||
extern Abc_Ntk_t * Abc_NtkStartFrom( Abc_Ntk_t * pNtk, Abc_NtkType_t Type, Abc_NtkFunc_t Func );
|
||||
extern Abc_Ntk_t * Abc_NtkStartFromDual( Abc_Ntk_t * pNtk, Abc_NtkType_t Type, Abc_NtkFunc_t Func );
|
||||
extern void Abc_NtkFinalize( Abc_Ntk_t * pNtk, Abc_Ntk_t * pNtkNew );
|
||||
extern void Abc_NtkFinalizeRegular( Abc_Ntk_t * pNtk, Abc_Ntk_t * pNtkNew );
|
||||
extern void Abc_NtkFinalizeLatches( Abc_Ntk_t * pNtk );
|
||||
extern Abc_Ntk_t * Abc_NtkStartRead( char * pName );
|
||||
extern void Abc_NtkFinalizeRead( Abc_Ntk_t * pNtk );
|
||||
extern Abc_Ntk_t * Abc_NtkDup( Abc_Ntk_t * pNtk );
|
||||
|
|
@ -627,7 +616,7 @@ extern int Abc_NodeRef_rec( Abc_Obj_t * pNode );
|
|||
extern Abc_Ntk_t * Abc_NtkRenode( Abc_Ntk_t * pNtk, int nThresh, int nFaninMax, int fCnf, int fMulti, int fSimple, int fFactor );
|
||||
extern DdNode * Abc_NtkRenodeDeriveBdd( DdManager * dd, Abc_Obj_t * pNodeOld, Vec_Ptr_t * vFaninsOld );
|
||||
/*=== abcSat.c ==========================================================*/
|
||||
extern int Abc_NtkMiterSat( Abc_Ntk_t * pNtk, int nConfLimit, int nImpLimit, int fJFront, int fVerbose );
|
||||
extern int Abc_NtkMiterSat( Abc_Ntk_t * pNtk, sint64 nConfLimit, sint64 nInsLimit, int fJFront, int fVerbose, sint64 * pNumConfs, sint64 * pNumInspects );
|
||||
extern solver * Abc_NtkMiterSatCreate( Abc_Ntk_t * pNtk, int fJFront );
|
||||
/*=== abcSop.c ==========================================================*/
|
||||
extern char * Abc_SopRegister( Extra_MmFlex_t * pMan, char * pName );
|
||||
|
|
@ -646,6 +635,7 @@ extern char * Abc_SopCreateNxor( Extra_MmFlex_t * pMan, int nVars );
|
|||
extern char * Abc_SopCreateMux( Extra_MmFlex_t * pMan );
|
||||
extern char * Abc_SopCreateInv( Extra_MmFlex_t * pMan );
|
||||
extern char * Abc_SopCreateBuf( Extra_MmFlex_t * pMan );
|
||||
extern char * Abc_SopCreateFromTruth( Extra_MmFlex_t * pMan, int nVars, unsigned * pTruth );
|
||||
extern int Abc_SopGetCubeNum( char * pSop );
|
||||
extern int Abc_SopGetLitNum( char * pSop );
|
||||
extern int Abc_SopGetVarNum( char * pSop );
|
||||
|
|
@ -709,6 +699,7 @@ extern int Abc_HManPopulate( Abc_Ntk_t * pNtk );
|
|||
extern int Abc_HManVerify( int NtkIdOld, int NtkIdNew );
|
||||
/*=== abcUtil.c ==========================================================*/
|
||||
extern void Abc_NtkIncrementTravId( Abc_Ntk_t * pNtk );
|
||||
extern void Abc_NtkOrderCisCos( Abc_Ntk_t * pNtk );
|
||||
extern int Abc_NtkGetCubeNum( Abc_Ntk_t * pNtk );
|
||||
extern int Abc_NtkGetLitNum( Abc_Ntk_t * pNtk );
|
||||
extern int Abc_NtkGetLitFactNum( Abc_Ntk_t * pNtk );
|
||||
|
|
|
|||
|
|
@ -92,7 +92,8 @@ bool Abc_NtkDoCheck( Abc_Ntk_t * pNtk )
|
|||
Abc_Obj_t * pObj, * pNet, * pNode;
|
||||
int i;
|
||||
|
||||
if ( !Abc_NtkIsNetlist(pNtk) && !Abc_NtkIsLogic(pNtk) && !Abc_NtkIsStrash(pNtk) && !Abc_NtkIsSeq(pNtk) && !Abc_NtkIsBlackbox(pNtk) )
|
||||
// check network types
|
||||
if ( !Abc_NtkIsNetlist(pNtk) && !Abc_NtkIsLogic(pNtk) && !Abc_NtkIsStrash(pNtk) && !Abc_NtkIsSeq(pNtk) )
|
||||
{
|
||||
fprintf( stdout, "NetworkCheck: Unknown network type.\n" );
|
||||
return 0;
|
||||
|
|
@ -111,6 +112,22 @@ bool Abc_NtkDoCheck( Abc_Ntk_t * pNtk )
|
|||
}
|
||||
}
|
||||
|
||||
// check CI/CO numbers
|
||||
if ( Abc_NtkPiNum(pNtk) + Abc_NtkLatchNum(pNtk) != Abc_NtkCiNum(pNtk) )
|
||||
{
|
||||
fprintf( stdout, "NetworkCheck: Number of CIs does not match number of PIs and latches.\n" );
|
||||
fprintf( stdout, "One possible reason is that latches are added twice:\n" );
|
||||
fprintf( stdout, "in procedure Abc_ObjAdd() and in the user's code.\n" );
|
||||
return 0;
|
||||
}
|
||||
if ( Abc_NtkPoNum(pNtk) + Abc_NtkAssertNum(pNtk) + Abc_NtkLatchNum(pNtk) != Abc_NtkCoNum(pNtk) )
|
||||
{
|
||||
fprintf( stdout, "NetworkCheck: Number of COs does not match number of POs, asserts, and latches.\n" );
|
||||
fprintf( stdout, "One possible reason is that latches are added twice:\n" );
|
||||
fprintf( stdout, "in procedure Abc_ObjAdd() and in the user's code.\n" );
|
||||
return 0;
|
||||
}
|
||||
|
||||
// check the names
|
||||
if ( !Abc_NtkCheckNames( pNtk ) )
|
||||
return 0;
|
||||
|
|
@ -181,14 +198,7 @@ bool Abc_NtkDoCheck( Abc_Ntk_t * pNtk )
|
|||
|
||||
// check the EXDC network if present
|
||||
if ( pNtk->pExdc )
|
||||
{
|
||||
// if ( pNtk->Type != pNtk->pExdc->Type )
|
||||
// {
|
||||
// fprintf( stdout, "NetworkCheck: Network and its EXDC have different types.\n" );
|
||||
// return 0;
|
||||
// }
|
||||
return Abc_NtkCheck( pNtk->pExdc );
|
||||
}
|
||||
Abc_NtkCheck( pNtk->pExdc );
|
||||
|
||||
// check the hierarchy
|
||||
if ( Abc_NtkIsNetlist(pNtk) && pNtk->tName2Model )
|
||||
|
|
@ -226,76 +236,60 @@ bool Abc_NtkDoCheck( Abc_Ntk_t * pNtk )
|
|||
***********************************************************************/
|
||||
bool Abc_NtkCheckNames( Abc_Ntk_t * pNtk )
|
||||
{
|
||||
stmm_generator * gen;
|
||||
Abc_Obj_t * pNet, * pNet2, * pObj;
|
||||
Abc_Obj_t * pObj;
|
||||
Vec_Int_t * vNameIds;
|
||||
char * pName;
|
||||
int i;
|
||||
int i, NameId;
|
||||
|
||||
// check that each CI/CO has a name
|
||||
Abc_NtkForEachCi( pNtk, pObj, i )
|
||||
{
|
||||
pObj = Abc_ObjFanout0Ntk(pObj);
|
||||
if ( Nm_ManFindNameById(pObj->pNtk->pManName, pObj->Id) == NULL )
|
||||
{
|
||||
fprintf( stdout, "NetworkCheck: CI with ID %d is in the network but not in the name table.\n", pObj->Id );
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
Abc_NtkForEachCo( pNtk, pObj, i )
|
||||
{
|
||||
if ( Abc_ObjIsLatch(pObj) )
|
||||
continue;
|
||||
pObj = Abc_ObjFanin0Ntk(pObj);
|
||||
if ( Nm_ManFindNameById(pObj->pNtk->pManName, pObj->Id) == NULL )
|
||||
{
|
||||
fprintf( stdout, "NetworkCheck: CO with ID %d is in the network but not in the name table.\n", pObj->Id );
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if ( Abc_NtkIsNetlist(pNtk) )
|
||||
{
|
||||
/*
|
||||
// check that the nets in the table are also in the network
|
||||
stmm_foreach_item( pNtk->tName2Net, gen, &pName, (char**)&pNet )
|
||||
Abc_NtkForEachNet( pNtk, pObj, i )
|
||||
{
|
||||
if ( pNet->pData != pName )
|
||||
pName = Nm_ManFindNameById(pObj->pNtk->pManName, pObj->Id);
|
||||
if ( pObj->pData && strcmp( pName, pObj->pData ) != 0 )
|
||||
{
|
||||
fprintf( stdout, "NetworkCheck: Net \"%s\" has different name compared to the one in the name table.\n", pNet->pData );
|
||||
fprintf( stdout, "NetworkCheck: Net \"%s\" has different name in the name table and at the data pointer.\n", pObj->pData );
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
// check that the nets with names are also in the table
|
||||
Abc_NtkForEachNet( pNtk, pNet, i )
|
||||
{
|
||||
if ( pNet->pData && !stmm_lookup( pNtk->tName2Net, pNet->pData, (char**)&pNet2 ) )
|
||||
{
|
||||
fprintf( stdout, "NetworkCheck: Net \"%s\" is in the network but not in the name table.\n", pNet->pData );
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
/*
|
||||
// check PI/PO/latch names
|
||||
Abc_NtkForEachPi( pNtk, pObj, i )
|
||||
|
||||
// return the array of all IDs, which have names
|
||||
vNameIds = Nm_ManReturnNameIds( pNtk->pManName );
|
||||
// make sure that these IDs correspond to live objects
|
||||
Vec_IntForEachEntry( vNameIds, NameId, i )
|
||||
{
|
||||
if ( !stmm_lookup( pNtk->tObj2Name, (char *)pObj, &pName ) )
|
||||
if ( Vec_PtrEntry( pNtk->vObjs, NameId ) == NULL )
|
||||
{
|
||||
fprintf( stdout, "NetworkCheck: PI \"%s\" is in the network but not in the name table.\n", Abc_ObjName(pObj) );
|
||||
return 0;
|
||||
}
|
||||
if ( Abc_NtkIsNetlist(pNtk) && strcmp( Abc_ObjName(Abc_ObjFanout0(pObj)), pName ) )
|
||||
{
|
||||
fprintf( stdout, "NetworkCheck: PI \"%s\" has a different name compared to its net.\n", Abc_ObjName(pObj) );
|
||||
Vec_IntFree( vNameIds );
|
||||
pName = Nm_ManFindNameById(pObj->pNtk->pManName, NameId);
|
||||
fprintf( stdout, "NetworkCheck: Object with ID %d is deleted but its name \"%s\" remains in the name table.\n", NameId, pName );
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
Abc_NtkForEachPo( pNtk, pObj, i )
|
||||
{
|
||||
if ( !stmm_lookup( pNtk->tObj2Name, (char *)pObj, &pName ) )
|
||||
{
|
||||
fprintf( stdout, "NetworkCheck: PO \"%s\" is in the network but not in the name table.\n", Abc_ObjName(pObj) );
|
||||
return 0;
|
||||
}
|
||||
if ( Abc_NtkIsNetlist(pNtk) && strcmp( Abc_ObjName(Abc_ObjFanin0(pObj)), pName ) )
|
||||
{
|
||||
fprintf( stdout, "NetworkCheck: PO \"%s\" has a different name compared to its net.\n", Abc_ObjName(pObj) );
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
Abc_NtkForEachLatch( pNtk, pObj, i )
|
||||
{
|
||||
if ( !stmm_lookup( pNtk->tObj2Name, (char *)pObj, &pName ) )
|
||||
{
|
||||
fprintf( stdout, "NetworkCheck: Latch \"%s\" is in the network but not in the name table.\n", Abc_ObjName(pObj) );
|
||||
return 0;
|
||||
}
|
||||
if ( Abc_NtkIsNetlist(pNtk) && strcmp( Abc_ObjName(Abc_ObjFanout0(pObj)), pName ) )
|
||||
{
|
||||
fprintf( stdout, "NetworkCheck: Latch \"%s\" has a different name compared to its net.\n", Abc_ObjName(pObj) );
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
*/
|
||||
Vec_IntFree( vNameIds );
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
@ -316,12 +310,6 @@ bool Abc_NtkCheckPis( Abc_Ntk_t * pNtk )
|
|||
Abc_Obj_t * pObj;
|
||||
int i;
|
||||
|
||||
if ( Abc_NtkCiNum(pNtk) != Abc_NtkPiNum(pNtk) + Abc_NtkLatchNum(pNtk) )
|
||||
{
|
||||
fprintf( stdout, "NetworkCheck: Incorrect size of the PI array.\n" );
|
||||
return 0;
|
||||
}
|
||||
|
||||
// check that PIs are indeed PIs
|
||||
Abc_NtkForEachPi( pNtk, pObj, i )
|
||||
{
|
||||
|
|
@ -370,12 +358,6 @@ bool Abc_NtkCheckPos( Abc_Ntk_t * pNtk )
|
|||
Abc_Obj_t * pObj;
|
||||
int i;
|
||||
|
||||
if ( Abc_NtkCoNum(pNtk) != Abc_NtkPoNum(pNtk) + Abc_NtkLatchNum(pNtk) )
|
||||
{
|
||||
fprintf( stdout, "NetworkCheck: Incorrect size of the PO array.\n" );
|
||||
return 0;
|
||||
}
|
||||
|
||||
// check that POs are indeed POs
|
||||
Abc_NtkForEachPo( pNtk, pObj, i )
|
||||
{
|
||||
|
|
@ -582,7 +564,7 @@ bool Abc_NtkCheckNode( Abc_Ntk_t * pNtk, Abc_Obj_t * pNode )
|
|||
bool Abc_NtkCheckLatch( Abc_Ntk_t * pNtk, Abc_Obj_t * pLatch )
|
||||
{
|
||||
int Value = 1;
|
||||
if ( pNtk->vLats->nSize != Abc_NtkLatchNum(pNtk) )
|
||||
if ( pNtk->vLatches->nSize != Abc_NtkLatchNum(pNtk) )
|
||||
{
|
||||
fprintf( stdout, "NetworkCheck: Incorrect size of the latch array.\n" );
|
||||
return 0;
|
||||
|
|
@ -759,7 +741,7 @@ int Abc_NtkIsAcyclicHierarchy_rec( Abc_Ntk_t * pNtk )
|
|||
return 1;
|
||||
pNtk->fHieVisited = 1;
|
||||
// return if black box
|
||||
if ( Abc_NtkIsBlackbox(pNtk) )
|
||||
if ( Abc_NtkHasBlackbox(pNtk) )
|
||||
return 1;
|
||||
assert( Abc_NtkIsNetlist(pNtk) );
|
||||
// go through all the children networks
|
||||
|
|
|
|||
|
|
@ -579,7 +579,7 @@ bool Abc_NtkIsAcyclic_rec( Abc_Obj_t * pNode )
|
|||
Abc_Obj_t * pFanin;
|
||||
int fAcyclic, i;
|
||||
assert( !Abc_ObjIsNet(pNode) );
|
||||
if ( Abc_ObjIsCi(pNode) )
|
||||
if ( Abc_ObjIsCi(pNode) || Abc_ObjIsBox(pNode) )
|
||||
return 1;
|
||||
assert( Abc_ObjIsNode( pNode ) || Abc_ObjIsBox( pNode ) );
|
||||
// make sure the node is not visited
|
||||
|
|
@ -607,7 +607,7 @@ bool Abc_NtkIsAcyclic_rec( Abc_Obj_t * pNode )
|
|||
if ( fAcyclic = Abc_NtkIsAcyclic_rec(pFanin) )
|
||||
continue;
|
||||
// return as soon as the loop is detected
|
||||
fprintf( stdout, " <-- %s", Abc_ObjName(pNode) );
|
||||
fprintf( stdout, " <-- %s", Abc_ObjName(Abc_ObjFanout0(pFanin)) );
|
||||
return 0;
|
||||
}
|
||||
// mark this node as a visited node
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ void Abc_ObjAddFanin( Abc_Obj_t * pObj, Abc_Obj_t * pFanin )
|
|||
Vec_IntPushMem( pObj->pNtk->pMmStep, &pFaninR->vFanouts, pObj->Id );
|
||||
if ( Abc_ObjIsComplement(pFanin) )
|
||||
Abc_ObjSetFaninC( pObj, Abc_ObjFaninNum(pObj)-1 );
|
||||
Abc_HManAddFanin( pObj, pFanin );
|
||||
// Abc_HManAddFanin( pObj, pFanin );
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -179,7 +179,7 @@ void Abc_ObjPatchFanin( Abc_Obj_t * pObj, Abc_Obj_t * pFaninOld, Abc_Obj_t * pFa
|
|||
***********************************************************************/
|
||||
void Abc_ObjTransferFanout( Abc_Obj_t * pNodeFrom, Abc_Obj_t * pNodeTo )
|
||||
{
|
||||
Vec_Ptr_t * vFanouts = pNodeFrom->pNtk->vPtrTemp;
|
||||
Vec_Ptr_t * vFanouts;
|
||||
int nFanoutsOld, i;
|
||||
assert( !Abc_ObjIsComplement(pNodeFrom) );
|
||||
assert( !Abc_ObjIsComplement(pNodeTo) );
|
||||
|
|
@ -190,12 +190,14 @@ void Abc_ObjTransferFanout( Abc_Obj_t * pNodeFrom, Abc_Obj_t * pNodeTo )
|
|||
assert( Abc_ObjFanoutNum(pNodeFrom) > 0 );
|
||||
// get the fanouts of the old node
|
||||
nFanoutsOld = Abc_ObjFanoutNum(pNodeTo);
|
||||
vFanouts = Vec_PtrAlloc( nFanoutsOld );
|
||||
Abc_NodeCollectFanouts( pNodeFrom, vFanouts );
|
||||
// patch the fanin of each of them
|
||||
for ( i = 0; i < vFanouts->nSize; i++ )
|
||||
Abc_ObjPatchFanin( vFanouts->pArray[i], pNodeFrom, pNodeTo );
|
||||
assert( Abc_ObjFanoutNum(pNodeFrom) == 0 );
|
||||
assert( Abc_ObjFanoutNum(pNodeTo) == nFanoutsOld + vFanouts->nSize );
|
||||
Vec_PtrFree( vFanouts );
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
|
|
|||
|
|
@ -155,9 +155,6 @@ void Abc_NtkLatchPipe( Abc_Ntk_t * pNtk, int nLatches )
|
|||
pLatch = Abc_NtkCreateLatch( pNtk );
|
||||
Abc_ObjAddFanin( pLatch, pFanin );
|
||||
Abc_LatchSetInitDc( pLatch );
|
||||
// add the latch to the CI/CO lists
|
||||
Vec_PtrPush( pNtk->vCis, pLatch );
|
||||
Vec_PtrPush( pNtk->vCos, pLatch );
|
||||
// create the name of the new latch
|
||||
Abc_NtkLogicStoreName( pLatch, Abc_ObjNameDummy("LL", i*nLatches + k, nDigits) );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,8 +65,8 @@ int Abc_NtkMinimumBase( Abc_Ntk_t * pNtk )
|
|||
***********************************************************************/
|
||||
int Abc_NodeMinimumBase( Abc_Obj_t * pNode )
|
||||
{
|
||||
Vec_Str_t * vSupport = pNode->pNtk->vStrTemp;
|
||||
Vec_Ptr_t * vFanins = pNode->pNtk->vPtrTemp;
|
||||
Vec_Str_t * vSupport;
|
||||
Vec_Ptr_t * vFanins;
|
||||
DdNode * bTemp;
|
||||
int i, nVars;
|
||||
|
||||
|
|
@ -74,11 +74,16 @@ int Abc_NodeMinimumBase( Abc_Obj_t * pNode )
|
|||
assert( Abc_ObjIsNode(pNode) );
|
||||
|
||||
// compute support
|
||||
vSupport = Vec_StrAlloc( 10 );
|
||||
nVars = Abc_NodeSupport( Cudd_Regular(pNode->pData), vSupport, Abc_ObjFaninNum(pNode) );
|
||||
if ( nVars == Abc_ObjFaninNum(pNode) )
|
||||
{
|
||||
Vec_StrFree( vSupport );
|
||||
return 0;
|
||||
}
|
||||
|
||||
// remove unused fanins
|
||||
vFanins = Vec_PtrAlloc( Abc_ObjFaninNum(pNode) );
|
||||
Abc_NodeCollectFanins( pNode, vFanins );
|
||||
for ( i = 0; i < vFanins->nSize; i++ )
|
||||
if ( vSupport->pArray[i] == 0 )
|
||||
|
|
@ -88,6 +93,8 @@ int Abc_NodeMinimumBase( Abc_Obj_t * pNode )
|
|||
// update the function of the node
|
||||
pNode->pData = Extra_bddRemapUp( pNode->pNtk->pManFunc, bTemp = pNode->pData ); Cudd_Ref( pNode->pData );
|
||||
Cudd_RecursiveDeref( pNode->pNtk->pManFunc, bTemp );
|
||||
Vec_PtrFree( vFanins );
|
||||
Vec_StrFree( vSupport );
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,55 +28,6 @@
|
|||
/// FUNCTION DEFINITIONS ///
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Registers the name with the string memory manager.]
|
||||
|
||||
Description [This function should be used to register all names
|
||||
permanentsly stored with the network. The pointer returned by
|
||||
this procedure contains the copy of the name, which should be used
|
||||
in all network manipulation procedures.]
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
char * Abc_NtkRegisterName( Abc_Ntk_t * pNtk, char * pName )
|
||||
{
|
||||
/*
|
||||
char * pRegName;
|
||||
if ( pName == NULL ) return NULL;
|
||||
pRegName = Extra_MmFlexEntryFetch( pNtk->pMmNames, strlen(pName) + 1 );
|
||||
strcpy( pRegName, pName );
|
||||
return pRegName;
|
||||
*/
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Registers the name with the string memory manager.]
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
char * Abc_NtkRegisterNamePlus( Abc_Ntk_t * pNtk, char * pName, char * pSuffix )
|
||||
{
|
||||
/*
|
||||
char * pRegName;
|
||||
assert( pName && pSuffix );
|
||||
pRegName = Extra_MmFlexEntryFetch( pNtk->pMmNames, strlen(pName) + strlen(pSuffix) + 1 );
|
||||
sprintf( pRegName, "%s%s", pName, pSuffix );
|
||||
return pRegName;
|
||||
*/
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Gets the long name of the object.]
|
||||
|
|
@ -176,20 +127,7 @@ char * Abc_ObjNameDummy( char * pPrefix, int Num, int nDigits )
|
|||
***********************************************************************/
|
||||
char * Abc_NtkLogicStoreName( Abc_Obj_t * pObjNew, char * pNameOld )
|
||||
{
|
||||
/*
|
||||
char * pNewName;
|
||||
assert( Abc_ObjIsCio(pObjNew) );
|
||||
// get the new name
|
||||
pNewName = Abc_NtkRegisterName( pObjNew->pNtk, pNameOld );
|
||||
// add the name to the table
|
||||
if ( stmm_insert( pObjNew->pNtk->tObj2Name, (char *)pObjNew, pNewName ) )
|
||||
{
|
||||
assert( 0 ); // the object is added for the second time
|
||||
}
|
||||
return pNewName;
|
||||
*/
|
||||
Nm_ManStoreIdName( pObjNew->pNtk->pManName, pObjNew->Id, pNameOld, NULL );
|
||||
return NULL;
|
||||
return Nm_ManStoreIdName( pObjNew->pNtk->pManName, pObjNew->Id, pNameOld, NULL );
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
|
@ -205,21 +143,7 @@ char * Abc_NtkLogicStoreName( Abc_Obj_t * pObjNew, char * pNameOld )
|
|||
***********************************************************************/
|
||||
char * Abc_NtkLogicStoreNamePlus( Abc_Obj_t * pObjNew, char * pNameOld, char * pSuffix )
|
||||
{
|
||||
/*
|
||||
char * pNewName;
|
||||
assert( pSuffix );
|
||||
assert( Abc_ObjIsCio(pObjNew) );
|
||||
// get the new name
|
||||
pNewName = Abc_NtkRegisterNamePlus( pObjNew->pNtk, pNameOld, pSuffix );
|
||||
// add the name to the table
|
||||
if ( stmm_insert( pObjNew->pNtk->tObj2Name, (char *)pObjNew, pNewName ) )
|
||||
{
|
||||
assert( 0 ); // the object is added for the second time
|
||||
}
|
||||
return pNewName;
|
||||
*/
|
||||
Nm_ManStoreIdName( pObjNew->pNtk->pManName, pObjNew->Id, pNameOld, pSuffix );
|
||||
return NULL;
|
||||
return Nm_ManStoreIdName( pObjNew->pNtk->pManName, pObjNew->Id, pNameOld, pSuffix );
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
|
@ -239,17 +163,20 @@ void Abc_NtkDupCioNamesTable( Abc_Ntk_t * pNtk, Abc_Ntk_t * pNtkNew )
|
|||
int i;
|
||||
assert( Abc_NtkPiNum(pNtk) == Abc_NtkPiNum(pNtkNew) );
|
||||
assert( Abc_NtkPoNum(pNtk) == Abc_NtkPoNum(pNtkNew) );
|
||||
assert( Abc_NtkAssertNum(pNtk) == Abc_NtkAssertNum(pNtkNew) );
|
||||
assert( Abc_NtkLatchNum(pNtk) == Abc_NtkLatchNum(pNtkNew) );
|
||||
// assert( st_count(pNtk->tObj2Name) > 0 );
|
||||
// assert( st_count(pNtkNew->tObj2Name) == 0 );
|
||||
assert( Nm_ManNumEntries(pNtk->pManName) > 0 );
|
||||
assert( Nm_ManNumEntries(pNtkNew->pManName) == 0 );
|
||||
// copy the CI/CO names if given
|
||||
Abc_NtkForEachPi( pNtk, pObj, i )
|
||||
Abc_NtkLogicStoreName( Abc_NtkPi(pNtkNew,i), Abc_ObjName(Abc_ObjFanout0Ntk(pObj)) );
|
||||
Abc_NtkLogicStoreName( Abc_NtkPi(pNtkNew,i), Abc_ObjName(Abc_ObjFanout0Ntk(pObj)) );
|
||||
Abc_NtkForEachPo( pNtk, pObj, i )
|
||||
Abc_NtkLogicStoreName( Abc_NtkPo(pNtkNew,i), Abc_ObjName(Abc_ObjFanin0Ntk(pObj)) );
|
||||
Abc_NtkLogicStoreName( Abc_NtkPo(pNtkNew,i), Abc_ObjName(Abc_ObjFanin0Ntk(pObj)) );
|
||||
Abc_NtkForEachAssert( pNtk, pObj, i )
|
||||
Abc_NtkLogicStoreName( Abc_NtkAssert(pNtkNew,i), Abc_ObjName(Abc_ObjFanin0Ntk(pObj)) );
|
||||
if ( !Abc_NtkIsSeq(pNtk) )
|
||||
Abc_NtkForEachLatch( pNtk, pObj, i )
|
||||
Abc_NtkLogicStoreName( Abc_NtkLatch(pNtkNew,i), Abc_ObjName(Abc_ObjFanout0Ntk(pObj)) );
|
||||
Abc_NtkLogicStoreName( Abc_NtkLatch(pNtkNew,i), Abc_ObjName(Abc_ObjFanout0Ntk(pObj)) );
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
|
@ -270,8 +197,8 @@ void Abc_NtkDupCioNamesTableDual( Abc_Ntk_t * pNtk, Abc_Ntk_t * pNtkNew )
|
|||
assert( Abc_NtkPiNum(pNtk) == Abc_NtkPiNum(pNtkNew) );
|
||||
assert( Abc_NtkPoNum(pNtk) * 2 == Abc_NtkPoNum(pNtkNew) );
|
||||
assert( Abc_NtkLatchNum(pNtk) == Abc_NtkLatchNum(pNtkNew) );
|
||||
// assert( st_count(pNtk->tObj2Name) > 0 );
|
||||
// assert( st_count(pNtkNew->tObj2Name) == 0 );
|
||||
assert( Nm_ManNumEntries(pNtk->pManName) > 0 );
|
||||
assert( Nm_ManNumEntries(pNtkNew->pManName) == 0 );
|
||||
// copy the CI/CO names if given
|
||||
Abc_NtkForEachPi( pNtk, pObj, i )
|
||||
Abc_NtkLogicStoreName( Abc_NtkPi(pNtkNew,i), Abc_ObjName(pObj) );
|
||||
|
|
@ -280,6 +207,8 @@ void Abc_NtkDupCioNamesTableDual( Abc_Ntk_t * pNtk, Abc_Ntk_t * pNtkNew )
|
|||
Abc_NtkLogicStoreNamePlus( Abc_NtkPo(pNtkNew,2*i+0), Abc_ObjName(pObj), "_pos" );
|
||||
Abc_NtkLogicStoreNamePlus( Abc_NtkPo(pNtkNew,2*i+1), Abc_ObjName(pObj), "_neg" );
|
||||
}
|
||||
Abc_NtkForEachAssert( pNtk, pObj, i )
|
||||
Abc_NtkLogicStoreName( Abc_NtkAssert(pNtkNew,i), Abc_ObjName(pObj) );
|
||||
if ( !Abc_NtkIsSeq(pNtk) )
|
||||
Abc_NtkForEachLatch( pNtk, pObj, i )
|
||||
Abc_NtkLogicStoreName( Abc_NtkLatch(pNtkNew,i), Abc_ObjName(pObj) );
|
||||
|
|
@ -439,22 +368,16 @@ void Abc_NtkOrderObjsByName( Abc_Ntk_t * pNtk, int fComb )
|
|||
Abc_NtkForEachLatch( pNtk, pObj, i )
|
||||
pObj->pCopy = (Abc_Obj_t *)Abc_ObjName(pObj);
|
||||
// order objects alphabetically
|
||||
qsort( pNtk->vCis->pArray, pNtk->nPis, sizeof(Abc_Obj_t *),
|
||||
qsort( (void *)Vec_PtrArray(pNtk->vPis), Vec_PtrSize(pNtk->vPis), sizeof(Abc_Obj_t *),
|
||||
(int (*)(const void *, const void *)) Abc_NodeCompareNames );
|
||||
qsort( pNtk->vCos->pArray, pNtk->nPos, sizeof(Abc_Obj_t *),
|
||||
qsort( (void *)Vec_PtrArray(pNtk->vPos), Vec_PtrSize(pNtk->vPos), sizeof(Abc_Obj_t *),
|
||||
(int (*)(const void *, const void *)) Abc_NodeCompareNames );
|
||||
// if the comparison if combinational (latches as PIs/POs), order them too
|
||||
if ( fComb )
|
||||
{
|
||||
qsort( pNtk->vLats->pArray, pNtk->nLatches, sizeof(Abc_Obj_t *),
|
||||
qsort( (void *)Vec_PtrArray(pNtk->vLatches), Vec_PtrSize(pNtk->vLatches), sizeof(Abc_Obj_t *),
|
||||
(int (*)(const void *, const void *)) Abc_NodeCompareNames );
|
||||
// add latches to make COs
|
||||
Abc_NtkForEachLatch( pNtk, pObj, i )
|
||||
{
|
||||
Vec_PtrWriteEntry( pNtk->vCis, pNtk->nPis + i, pObj );
|
||||
Vec_PtrWriteEntry( pNtk->vCos, pNtk->nPos + i, pObj );
|
||||
}
|
||||
}
|
||||
// order CIs/COs first PIs/POs(Asserts) then latches
|
||||
Abc_NtkOrderCisCos( pNtk );
|
||||
// clean the copy fields
|
||||
Abc_NtkForEachPi( pNtk, pObj, i )
|
||||
pObj->pCopy = NULL;
|
||||
|
|
@ -504,6 +427,26 @@ void Abc_NtkAddDummyPoNames( Abc_Ntk_t * pNtk )
|
|||
Abc_NtkLogicStoreName( pObj, Abc_ObjNameDummy("po", i, nDigits) );
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Adds dummy names.]
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void Abc_NtkAddDummyAssertNames( Abc_Ntk_t * pNtk )
|
||||
{
|
||||
Abc_Obj_t * pObj;
|
||||
int nDigits, i;
|
||||
nDigits = Extra_Base10Log( Abc_NtkAssertNum(pNtk) );
|
||||
Abc_NtkForEachAssert( pNtk, pObj, i )
|
||||
Abc_NtkLogicStoreName( pObj, Abc_ObjNameDummy("a", i, nDigits) );
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Adds dummy names.]
|
||||
|
|
@ -537,13 +480,11 @@ void Abc_NtkAddDummyLatchNames( Abc_Ntk_t * pNtk )
|
|||
***********************************************************************/
|
||||
void Abc_NtkShortNames( Abc_Ntk_t * pNtk )
|
||||
{
|
||||
// stmm_free_table( pNtk->tObj2Name );
|
||||
// pNtk->tObj2Name = stmm_init_table(stmm_ptrcmp, stmm_ptrhash);
|
||||
Nm_ManFree( pNtk->pManName );
|
||||
pNtk->pManName = Nm_ManCreate( Abc_NtkPiNum(pNtk) + Abc_NtkPoNum(pNtk) + Abc_NtkLatchNum(pNtk) + 10 );
|
||||
|
||||
pNtk->pManName = Nm_ManCreate( Abc_NtkCiNum(pNtk) + Abc_NtkCoNum(pNtk) - Abc_NtkLatchNum(pNtk) + 10 );
|
||||
Abc_NtkAddDummyPiNames( pNtk );
|
||||
Abc_NtkAddDummyPoNames( pNtk );
|
||||
Abc_NtkAddDummyAssertNames( pNtk );
|
||||
Abc_NtkAddDummyLatchNames( pNtk );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -106,33 +106,22 @@ Abc_Ntk_t * Abc_NtkNetlistToLogicHie( Abc_Ntk_t * pNtk )
|
|||
// clean the node copy fields
|
||||
Abc_NtkForEachNode( pNtk, pObj, i )
|
||||
pObj->pCopy = NULL;
|
||||
// map the constant nodes
|
||||
if ( Abc_NtkConst1(pNtk) )
|
||||
Abc_NtkConst1(pNtk)->pCopy = Abc_NtkConst1(pNtkNew);
|
||||
// clone PIs/POs and make old nets point to new terminals; create PI/PO names
|
||||
Abc_NtkForEachPi( pNtk, pObj, i )
|
||||
// clone PIs/POs/latches and make old nets point to new terminals; create names
|
||||
Abc_NtkForEachCi( pNtk, pObj, i )
|
||||
{
|
||||
Abc_ObjFanout0(pObj)->pCopy = Abc_NtkDupObj(pNtkNew, pObj);
|
||||
Abc_NtkLogicStoreName( pObj->pCopy, Abc_ObjName(pObj) );
|
||||
Abc_NtkLogicStoreName( pObj->pCopy, Abc_ObjName(Abc_ObjFanout0(pObj)) );
|
||||
}
|
||||
Abc_NtkForEachPo( pNtk, pObj, i )
|
||||
{
|
||||
Abc_NtkDupObj(pNtkNew, pObj);
|
||||
Abc_NtkLogicStoreName( pObj->pCopy, Abc_ObjName(pObj) );
|
||||
Abc_NtkLogicStoreName( pObj->pCopy, Abc_ObjName(Abc_ObjFanin0(pObj)) );
|
||||
}
|
||||
// recursively flatten hierarchy, create internal logic, add new PI/PO names if there are black boxes
|
||||
Abc_NtkNetlistToLogicHie_rec( pNtkNew, pNtk, &Counter );
|
||||
if ( Counter )
|
||||
printf( "Warning: The total of %d block boxes are transformed into PI/PO pairs.\n", Counter );
|
||||
// add latches
|
||||
Abc_NtkForEachLatch( pNtk, pObj, i )
|
||||
{
|
||||
Abc_ObjFanout0(pObj)->pCopy = Abc_NtkDupObj(pNtkNew, pObj);
|
||||
Vec_PtrPush( pNtkNew->vCis, pObj->pCopy );
|
||||
Vec_PtrPush( pNtkNew->vCos, pObj->pCopy );
|
||||
Abc_NtkLogicStoreName( Abc_NtkLatch(pNtkNew,i), Abc_ObjName(pObj) );
|
||||
}
|
||||
// collect the CO nodes
|
||||
// connect the CO nodes
|
||||
Abc_NtkForEachCo( pNtk, pObj, i )
|
||||
Abc_ObjAddFanin( pObj->pCopy, Abc_ObjFanin0(pObj)->pCopy );
|
||||
// copy the timing information
|
||||
|
|
@ -167,62 +156,75 @@ void Abc_NtkNetlistToLogicHie_rec( Abc_Ntk_t * pNtkNew, Abc_Ntk_t * pNtkOld, int
|
|||
int i, k;
|
||||
// collect nodes and boxes in topological order
|
||||
vNodes = Abc_NtkDfs( pNtkOld, 0 );
|
||||
// create logic for nodes and boxes
|
||||
// duplicate nodes, create PIs/POs corresponding to blackboxes
|
||||
// have to do it first if blackboxes break combinational loops
|
||||
// (current we do not allow whiteboxes to break combinational loops)
|
||||
Vec_PtrForEachEntry( vNodes, pNode, i )
|
||||
{
|
||||
if ( Abc_ObjFaninNum(pNode) == 0 )
|
||||
continue;
|
||||
if ( Abc_ObjIsNode(pNode) )
|
||||
{
|
||||
// duplicate the node and save it in the fanout net
|
||||
Abc_NtkDupObj( pNtkNew, pNode );
|
||||
Abc_ObjForEachFanin( pNode, pFanin, k )
|
||||
Abc_ObjAddFanin( pNode->pCopy, pFanin->pCopy );
|
||||
Abc_ObjFanout0(pNode)->pCopy = pNode->pCopy;
|
||||
continue;
|
||||
}
|
||||
assert( Abc_ObjIsBox(pNode) );
|
||||
pNtkModel = pNode->pData;
|
||||
// consider the case of the black box
|
||||
if ( Abc_NtkIsBlackbox(pNtkModel) )
|
||||
if ( !Abc_NtkHasBlackbox(pNtkModel) )
|
||||
continue;
|
||||
// consider this blockbox
|
||||
if ( pNtkNew->pBlackBoxes == NULL )
|
||||
{
|
||||
if ( pNtkNew->pBlackBoxes == NULL )
|
||||
{
|
||||
pNtkNew->pBlackBoxes = Vec_IntAlloc( 10 );
|
||||
Vec_IntPush( pNtkNew->pBlackBoxes, (Abc_NtkPiNum(pNtkNew) << 16) | Abc_NtkPoNum(pNtkNew) );
|
||||
}
|
||||
sprintf( Prefix, "%s_%d_", Abc_NtkName(pNtkModel), *pCounter );
|
||||
// create new PIs from the POs of the box
|
||||
Abc_NtkForEachPo( pNtkModel, pObj, k )
|
||||
{
|
||||
pObj->pCopy = Abc_NtkCreatePi( pNtkNew );
|
||||
Abc_ObjFanout(pNode, k)->pCopy = pObj->pCopy;
|
||||
Abc_NtkLogicStoreNamePlus( pObj->pCopy, Prefix, Abc_ObjName(pObj) );
|
||||
}
|
||||
// create new POs from the PIs of the box
|
||||
Abc_NtkForEachPi( pNtkModel, pObj, k )
|
||||
{
|
||||
pObj->pCopy = Abc_NtkCreatePo( pNtkNew );
|
||||
Abc_ObjAddFanin( pObj->pCopy, Abc_ObjFanin(pNode, k)->pCopy );
|
||||
Abc_NtkLogicStoreNamePlus( pObj->pCopy, Prefix, Abc_ObjName(pObj) );
|
||||
}
|
||||
(*pCounter)++;
|
||||
pNtkNew->pBlackBoxes = Vec_IntAlloc( 10 );
|
||||
Vec_IntPush( pNtkNew->pBlackBoxes, (Abc_NtkPiNum(pNtkNew) << 16) | Abc_NtkPoNum(pNtkNew) );
|
||||
}
|
||||
else
|
||||
sprintf( Prefix, "%s_%d_", Abc_NtkName(pNtkModel), *pCounter );
|
||||
// create new PIs from the POs of the box
|
||||
Abc_NtkForEachPo( pNtkModel, pObj, k )
|
||||
{
|
||||
// map the constant nodes
|
||||
if ( Abc_NtkConst1(pNtkModel) )
|
||||
Abc_NtkConst1(pNtkModel)->pCopy = Abc_NtkConst1(pNtkNew);
|
||||
// transfer the nodes to the box inputs
|
||||
Abc_NtkForEachPi( pNtkModel, pObj, k )
|
||||
Abc_ObjFanout0(pObj)->pCopy = Abc_ObjFanin(pNode, k)->pCopy;
|
||||
// construct recursively
|
||||
Abc_NtkNetlistToLogicHie_rec( pNtkNew, pNtkModel, pCounter );
|
||||
// transfer the results back
|
||||
Abc_NtkForEachPo( pNtkModel, pObj, k )
|
||||
Abc_ObjFanout(pNode, k)->pCopy = Abc_ObjFanin0(pObj)->pCopy;
|
||||
pObj->pCopy = Abc_NtkCreatePi( pNtkNew );
|
||||
Abc_ObjFanout(pNode, k)->pCopy = pObj->pCopy;
|
||||
Abc_NtkLogicStoreNamePlus( pObj->pCopy, Prefix, Abc_ObjName(Abc_ObjFanin0(pObj)) );
|
||||
}
|
||||
// create new POs from the PIs of the box
|
||||
Abc_NtkForEachPi( pNtkModel, pObj, k )
|
||||
{
|
||||
pObj->pCopy = Abc_NtkCreatePo( pNtkNew );
|
||||
// Abc_ObjAddFanin( pObj->pCopy, Abc_ObjFanin(pNode, k)->pCopy );
|
||||
Abc_NtkLogicStoreNamePlus( pObj->pCopy, Prefix, Abc_ObjName(Abc_ObjFanout0(pObj)) );
|
||||
}
|
||||
(*pCounter)++;
|
||||
Vec_IntPush( pNtkNew->pBlackBoxes, (Abc_NtkPiNum(pNtkNew) << 16) | Abc_NtkPoNum(pNtkNew) );
|
||||
}
|
||||
// connect nodes and boxes
|
||||
Vec_PtrForEachEntry( vNodes, pNode, i )
|
||||
{
|
||||
if ( Abc_ObjIsNode(pNode) )
|
||||
{
|
||||
// printf( "adding node %s\n", Abc_ObjName(Abc_ObjFanout0(pNode)) );
|
||||
Abc_ObjForEachFanin( pNode, pFanin, k )
|
||||
Abc_ObjAddFanin( pNode->pCopy, pFanin->pCopy );
|
||||
continue;
|
||||
}
|
||||
assert( Abc_ObjIsBox(pNode) );
|
||||
pNtkModel = pNode->pData;
|
||||
// printf( "adding model %s\n", Abc_NtkName(pNtkModel) );
|
||||
// consider the case of the black box
|
||||
if ( Abc_NtkHasBlackbox(pNtkModel) )
|
||||
{
|
||||
// create new POs from the PIs of the box
|
||||
Abc_NtkForEachPi( pNtkModel, pObj, k )
|
||||
Abc_ObjAddFanin( pObj->pCopy, Abc_ObjFanin(pNode, k)->pCopy );
|
||||
continue;
|
||||
}
|
||||
// transfer the nodes to the box inputs
|
||||
Abc_NtkForEachPi( pNtkModel, pObj, k )
|
||||
Abc_ObjFanout0(pObj)->pCopy = Abc_ObjFanin(pNode, k)->pCopy;
|
||||
// construct recursively
|
||||
Abc_NtkNetlistToLogicHie_rec( pNtkNew, pNtkModel, pCounter );
|
||||
// transfer the results back
|
||||
Abc_NtkForEachPo( pNtkModel, pObj, k )
|
||||
Abc_ObjFanout(pNode, k)->pCopy = Abc_ObjFanin0(pObj)->pCopy;
|
||||
}
|
||||
Vec_PtrFree( vNodes );
|
||||
}
|
||||
|
|
@ -352,7 +354,7 @@ Abc_Ntk_t * Abc_NtkLogicSopToNetlist( Abc_Ntk_t * pNtk )
|
|||
// the driver is a node
|
||||
|
||||
// get the CO name
|
||||
pNameCo = Abc_ObjIsPo(pObj)? Abc_ObjName(pObj) : Abc_ObjNameSuffix( pObj, "_in" );
|
||||
pNameCo = Abc_ObjIsLatch(pObj)? Abc_ObjNameSuffix( pObj, "_in" ) : Abc_ObjName(pObj);
|
||||
// make sure CO has a unique name
|
||||
assert( Abc_NtkFindNet( pNtkNew, pNameCo ) == NULL );
|
||||
// create the CO net and connect it to CO
|
||||
|
|
@ -401,6 +403,7 @@ Abc_Ntk_t * Abc_NtkAigToLogicSop( Abc_Ntk_t * pNtk )
|
|||
{
|
||||
Abc_Ntk_t * pNtkNew;
|
||||
Abc_Obj_t * pObj, * pFanin, * pNodeNew;
|
||||
Vec_Int_t * vInts;
|
||||
int i, k;
|
||||
assert( Abc_NtkIsStrash(pNtk) );
|
||||
// start the network
|
||||
|
|
@ -423,16 +426,17 @@ Abc_Ntk_t * Abc_NtkAigToLogicSop( Abc_Ntk_t * pNtk )
|
|||
// create an OR gate
|
||||
pNodeNew = Abc_NtkCreateNode(pNtkNew);
|
||||
// add fanins
|
||||
Vec_IntClear( pNtk->vIntTemp );
|
||||
vInts = Vec_IntAlloc( 10 );
|
||||
for ( pFanin = pObj; pFanin; pFanin = pFanin->pData )
|
||||
{
|
||||
Vec_IntPush( pNtk->vIntTemp, (int)(pObj->fPhase != pFanin->fPhase) );
|
||||
Vec_IntPush( vInts, (int)(pObj->fPhase != pFanin->fPhase) );
|
||||
Abc_ObjAddFanin( pNodeNew, pFanin->pCopy );
|
||||
}
|
||||
// create the logic function
|
||||
pNodeNew->pData = Abc_SopCreateOrMultiCube( pNtkNew->pManFunc, pNtk->vIntTemp->nSize, pNtk->vIntTemp->pArray );
|
||||
pNodeNew->pData = Abc_SopCreateOrMultiCube( pNtkNew->pManFunc, Vec_IntSize(vInts), Vec_IntArray(vInts) );
|
||||
// set the new node
|
||||
pObj->pCopy->pCopy = pNodeNew;
|
||||
Vec_IntFree( vInts );
|
||||
}
|
||||
// connect the internal nodes
|
||||
Abc_NtkForEachNode( pNtk, pObj, i )
|
||||
|
|
|
|||
|
|
@ -53,19 +53,14 @@ Abc_Ntk_t * Abc_NtkAlloc( Abc_NtkType_t Type, Abc_NtkFunc_t Func )
|
|||
pNtk->Id = !Abc_HManIsRunning()? 0 : Abc_HManGetNewNtkId();
|
||||
// start the object storage
|
||||
pNtk->vObjs = Vec_PtrAlloc( 100 );
|
||||
pNtk->vLats = Vec_PtrAlloc( 100 );
|
||||
pNtk->vCutSet = Vec_PtrAlloc( 100 );
|
||||
pNtk->vLatches = Vec_PtrAlloc( 100 );
|
||||
pNtk->vAsserts = Vec_PtrAlloc( 100 );
|
||||
pNtk->vPis = Vec_PtrAlloc( 100 );
|
||||
pNtk->vPos = Vec_PtrAlloc( 100 );
|
||||
pNtk->vCis = Vec_PtrAlloc( 100 );
|
||||
pNtk->vCos = Vec_PtrAlloc( 100 );
|
||||
pNtk->vAsserts = Vec_PtrAlloc( 100 );
|
||||
pNtk->vPtrTemp = Vec_PtrAlloc( 100 );
|
||||
pNtk->vIntTemp = Vec_IntAlloc( 100 );
|
||||
pNtk->vStrTemp = Vec_StrAlloc( 100 );
|
||||
// start the hash table
|
||||
// pNtk->tName2Net = stmm_init_table(strcmp, stmm_strhash);
|
||||
// pNtk->tObj2Name = stmm_init_table(stmm_ptrcmp, stmm_ptrhash);
|
||||
pNtk->vCutSet = Vec_PtrAlloc( 100 );
|
||||
// start the memory managers
|
||||
// pNtk->pMmNames = Extra_MmFlexStart();
|
||||
pNtk->pMmObj = Extra_MmFixedStart( sizeof(Abc_Obj_t) );
|
||||
pNtk->pMmStep = Extra_MmStepStart( ABC_NUM_STEPS );
|
||||
// get ready to assign the first Obj ID
|
||||
|
|
@ -115,7 +110,7 @@ Abc_Ntk_t * Abc_NtkAlloc( Abc_NtkType_t Type, Abc_NtkFunc_t Func )
|
|||
Abc_Ntk_t * Abc_NtkStartFrom( Abc_Ntk_t * pNtk, Abc_NtkType_t Type, Abc_NtkFunc_t Func )
|
||||
{
|
||||
Abc_Ntk_t * pNtkNew;
|
||||
Abc_Obj_t * pObj, * pObjNew;
|
||||
Abc_Obj_t * pObj;
|
||||
int i;
|
||||
if ( pNtk == NULL )
|
||||
return NULL;
|
||||
|
|
@ -135,12 +130,10 @@ Abc_Ntk_t * Abc_NtkStartFrom( Abc_Ntk_t * pNtk, Abc_NtkType_t Type, Abc_NtkFunc_
|
|||
Abc_NtkDupObj(pNtkNew, pObj);
|
||||
Abc_NtkForEachPo( pNtk, pObj, i )
|
||||
Abc_NtkDupObj(pNtkNew, pObj);
|
||||
Abc_NtkForEachAssert( pNtk, pObj, i )
|
||||
Abc_NtkDupObj(pNtkNew, pObj);
|
||||
Abc_NtkForEachLatch( pNtk, pObj, i )
|
||||
{
|
||||
pObjNew = Abc_NtkDupObj(pNtkNew, pObj);
|
||||
Vec_PtrPush( pNtkNew->vCis, pObjNew );
|
||||
Vec_PtrPush( pNtkNew->vCos, pObjNew );
|
||||
}
|
||||
Abc_NtkDupObj(pNtkNew, pObj);
|
||||
if ( Abc_NtkIsStrash(pNtk) && Abc_HManIsRunning() )
|
||||
{
|
||||
Abc_HManAddProto( Abc_NtkConst1(pNtk)->pCopy, Abc_NtkConst1(pNtk) );
|
||||
|
|
@ -202,15 +195,12 @@ Abc_Ntk_t * Abc_NtkStartFromDual( Abc_Ntk_t * pNtk, Abc_NtkType_t Type, Abc_NtkF
|
|||
// collect first to old
|
||||
pObj->pCopy = pObjNew;
|
||||
}
|
||||
Abc_NtkForEachAssert( pNtk, pObj, i )
|
||||
Abc_NtkDupObj(pNtkNew, pObj);
|
||||
Abc_NtkForEachLatch( pNtk, pObj, i )
|
||||
{
|
||||
pObjNew = Abc_NtkDupObj(pNtkNew, pObj);
|
||||
Vec_PtrPush( pNtkNew->vCis, pObjNew );
|
||||
Vec_PtrPush( pNtkNew->vCos, pObjNew );
|
||||
}
|
||||
Abc_NtkDupObj(pNtkNew, pObj);
|
||||
// transfer the names
|
||||
Abc_NtkDupCioNamesTableDual( pNtk, pNtkNew );
|
||||
// Abc_ManTimeDup( pNtk, pNtkNew );
|
||||
// check that the CI/CO/latches are copied correctly
|
||||
assert( Abc_NtkCiNum(pNtk) == Abc_NtkCiNum(pNtkNew) );
|
||||
assert( Abc_NtkCoNum(pNtk)* 2 == Abc_NtkCoNum(pNtkNew) );
|
||||
|
|
@ -242,54 +232,6 @@ void Abc_NtkFinalize( Abc_Ntk_t * pNtk, Abc_Ntk_t * pNtkNew )
|
|||
}
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Finalizes the network using the existing network as a model.]
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void Abc_NtkFinalizeRegular( Abc_Ntk_t * pNtk, Abc_Ntk_t * pNtkNew )
|
||||
{
|
||||
Abc_Obj_t * pObj, * pDriver, * pDriverNew;
|
||||
int i;
|
||||
// set the COs of the strashed network
|
||||
Abc_NtkForEachCo( pNtk, pObj, i )
|
||||
{
|
||||
pDriver = Abc_ObjFanin0Ntk( Abc_ObjFanin0(pObj) );
|
||||
pDriverNew = pDriver->pCopy;
|
||||
Abc_ObjAddFanin( pObj->pCopy, pDriverNew );
|
||||
}
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Finalizes the network adding latches to CI/CO lists and creates their names.]
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void Abc_NtkFinalizeLatches( Abc_Ntk_t * pNtk )
|
||||
{
|
||||
Abc_Obj_t * pLatch;
|
||||
int i;
|
||||
// set the COs of the strashed network
|
||||
Abc_NtkForEachLatch( pNtk, pLatch, i )
|
||||
{
|
||||
Vec_PtrPush( pNtk->vCis, pLatch );
|
||||
Vec_PtrPush( pNtk->vCos, pLatch );
|
||||
Abc_NtkLogicStoreName( pLatch, Abc_ObjNameSuffix(pLatch, "L") );
|
||||
}
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Starts a new network using existing network as a model.]
|
||||
|
|
@ -325,9 +267,9 @@ Abc_Ntk_t * Abc_NtkStartRead( char * pName )
|
|||
***********************************************************************/
|
||||
void Abc_NtkFinalizeRead( Abc_Ntk_t * pNtk )
|
||||
{
|
||||
Abc_Obj_t * pLatch, * pBox, * pObj;
|
||||
Abc_Obj_t * pBox, * pObj;
|
||||
int i;
|
||||
if ( pNtk->ntkType == ABC_NTK_BLACKBOX )
|
||||
if ( Abc_NtkHasBlackbox(pNtk) )
|
||||
{
|
||||
pBox = Abc_NtkCreateBox(pNtk);
|
||||
Abc_NtkForEachPi( pNtk, pObj, i )
|
||||
|
|
@ -339,14 +281,8 @@ void Abc_NtkFinalizeRead( Abc_Ntk_t * pNtk )
|
|||
assert( Abc_NtkIsNetlist(pNtk) );
|
||||
// fix the net drivers
|
||||
Abc_NtkFixNonDrivenNets( pNtk );
|
||||
// create the names table
|
||||
// Abc_NtkCreateCioNamesTable( pNtk );
|
||||
// add latches to the CI/CO arrays
|
||||
Abc_NtkForEachLatch( pNtk, pLatch, i )
|
||||
{
|
||||
Vec_PtrPush( pNtk->vCis, pLatch );
|
||||
Vec_PtrPush( pNtk->vCos, pLatch );
|
||||
}
|
||||
// reorder the CI/COs to PI/POs first
|
||||
Abc_NtkOrderCisCos( pNtk );
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
|
@ -740,7 +676,6 @@ void Abc_NtkDelete( Abc_Ntk_t * pNtk )
|
|||
int LargePiece = (4 << ABC_NUM_STEPS);
|
||||
if ( pNtk == NULL )
|
||||
return;
|
||||
//printf( "Deleted newtork %p\n", pNtk );
|
||||
// make sure all the marks are clean
|
||||
Abc_NtkForEachObj( pNtk, pObj, i )
|
||||
{
|
||||
|
|
@ -765,26 +700,20 @@ void Abc_NtkDelete( Abc_Ntk_t * pNtk )
|
|||
if ( pNtk->pExdc )
|
||||
Abc_NtkDelete( pNtk->pExdc );
|
||||
// free the arrays
|
||||
Vec_PtrFree( pNtk->vPis );
|
||||
Vec_PtrFree( pNtk->vPos );
|
||||
Vec_PtrFree( pNtk->vCis );
|
||||
Vec_PtrFree( pNtk->vCos );
|
||||
Vec_PtrFree( pNtk->vAsserts );
|
||||
Vec_PtrFree( pNtk->vLatches );
|
||||
Vec_PtrFree( pNtk->vObjs );
|
||||
Vec_PtrFree( pNtk->vLats );
|
||||
Vec_PtrFree( pNtk->vCutSet );
|
||||
Vec_PtrFree( pNtk->vPtrTemp );
|
||||
Vec_IntFree( pNtk->vIntTemp );
|
||||
Vec_StrFree( pNtk->vStrTemp );
|
||||
if ( pNtk->pModel ) free( pNtk->pModel );
|
||||
// free the hash table of Obj name into Obj ID
|
||||
// stmm_free_table( pNtk->tName2Net );
|
||||
// stmm_free_table( pNtk->tObj2Name );
|
||||
TotalMemory = 0;
|
||||
// TotalMemory += Extra_MmFlexReadMemUsage(pNtk->pMmNames);
|
||||
TotalMemory += Extra_MmFixedReadMemUsage(pNtk->pMmObj);
|
||||
TotalMemory += Extra_MmStepReadMemUsage(pNtk->pMmStep);
|
||||
// fprintf( stdout, "The total memory allocated internally by the network = %0.2f Mb.\n", ((double)TotalMemory)/(1<<20) );
|
||||
// free the storage
|
||||
// Extra_MmFlexStop ( pNtk->pMmNames, 0 );
|
||||
Extra_MmFixedStop( pNtk->pMmObj, 0 );
|
||||
Extra_MmStepStop ( pNtk->pMmStep, 0 );
|
||||
// free the timing manager
|
||||
|
|
@ -802,7 +731,7 @@ void Abc_NtkDelete( Abc_Ntk_t * pNtk )
|
|||
else
|
||||
Seq_Delete( pNtk->pManFunc );
|
||||
}
|
||||
else if ( !Abc_NtkHasMapping(pNtk) )
|
||||
else if ( !Abc_NtkHasMapping(pNtk) && !Abc_NtkHasBlackbox(pNtk) )
|
||||
assert( 0 );
|
||||
// name manager
|
||||
Nm_ManFree( pNtk->pManName );
|
||||
|
|
@ -815,9 +744,9 @@ void Abc_NtkDelete( Abc_Ntk_t * pNtk )
|
|||
stmm_foreach_item( pNtk->tName2Model, gen, &pName, (char **)&pNtkTemp )
|
||||
Abc_NtkDelete( pNtkTemp );
|
||||
stmm_free_table( pNtk->tName2Model );
|
||||
if ( pNtk->pBlackBoxes )
|
||||
Vec_IntFree( pNtk->pBlackBoxes );
|
||||
}
|
||||
if ( pNtk->pBlackBoxes )
|
||||
Vec_IntFree( pNtk->pBlackBoxes );
|
||||
free( pNtk );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -101,34 +101,32 @@ void Abc_ObjAdd( Abc_Obj_t * pObj )
|
|||
// perform specialized operations depending on the object type
|
||||
if ( Abc_ObjIsNet(pObj) )
|
||||
{
|
||||
/*
|
||||
// add the name to the table
|
||||
if ( pObj->pData && stmm_insert( pNtk->tName2Net, pObj->pData, (char *)pObj ) )
|
||||
{
|
||||
printf( "Error: The net is already in the table...\n" );
|
||||
assert( 0 );
|
||||
}
|
||||
*/
|
||||
pNtk->nNets++;
|
||||
}
|
||||
else if ( Abc_ObjIsNode(pObj) )
|
||||
{
|
||||
pNtk->nNodes++;
|
||||
}
|
||||
else if ( Abc_ObjIsLatch(pObj) )
|
||||
{
|
||||
Vec_PtrPush( pNtk->vLats, pObj );
|
||||
pNtk->nLatches++;
|
||||
}
|
||||
else if ( Abc_ObjIsPi(pObj) )
|
||||
{
|
||||
Vec_PtrPush( pNtk->vPis, pObj );
|
||||
Vec_PtrPush( pNtk->vCis, pObj );
|
||||
pNtk->nPis++;
|
||||
}
|
||||
else if ( Abc_ObjIsPo(pObj) )
|
||||
{
|
||||
Vec_PtrPush( pNtk->vPos, pObj );
|
||||
Vec_PtrPush( pNtk->vCos, pObj );
|
||||
}
|
||||
else if ( Abc_ObjIsLatch(pObj) )
|
||||
{
|
||||
Vec_PtrPush( pNtk->vLatches, pObj );
|
||||
Vec_PtrPush( pNtk->vCis, pObj );
|
||||
Vec_PtrPush( pNtk->vCos, pObj );
|
||||
}
|
||||
else if ( Abc_ObjIsAssert(pObj) )
|
||||
{
|
||||
Vec_PtrPush( pNtk->vAsserts, pObj );
|
||||
Vec_PtrPush( pNtk->vCos, pObj );
|
||||
pNtk->nPos++;
|
||||
}
|
||||
else if ( Abc_ObjIsBox(pObj) )
|
||||
{
|
||||
|
|
@ -138,7 +136,6 @@ void Abc_ObjAdd( Abc_Obj_t * pObj )
|
|||
{
|
||||
assert( 0 );
|
||||
}
|
||||
assert( pObj->Id >= 0 );
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
|
@ -155,7 +152,11 @@ void Abc_ObjAdd( Abc_Obj_t * pObj )
|
|||
Abc_Obj_t * Abc_NtkDupObj( Abc_Ntk_t * pNtkNew, Abc_Obj_t * pObj )
|
||||
{
|
||||
Abc_Obj_t * pObjNew;
|
||||
// create the new object
|
||||
pObjNew = Abc_ObjAlloc( pNtkNew, pObj->Type );
|
||||
// add the object to the network
|
||||
Abc_ObjAdd( pObjNew );
|
||||
// copy functionality/names
|
||||
if ( Abc_ObjIsNode(pObj) ) // copy the function if functionality is compatible
|
||||
{
|
||||
if ( pNtkNew->ntkFunc == pObj->pNtk->ntkFunc )
|
||||
|
|
@ -172,18 +173,11 @@ Abc_Obj_t * Abc_NtkDupObj( Abc_Ntk_t * pNtkNew, Abc_Obj_t * pObj )
|
|||
}
|
||||
else if ( Abc_ObjIsNet(pObj) ) // copy the name
|
||||
{
|
||||
// pObjNew->pData = Abc_NtkRegisterName( pNtkNew, pObj->pData );
|
||||
pObjNew->pData = Nm_ManStoreIdName( pNtkNew->pManName, pObjNew->Id, pObj->pData, NULL );
|
||||
}
|
||||
else if ( Abc_ObjIsLatch(pObj) ) // copy the reset value
|
||||
pObjNew->pData = pObj->pData;
|
||||
pObj->pCopy = pObjNew;
|
||||
// add the object to the network
|
||||
Abc_ObjAdd( pObjNew );
|
||||
|
||||
|
||||
if ( Abc_ObjIsNet(pObj) )
|
||||
pObjNew->pData = Nm_ManStoreIdName( pNtkNew->pManName, pObjNew->Id, pObj->pData, NULL );
|
||||
|
||||
return pObjNew;
|
||||
}
|
||||
|
||||
|
|
@ -201,37 +195,34 @@ Abc_Obj_t * Abc_NtkDupObj( Abc_Ntk_t * pNtkNew, Abc_Obj_t * pObj )
|
|||
***********************************************************************/
|
||||
void Abc_NtkDeleteObj( Abc_Obj_t * pObj )
|
||||
{
|
||||
Vec_Ptr_t * vNodes = pObj->pNtk->vPtrTemp;
|
||||
Abc_Ntk_t * pNtk = pObj->pNtk;
|
||||
Vec_Ptr_t * vNodes;
|
||||
int i;
|
||||
|
||||
assert( !Abc_ObjIsComplement(pObj) );
|
||||
|
||||
// delete fanins and fanouts
|
||||
vNodes = Vec_PtrAlloc( 100 );
|
||||
Abc_NodeCollectFanouts( pObj, vNodes );
|
||||
for ( i = 0; i < vNodes->nSize; i++ )
|
||||
Abc_ObjDeleteFanin( vNodes->pArray[i], pObj );
|
||||
Abc_NodeCollectFanins( pObj, vNodes );
|
||||
for ( i = 0; i < vNodes->nSize; i++ )
|
||||
Abc_ObjDeleteFanin( pObj, vNodes->pArray[i] );
|
||||
Vec_PtrFree( vNodes );
|
||||
|
||||
// remove from the list of objects
|
||||
Vec_PtrWriteEntry( pNtk->vObjs, pObj->Id, NULL );
|
||||
pObj->Id = (1<<26)-1;
|
||||
pNtk->nObjs--;
|
||||
|
||||
// remove from the table of names
|
||||
if ( Nm_ManFindNameById(pObj->pNtk->pManName, pObj->Id) )
|
||||
Nm_ManDeleteIdName(pObj->pNtk->pManName, pObj->Id);
|
||||
|
||||
// perform specialized operations depending on the object type
|
||||
if ( Abc_ObjIsNet(pObj) )
|
||||
{
|
||||
assert( 0 );
|
||||
/*
|
||||
// remove the net from the hash table of nets
|
||||
if ( pObj->pData && !stmm_delete( pNtk->tName2Net, (char **)&pObj->pData, (char **)&pObj ) )
|
||||
{
|
||||
printf( "Error: The net is not in the table...\n" );
|
||||
assert( 0 );
|
||||
}
|
||||
*/
|
||||
pObj->pData = NULL;
|
||||
pNtk->nNets--;
|
||||
}
|
||||
|
|
@ -239,26 +230,33 @@ void Abc_NtkDeleteObj( Abc_Obj_t * pObj )
|
|||
{
|
||||
if ( Abc_NtkHasBdd(pNtk) )
|
||||
Cudd_RecursiveDeref( pNtk->pManFunc, pObj->pData );
|
||||
pObj->pData = NULL;
|
||||
pNtk->nNodes--;
|
||||
}
|
||||
else if ( Abc_ObjIsLatch(pObj) )
|
||||
{
|
||||
pNtk->nLatches--;
|
||||
Vec_PtrRemove( pNtk->vLatches, pObj );
|
||||
Vec_PtrRemove( pNtk->vCis, pObj );
|
||||
Vec_PtrRemove( pNtk->vCos, pObj );
|
||||
}
|
||||
else if ( Abc_ObjIsPi(pObj) )
|
||||
{
|
||||
Vec_PtrRemove( pObj->pNtk->vPis, pObj );
|
||||
Vec_PtrRemove( pObj->pNtk->vCis, pObj );
|
||||
}
|
||||
else if ( Abc_ObjIsPo(pObj) )
|
||||
{
|
||||
assert( Abc_NtkPoNum(pObj->pNtk) > 0 );
|
||||
Vec_PtrRemove( pObj->pNtk->vPos, pObj );
|
||||
Vec_PtrRemove( pObj->pNtk->vCos, pObj );
|
||||
pObj->pNtk->nPos--;
|
||||
|
||||
assert( 0 );
|
||||
/*
|
||||
// add the name to the table
|
||||
if ( !stmm_delete( pObj->pNtk->tObj2Name, (char **)&pObj, NULL ) )
|
||||
{
|
||||
assert( 0 ); // the PO is not in the table
|
||||
}
|
||||
*/
|
||||
}
|
||||
else if ( Abc_ObjIsAssert(pObj) )
|
||||
{
|
||||
Vec_PtrRemove( pObj->pNtk->vAsserts, pObj );
|
||||
Vec_PtrRemove( pObj->pNtk->vCos, pObj );
|
||||
}
|
||||
else if ( Abc_ObjIsBox(pObj) )
|
||||
{
|
||||
pNtk->nBoxes--;
|
||||
}
|
||||
else
|
||||
assert( 0 );
|
||||
|
|
@ -377,9 +375,6 @@ Abc_Obj_t * Abc_NtkFindNet( Abc_Ntk_t * pNtk, char * pName )
|
|||
Abc_Obj_t * pNet;
|
||||
int ObjId;
|
||||
assert( Abc_NtkIsNetlist(pNtk) );
|
||||
// if ( stmm_lookup( pNtk->tName2Net, pName, (char**)&pNet ) )
|
||||
// return pNet;
|
||||
// return NULL;
|
||||
ObjId = Nm_ManFindIdByName( pNtk->pManName, pName, NULL );
|
||||
if ( ObjId == -1 )
|
||||
return NULL;
|
||||
|
|
@ -406,7 +401,6 @@ Abc_Obj_t * Abc_NtkFindOrCreateNet( Abc_Ntk_t * pNtk, char * pName )
|
|||
return pNet;
|
||||
// create a new net
|
||||
pNet = Abc_ObjAlloc( pNtk, ABC_OBJ_NET );
|
||||
// pNet->pData = Abc_NtkRegisterName( pNtk, pName );
|
||||
Abc_ObjAdd( pNet );
|
||||
pNet->pData = Nm_ManStoreIdName( pNtk->pManName, pNet->Id, pName, NULL );
|
||||
return pNet;
|
||||
|
|
@ -508,6 +502,25 @@ Abc_Obj_t * Abc_NtkCreateLatch( Abc_Ntk_t * pNtk )
|
|||
return pObj;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Create the new node.]
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
Abc_Obj_t * Abc_NtkCreateAssert( Abc_Ntk_t * pNtk )
|
||||
{
|
||||
Abc_Obj_t * pObj;
|
||||
pObj = Abc_ObjAlloc( pNtk, ABC_OBJ_ASSERT );
|
||||
Abc_ObjAdd( pObj );
|
||||
return pObj;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Creates inverter.]
|
||||
|
|
|
|||
|
|
@ -360,6 +360,44 @@ char * Abc_SopCreateBuf( Extra_MmFlex_t * pMan )
|
|||
return Abc_SopRegister(pMan, "1 1\n");
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Creates the arbitrary cover from the truth table.]
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
char * Abc_SopCreateFromTruth( Extra_MmFlex_t * pMan, int nVars, unsigned * pTruth )
|
||||
{
|
||||
char * pSop, * pCube;
|
||||
int nMints, Counter, i, k;
|
||||
// count the number of true minterms
|
||||
Counter = 0;
|
||||
nMints = (1 << nVars);
|
||||
for ( i = 0; i < nMints; i++ )
|
||||
Counter += ((pTruth[i>>5] & (1 << (i&31))) > 0);
|
||||
// SOP is not well-defined if the truth table is constant 0
|
||||
assert( Counter > 0 );
|
||||
if ( Counter == 0 )
|
||||
return NULL;
|
||||
// start the cover
|
||||
pSop = Abc_SopStart( pMan, Counter, nVars );
|
||||
// create true minterms
|
||||
Counter = 0;
|
||||
for ( i = 0; i < nMints; i++ )
|
||||
if ( (pTruth[i>>5] & (1 << (i&31))) > 0 )
|
||||
{
|
||||
pCube = pSop + Counter * (nVars + 3);
|
||||
for ( k = 0; k < nVars; k++ )
|
||||
pCube[k] = '0' + ((i & (1 << k)) > 0);
|
||||
Counter++;
|
||||
}
|
||||
return pSop;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ void Abc_NtkIncrementTravId( Abc_Ntk_t * pNtk )
|
|||
{
|
||||
Abc_Obj_t * pObj;
|
||||
int i;
|
||||
if ( pNtk->nTravIds == (1<<10)-1 )
|
||||
if ( pNtk->nTravIds == (1<<9)-1 )
|
||||
{
|
||||
pNtk->nTravIds = 0;
|
||||
Abc_NtkForEachObj( pNtk, pObj, i )
|
||||
|
|
@ -56,6 +56,36 @@ void Abc_NtkIncrementTravId( Abc_Ntk_t * pNtk )
|
|||
pNtk->nTravIds++;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Order CI/COs.]
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void Abc_NtkOrderCisCos( Abc_Ntk_t * pNtk )
|
||||
{
|
||||
Abc_Obj_t * pObj;
|
||||
int i;
|
||||
Vec_PtrClear( pNtk->vCis );
|
||||
Vec_PtrClear( pNtk->vCos );
|
||||
Abc_NtkForEachPi( pNtk, pObj, i )
|
||||
Vec_PtrPush( pNtk->vCis, pObj );
|
||||
Abc_NtkForEachPo( pNtk, pObj, i )
|
||||
Vec_PtrPush( pNtk->vCos, pObj );
|
||||
Abc_NtkForEachAssert( pNtk, pObj, i )
|
||||
Vec_PtrPush( pNtk->vCos, pObj );
|
||||
Abc_NtkForEachLatch( pNtk, pObj, i )
|
||||
{
|
||||
Vec_PtrPush( pNtk->vCis, pObj );
|
||||
Vec_PtrPush( pNtk->vCos, pObj );
|
||||
}
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Reads the number of cubes of the node.]
|
||||
|
|
@ -84,7 +114,7 @@ int Abc_NtkGetCubeNum( Abc_Ntk_t * pNtk )
|
|||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Reads the number of cubes of the node.]
|
||||
Synopsis [Reads the number of literals in the SOPs of the nodes.]
|
||||
|
||||
Description []
|
||||
|
||||
|
|
@ -1029,6 +1059,12 @@ void Abc_NtkReassignIds( Abc_Ntk_t * pNtk )
|
|||
pNode->Id = Vec_PtrSize( vObjsNew );
|
||||
Vec_PtrPush( vObjsNew, pNode );
|
||||
}
|
||||
// put assert nodes next
|
||||
Abc_NtkForEachAssert( pNtk, pNode, i )
|
||||
{
|
||||
pNode->Id = Vec_PtrSize( vObjsNew );
|
||||
Vec_PtrPush( vObjsNew, pNode );
|
||||
}
|
||||
// put latches next
|
||||
Abc_NtkForEachLatch( pNtk, pNode, i )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -83,9 +83,9 @@ static int Abc_CommandExdcFree ( Abc_Frame_t * pAbc, int argc, char ** argv
|
|||
static int Abc_CommandExdcGet ( Abc_Frame_t * pAbc, int argc, char ** argv );
|
||||
static int Abc_CommandExdcSet ( Abc_Frame_t * pAbc, int argc, char ** argv );
|
||||
static int Abc_CommandCut ( Abc_Frame_t * pAbc, int argc, char ** argv );
|
||||
static int Abc_CommandXyz ( Abc_Frame_t * pAbc, int argc, char ** argv );
|
||||
static int Abc_CommandEspresso ( Abc_Frame_t * pAbc, int argc, char ** argv );
|
||||
static int Abc_CommandGen ( Abc_Frame_t * pAbc, int argc, char ** argv );
|
||||
static int Abc_CommandXyz ( Abc_Frame_t * pAbc, int argc, char ** argv );
|
||||
static int Abc_CommandTest ( Abc_Frame_t * pAbc, int argc, char ** argv );
|
||||
|
||||
static int Abc_CommandFraig ( Abc_Frame_t * pAbc, int argc, char ** argv );
|
||||
|
|
@ -193,9 +193,9 @@ void Abc_Init( Abc_Frame_t * pAbc )
|
|||
Cmd_CommandAdd( pAbc, "Various", "exdc_get", Abc_CommandExdcGet, 1 );
|
||||
Cmd_CommandAdd( pAbc, "Various", "exdc_set", Abc_CommandExdcSet, 1 );
|
||||
Cmd_CommandAdd( pAbc, "Various", "cut", Abc_CommandCut, 0 );
|
||||
Cmd_CommandAdd( pAbc, "Various", "xyz", Abc_CommandXyz, 1 );
|
||||
Cmd_CommandAdd( pAbc, "Various", "espresso", Abc_CommandEspresso, 1 );
|
||||
Cmd_CommandAdd( pAbc, "Various", "gen", Abc_CommandGen, 0 );
|
||||
Cmd_CommandAdd( pAbc, "Various", "xyz", Abc_CommandXyz, 1 );
|
||||
Cmd_CommandAdd( pAbc, "Various", "test", Abc_CommandTest, 0 );
|
||||
|
||||
Cmd_CommandAdd( pAbc, "Fraiging", "fraig", Abc_CommandFraig, 1 );
|
||||
|
|
@ -4286,98 +4286,6 @@ usage:
|
|||
return 1;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis []
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
int Abc_CommandXyz( Abc_Frame_t * pAbc, int argc, char ** argv )
|
||||
{
|
||||
FILE * pOut, * pErr;
|
||||
Abc_Ntk_t * pNtk, * pNtkRes;
|
||||
int c;
|
||||
int fVerbose;
|
||||
int fUseInvs;
|
||||
int nFaninMax;
|
||||
extern Abc_Ntk_t * Abc_NtkXyz( Abc_Ntk_t * pNtk, int nFaninMax, bool fUseEsop, bool fUseSop, bool fUseInvs, bool fVerbose );
|
||||
|
||||
pNtk = Abc_FrameReadNtk(pAbc);
|
||||
pOut = Abc_FrameReadOut(pAbc);
|
||||
pErr = Abc_FrameReadErr(pAbc);
|
||||
|
||||
// set defaults
|
||||
fVerbose = 0;
|
||||
fUseInvs = 1;
|
||||
nFaninMax = 128;
|
||||
Extra_UtilGetoptReset();
|
||||
while ( ( c = Extra_UtilGetopt( argc, argv, "Nivh" ) ) != EOF )
|
||||
{
|
||||
switch ( c )
|
||||
{
|
||||
case 'N':
|
||||
if ( globalUtilOptind >= argc )
|
||||
{
|
||||
fprintf( pErr, "Command line switch \"-N\" should be followed by an integer.\n" );
|
||||
goto usage;
|
||||
}
|
||||
nFaninMax = atoi(argv[globalUtilOptind]);
|
||||
globalUtilOptind++;
|
||||
if ( nFaninMax < 0 )
|
||||
goto usage;
|
||||
break;
|
||||
case 'i':
|
||||
fUseInvs ^= 1;
|
||||
break;
|
||||
case 'v':
|
||||
fVerbose ^= 1;
|
||||
break;
|
||||
case 'h':
|
||||
goto usage;
|
||||
default:
|
||||
goto usage;
|
||||
}
|
||||
}
|
||||
if ( pNtk == NULL )
|
||||
{
|
||||
fprintf( pErr, "Empty network.\n" );
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ( !Abc_NtkIsStrash(pNtk) )
|
||||
{
|
||||
fprintf( pErr, "Only works for strashed networks.\n" );
|
||||
return 1;
|
||||
}
|
||||
|
||||
// run the command
|
||||
// pNtkRes = Abc_NtkXyz( pNtk, nFaninMax, 1, 0, fUseInvs, fVerbose );
|
||||
pNtkRes = NULL;
|
||||
|
||||
if ( pNtkRes == NULL )
|
||||
{
|
||||
fprintf( pErr, "Command has failed.\n" );
|
||||
return 0;
|
||||
}
|
||||
// replace the current network
|
||||
Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes );
|
||||
return 0;
|
||||
|
||||
usage:
|
||||
fprintf( pErr, "usage: xyz [-N num] [-ivh]\n" );
|
||||
fprintf( pErr, "\t specilized AND/OR/EXOR decomposition\n" );
|
||||
fprintf( pErr, "\t-N num : maximum number of inputs [default = %d]\n", nFaninMax );
|
||||
fprintf( pErr, "\t-i : toggle the use of interters [default = %s]\n", fUseInvs? "yes": "no" );
|
||||
fprintf( pErr, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" );
|
||||
fprintf( pErr, "\t-h : print the command usage\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis []
|
||||
|
|
@ -4543,20 +4451,127 @@ usage:
|
|||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
int Abc_CommandTest( Abc_Frame_t * pAbc, int argc, char ** argv )
|
||||
int Abc_CommandXyz( Abc_Frame_t * pAbc, int argc, char ** argv )
|
||||
{
|
||||
FILE * pOut, * pErr;
|
||||
Abc_Ntk_t * pNtk;//, * pNtkRes;
|
||||
Abc_Ntk_t * pNtk, * pNtkRes;
|
||||
int c;
|
||||
int nLevels;
|
||||
// extern Abc_Ntk_t * Abc_NtkNewAig( Abc_Ntk_t * pNtk );
|
||||
int nLutMax;
|
||||
int nPlaMax;
|
||||
int fVerbose;
|
||||
// extern Abc_Ntk_t * Abc_NtkXyz( Abc_Ntk_t * pNtk, int nPlaMax, bool fUseEsop, bool fUseSop, bool fUseInvs, bool fVerbose );
|
||||
extern void * Abc_NtkPlayer( void * pNtk, int nLutMax, int nPlaMax, int fVerbose );
|
||||
|
||||
pNtk = Abc_FrameReadNtk(pAbc);
|
||||
pOut = Abc_FrameReadOut(pAbc);
|
||||
pErr = Abc_FrameReadErr(pAbc);
|
||||
|
||||
// set defaults
|
||||
nLevels = 15;
|
||||
nLutMax = 8;
|
||||
nPlaMax = 128;
|
||||
fVerbose = 0;
|
||||
Extra_UtilGetoptReset();
|
||||
while ( ( c = Extra_UtilGetopt( argc, argv, "LPvh" ) ) != EOF )
|
||||
{
|
||||
switch ( c )
|
||||
{
|
||||
case 'L':
|
||||
if ( globalUtilOptind >= argc )
|
||||
{
|
||||
fprintf( pErr, "Command line switch \"-N\" should be followed by an integer.\n" );
|
||||
goto usage;
|
||||
}
|
||||
nLutMax = atoi(argv[globalUtilOptind]);
|
||||
globalUtilOptind++;
|
||||
if ( nLutMax < 0 )
|
||||
goto usage;
|
||||
break;
|
||||
case 'P':
|
||||
if ( globalUtilOptind >= argc )
|
||||
{
|
||||
fprintf( pErr, "Command line switch \"-N\" should be followed by an integer.\n" );
|
||||
goto usage;
|
||||
}
|
||||
nPlaMax = atoi(argv[globalUtilOptind]);
|
||||
globalUtilOptind++;
|
||||
if ( nPlaMax < 0 )
|
||||
goto usage;
|
||||
break;
|
||||
case 'v':
|
||||
fVerbose ^= 1;
|
||||
break;
|
||||
case 'h':
|
||||
goto usage;
|
||||
default:
|
||||
goto usage;
|
||||
}
|
||||
}
|
||||
if ( pNtk == NULL )
|
||||
{
|
||||
fprintf( pErr, "Empty network.\n" );
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ( !Abc_NtkIsStrash(pNtk) )
|
||||
{
|
||||
fprintf( pErr, "Only works for strashed networks.\n" );
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ( nLutMax < 2 || nLutMax > 8 || nPlaMax < 8 || nPlaMax > 128 )
|
||||
{
|
||||
fprintf( pErr, "Incorrect LUT/PLA parameters.\n" );
|
||||
return 1;
|
||||
}
|
||||
|
||||
// run the command
|
||||
// pNtkRes = Abc_NtkXyz( pNtk, nPlaMax, 1, 0, fUseInvs, fVerbose );
|
||||
pNtkRes = Abc_NtkPlayer( pNtk, nLutMax, nPlaMax, fVerbose );
|
||||
if ( pNtkRes == NULL )
|
||||
{
|
||||
fprintf( pErr, "Command has failed.\n" );
|
||||
return 0;
|
||||
}
|
||||
// replace the current network
|
||||
Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes );
|
||||
return 0;
|
||||
|
||||
usage:
|
||||
fprintf( pErr, "usage: xyz [-L num] [-P num] [-vh]\n" );
|
||||
fprintf( pErr, "\t specilized LUT/PLA decomposition\n" );
|
||||
fprintf( pErr, "\t-L num : maximum number of LUT inputs (2<=num<=8) [default = %d]\n", nLutMax );
|
||||
fprintf( pErr, "\t-P num : maximum number of PLA inputs/cubes (8<=num<=128) [default = %d]\n", nPlaMax );
|
||||
fprintf( pErr, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" );
|
||||
fprintf( pErr, "\t-h : print the command usage\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis []
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
int Abc_CommandTest( Abc_Frame_t * pAbc, int argc, char ** argv )
|
||||
{
|
||||
FILE * pOut, * pErr;
|
||||
Abc_Ntk_t * pNtk, * pNtkRes;
|
||||
int c;
|
||||
int nLevels;
|
||||
// extern Abc_Ntk_t * Abc_NtkNewAig( Abc_Ntk_t * pNtk );
|
||||
extern Abc_Ntk_t * Abc_NtkIvy( Abc_Ntk_t * pNtk );
|
||||
|
||||
pNtk = Abc_FrameReadNtk(pAbc);
|
||||
pOut = Abc_FrameReadOut(pAbc);
|
||||
pErr = Abc_FrameReadErr(pAbc);
|
||||
|
||||
// set defaults
|
||||
nLevels = 128;
|
||||
Extra_UtilGetoptReset();
|
||||
while ( ( c = Extra_UtilGetopt( argc, argv, "Nh" ) ) != EOF )
|
||||
{
|
||||
|
|
@ -4614,7 +4629,7 @@ int Abc_CommandTest( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
// Cut_CellDumpToFile();
|
||||
// else
|
||||
// Cut_CellPrecompute();
|
||||
Cut_CellLoad();
|
||||
// Cut_CellLoad();
|
||||
/*
|
||||
{
|
||||
Abc_Ntk_t * pNtkRes;
|
||||
|
|
@ -4623,6 +4638,24 @@ int Abc_CommandTest( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes );
|
||||
}
|
||||
*/
|
||||
// Abc_NtkSimulteBuggyMiter( pNtk );
|
||||
|
||||
// Rwr_Temp();
|
||||
// Abc_MvExperiment();
|
||||
// Ivy_TruthTest();
|
||||
|
||||
|
||||
pNtkRes = Abc_NtkIvy( pNtk );
|
||||
// pNtkRes = Abc_NtkPlayer( pNtk, nLevels, 0 );
|
||||
// pNtkRes = NULL;
|
||||
if ( pNtkRes == NULL )
|
||||
{
|
||||
fprintf( pErr, "Command has failed.\n" );
|
||||
return 1;
|
||||
}
|
||||
// replace the current network
|
||||
Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes );
|
||||
|
||||
return 0;
|
||||
|
||||
usage:
|
||||
|
|
@ -6614,9 +6647,9 @@ int Abc_CommandCec( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
int fVerbose;
|
||||
int nSeconds;
|
||||
int nConfLimit;
|
||||
int nImpLimit;
|
||||
int nInsLimit;
|
||||
|
||||
extern void Abc_NtkCecSat( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int nConfLimit, int nImpLimit );
|
||||
extern void Abc_NtkCecSat( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int nConfLimit, int nInsLimit );
|
||||
extern void Abc_NtkCecFraig( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int nSeconds, int fVerbose );
|
||||
|
||||
|
||||
|
|
@ -6629,7 +6662,7 @@ int Abc_CommandCec( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
fVerbose = 0;
|
||||
nSeconds = 20;
|
||||
nConfLimit = 10000;
|
||||
nImpLimit = 0;
|
||||
nInsLimit = 0;
|
||||
Extra_UtilGetoptReset();
|
||||
while ( ( c = Extra_UtilGetopt( argc, argv, "TCIsvh" ) ) != EOF )
|
||||
{
|
||||
|
|
@ -6663,9 +6696,9 @@ int Abc_CommandCec( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
fprintf( pErr, "Command line switch \"-I\" should be followed by an integer.\n" );
|
||||
goto usage;
|
||||
}
|
||||
nImpLimit = atoi(argv[globalUtilOptind]);
|
||||
nInsLimit = atoi(argv[globalUtilOptind]);
|
||||
globalUtilOptind++;
|
||||
if ( nImpLimit < 0 )
|
||||
if ( nInsLimit < 0 )
|
||||
goto usage;
|
||||
break;
|
||||
case 's':
|
||||
|
|
@ -6686,7 +6719,7 @@ int Abc_CommandCec( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
|
||||
// perform equivalence checking
|
||||
if ( fSat )
|
||||
Abc_NtkCecSat( pNtk1, pNtk2, nConfLimit, nImpLimit );
|
||||
Abc_NtkCecSat( pNtk1, pNtk2, nConfLimit, nInsLimit );
|
||||
else
|
||||
Abc_NtkCecFraig( pNtk1, pNtk2, nSeconds, fVerbose );
|
||||
|
||||
|
|
@ -6699,7 +6732,7 @@ usage:
|
|||
fprintf( pErr, "\t performs combinational equivalence checking\n" );
|
||||
fprintf( pErr, "\t-T num : approximate runtime limit in seconds [default = %d]\n", nSeconds );
|
||||
fprintf( pErr, "\t-C num : limit on the number of conflicts [default = %d]\n", nConfLimit );
|
||||
fprintf( pErr, "\t-I num : limit on the number of implications [default = %d]\n", nImpLimit );
|
||||
fprintf( pErr, "\t-I num : limit on the number of clause inspections [default = %d]\n", nInsLimit );
|
||||
fprintf( pErr, "\t-s : toggle \"SAT only\" and \"FRAIG + SAT\" [default = %s]\n", fSat? "SAT only": "FRAIG + SAT" );
|
||||
fprintf( pErr, "\t-v : toggles verbose output [default = %s]\n", fVerbose? "yes": "no" );
|
||||
fprintf( pErr, "\t-h : print the command usage\n");
|
||||
|
|
@ -6734,9 +6767,9 @@ int Abc_CommandSec( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
int nFrames;
|
||||
int nSeconds;
|
||||
int nConfLimit;
|
||||
int nImpLimit;
|
||||
int nInsLimit;
|
||||
|
||||
extern void Abc_NtkSecSat( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int nConfLimit, int nImpLimit, int nFrames );
|
||||
extern void Abc_NtkSecSat( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int nConfLimit, int nInsLimit, int nFrames );
|
||||
extern void Abc_NtkSecFraig( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int nSeconds, int nFrames, int fVerbose );
|
||||
|
||||
|
||||
|
|
@ -6750,7 +6783,7 @@ int Abc_CommandSec( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
nFrames = 3;
|
||||
nSeconds = 20;
|
||||
nConfLimit = 10000;
|
||||
nImpLimit = 0;
|
||||
nInsLimit = 0;
|
||||
Extra_UtilGetoptReset();
|
||||
while ( ( c = Extra_UtilGetopt( argc, argv, "FTCIsvh" ) ) != EOF )
|
||||
{
|
||||
|
|
@ -6795,9 +6828,9 @@ int Abc_CommandSec( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
fprintf( pErr, "Command line switch \"-I\" should be followed by an integer.\n" );
|
||||
goto usage;
|
||||
}
|
||||
nImpLimit = atoi(argv[globalUtilOptind]);
|
||||
nInsLimit = atoi(argv[globalUtilOptind]);
|
||||
globalUtilOptind++;
|
||||
if ( nImpLimit < 0 )
|
||||
if ( nInsLimit < 0 )
|
||||
goto usage;
|
||||
break;
|
||||
case 'v':
|
||||
|
|
@ -6818,7 +6851,7 @@ int Abc_CommandSec( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
|
||||
// perform equivalence checking
|
||||
if ( fSat )
|
||||
Abc_NtkSecSat( pNtk1, pNtk2, nConfLimit, nImpLimit, nFrames );
|
||||
Abc_NtkSecSat( pNtk1, pNtk2, nConfLimit, nInsLimit, nFrames );
|
||||
else
|
||||
Abc_NtkSecFraig( pNtk1, pNtk2, nSeconds, nFrames, fVerbose );
|
||||
|
||||
|
|
@ -6835,7 +6868,7 @@ usage:
|
|||
fprintf( pErr, "\t-F num : the number of time frames to use [default = %d]\n", nFrames );
|
||||
fprintf( pErr, "\t-T num : approximate runtime limit in seconds [default = %d]\n", nSeconds );
|
||||
fprintf( pErr, "\t-C num : limit on the number of conflicts [default = %d]\n", nConfLimit );
|
||||
fprintf( pErr, "\t-I num : limit on the number of implications [default = %d]\n", nImpLimit );
|
||||
fprintf( pErr, "\t-I num : limit on the number of inspections [default = %d]\n", nInsLimit );
|
||||
fprintf( pErr, "\tfile1 : (optional) the file with the first network\n");
|
||||
fprintf( pErr, "\tfile2 : (optional) the file with the second network\n");
|
||||
fprintf( pErr, "\t if no files are given, uses the current network and its spec\n");
|
||||
|
|
@ -6863,7 +6896,7 @@ int Abc_CommandSat( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
int fJFront;
|
||||
int fVerbose;
|
||||
int nConfLimit;
|
||||
int nImpLimit;
|
||||
int nInsLimit;
|
||||
int clk;
|
||||
|
||||
pNtk = Abc_FrameReadNtk(pAbc);
|
||||
|
|
@ -6871,10 +6904,10 @@ int Abc_CommandSat( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
pErr = Abc_FrameReadErr(pAbc);
|
||||
|
||||
// set defaults
|
||||
fJFront = 0;
|
||||
fJFront = 0;
|
||||
fVerbose = 0;
|
||||
nConfLimit = 100000;
|
||||
nImpLimit = 0;
|
||||
nInsLimit = 0;
|
||||
Extra_UtilGetoptReset();
|
||||
while ( ( c = Extra_UtilGetopt( argc, argv, "CIvjh" ) ) != EOF )
|
||||
{
|
||||
|
|
@ -6897,9 +6930,9 @@ int Abc_CommandSat( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
fprintf( pErr, "Command line switch \"-I\" should be followed by an integer.\n" );
|
||||
goto usage;
|
||||
}
|
||||
nImpLimit = atoi(argv[globalUtilOptind]);
|
||||
nInsLimit = atoi(argv[globalUtilOptind]);
|
||||
globalUtilOptind++;
|
||||
if ( nImpLimit < 0 )
|
||||
if ( nInsLimit < 0 )
|
||||
goto usage;
|
||||
break;
|
||||
case 'j':
|
||||
|
|
@ -6934,13 +6967,13 @@ int Abc_CommandSat( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
clk = clock();
|
||||
if ( Abc_NtkIsStrash(pNtk) )
|
||||
{
|
||||
RetValue = Abc_NtkMiterSat( pNtk, nConfLimit, nImpLimit, fJFront, fVerbose );
|
||||
RetValue = Abc_NtkMiterSat( pNtk, (sint64)nConfLimit, (sint64)nInsLimit, fJFront, fVerbose, NULL, NULL );
|
||||
}
|
||||
else
|
||||
{
|
||||
Abc_Ntk_t * pTemp;
|
||||
pTemp = Abc_NtkStrash( pNtk, 0, 0 );
|
||||
RetValue = Abc_NtkMiterSat( pTemp, nConfLimit, nImpLimit, fJFront, fVerbose );
|
||||
RetValue = Abc_NtkMiterSat( pTemp, (sint64)nConfLimit, (sint64)nInsLimit, fJFront, fVerbose, NULL, NULL );
|
||||
pNtk->pModel = pTemp->pModel; pTemp->pModel = NULL;
|
||||
Abc_NtkDelete( pTemp );
|
||||
}
|
||||
|
|
@ -6948,10 +6981,22 @@ int Abc_CommandSat( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
// verify that the pattern is correct
|
||||
if ( RetValue == 0 && Abc_NtkPoNum(pNtk) == 1 )
|
||||
{
|
||||
//int i;
|
||||
//Abc_Obj_t * pObj;
|
||||
int * pSimInfo = Abc_NtkVerifySimulatePattern( pNtk, pNtk->pModel );
|
||||
if ( pSimInfo[0] != 1 )
|
||||
printf( "ERROR in Abc_NtkMiterSat(): Generated counter example is invalid.\n" );
|
||||
free( pSimInfo );
|
||||
/*
|
||||
// print model
|
||||
Abc_NtkForEachPi( pNtk, pObj, i )
|
||||
{
|
||||
printf( "%d", (int)(pNtk->pModel[i] > 0) );
|
||||
if ( i == 70 )
|
||||
break;
|
||||
}
|
||||
printf( "\n" );
|
||||
*/
|
||||
}
|
||||
|
||||
if ( RetValue == -1 )
|
||||
|
|
@ -6969,7 +7014,7 @@ usage:
|
|||
fprintf( pErr, "\t solves the combinational miter using SAT solver MiniSat-1.14\n" );
|
||||
fprintf( pErr, "\t derives CNF from the current network and leave it unchanged\n" );
|
||||
fprintf( pErr, "\t-C num : limit on the number of conflicts [default = %d]\n", nConfLimit );
|
||||
fprintf( pErr, "\t-I num : limit on the number of implications [default = %d]\n", nImpLimit );
|
||||
fprintf( pErr, "\t-I num : limit on the number of inspections [default = %d]\n", nInsLimit );
|
||||
fprintf( pErr, "\t-j : toggle the use of J-frontier [default = %s]\n", fJFront? "yes": "no" );
|
||||
fprintf( pErr, "\t-v : prints verbose information [default = %s]\n", fVerbose? "yes": "no" );
|
||||
fprintf( pErr, "\t-h : print the command usage\n");
|
||||
|
|
@ -7001,7 +7046,7 @@ int Abc_CommandProve( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
// set defaults
|
||||
Prove_ParamsSetDefault( pParams );
|
||||
Extra_UtilGetoptReset();
|
||||
while ( ( c = Extra_UtilGetopt( argc, argv, "NCFLrfvh" ) ) != EOF )
|
||||
while ( ( c = Extra_UtilGetopt( argc, argv, "NCFLIrfbvh" ) ) != EOF )
|
||||
{
|
||||
switch ( c )
|
||||
{
|
||||
|
|
@ -7049,12 +7094,26 @@ int Abc_CommandProve( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
if ( pParams->nMiteringLimitLast < 0 )
|
||||
goto usage;
|
||||
break;
|
||||
case 'I':
|
||||
if ( globalUtilOptind >= argc )
|
||||
{
|
||||
fprintf( pErr, "Command line switch \"-I\" should be followed by an integer.\n" );
|
||||
goto usage;
|
||||
}
|
||||
pParams->nTotalInspectLimit = atoi(argv[globalUtilOptind]);
|
||||
globalUtilOptind++;
|
||||
if ( pParams->nTotalInspectLimit < 0 )
|
||||
goto usage;
|
||||
break;
|
||||
case 'r':
|
||||
pParams->fUseRewriting ^= 1;
|
||||
break;
|
||||
case 'f':
|
||||
pParams->fUseFraiging ^= 1;
|
||||
break;
|
||||
case 'b':
|
||||
pParams->fUseBdds ^= 1;
|
||||
break;
|
||||
case 'v':
|
||||
pParams->fVerbose ^= 1;
|
||||
break;
|
||||
|
|
@ -7118,15 +7177,17 @@ int Abc_CommandProve( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
return 0;
|
||||
|
||||
usage:
|
||||
fprintf( pErr, "usage: prove [-N num] [-C num] [-F num] [-L num] [-rfvh]\n" );
|
||||
fprintf( pErr, "usage: prove [-N num] [-C num] [-F num] [-L num] [-I num] [-rfbvh]\n" );
|
||||
fprintf( pErr, "\t solves combinational miter by rewriting, FRAIGing, and SAT\n" );
|
||||
fprintf( pErr, "\t replaces the current network by the cone modified by rewriting\n" );
|
||||
fprintf( pErr, "\t-N num : max number of iterations [default = %d]\n", pParams->nItersMax );
|
||||
fprintf( pErr, "\t-C num : max starting number of conflicts in mitering [default = %d]\n", pParams->nMiteringLimitStart );
|
||||
fprintf( pErr, "\t-F num : max starting number of conflicts in fraiging [default = %d]\n", pParams->nFraigingLimitStart );
|
||||
fprintf( pErr, "\t-L num : max last-gasp number of conflicts in mitering [default = %d]\n", pParams->nMiteringLimitLast );
|
||||
fprintf( pErr, "\t-I num : max number of clause inspections in all SAT calls [default = %d]\n", (int)pParams->nTotalInspectLimit );
|
||||
fprintf( pErr, "\t-r : toggle the use of rewriting [default = %s]\n", pParams->fUseRewriting? "yes": "no" );
|
||||
fprintf( pErr, "\t-f : toggle the use of FRAIGing [default = %s]\n", pParams->fUseFraiging? "yes": "no" );
|
||||
fprintf( pErr, "\t-b : toggle the use of BDDs [default = %s]\n", pParams->fUseBdds? "yes": "no" );
|
||||
fprintf( pErr, "\t-v : prints verbose information [default = %s]\n", pParams->fVerbose? "yes": "no" );
|
||||
fprintf( pErr, "\t-h : print the command usage\n");
|
||||
return 1;
|
||||
|
|
|
|||
|
|
@ -387,13 +387,13 @@ void Abc_TruthPermute( char * pPerm, int nVars, unsigned * uTruthNode, unsigned
|
|||
nMints = (1 << nVars);
|
||||
for ( iMint = 0; iMint < nMints; iMint++ )
|
||||
{
|
||||
if ( (uTruthNode[iMint/32] & (1 << (iMint%32))) == 0 )
|
||||
if ( (uTruthNode[iMint>>5] & (1 << (iMint&31))) == 0 )
|
||||
continue;
|
||||
iMintPerm = 0;
|
||||
for ( v = 0; v < nVars; v++ )
|
||||
if ( iMint & (1 << v) )
|
||||
iMintPerm |= (1 << pPerm[v]);
|
||||
uTruthPerm[iMintPerm/32] |= (1 << (iMintPerm%32));
|
||||
uTruthPerm[iMintPerm>>5] |= (1 << (iMintPerm&31));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,407 @@
|
|||
/**CFile****************************************************************
|
||||
|
||||
FileName [abcIvy.c]
|
||||
|
||||
SystemName [ABC: Logic synthesis and verification system.]
|
||||
|
||||
PackageName [Network and node package.]
|
||||
|
||||
Synopsis [Strashing of the current network.]
|
||||
|
||||
Author [Alan Mishchenko]
|
||||
|
||||
Affiliation [UC Berkeley]
|
||||
|
||||
Date [Ver. 1.0. Started - June 20, 2005.]
|
||||
|
||||
Revision [$Id: abcIvy.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
|
||||
|
||||
***********************************************************************/
|
||||
|
||||
#include "abc.h"
|
||||
#include "dec.h"
|
||||
#include "ivy.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
/// DECLARATIONS ///
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static Abc_Ntk_t * Abc_NtkFromAig( Abc_Ntk_t * pNtkOld, Ivy_Man_t * pMan );
|
||||
static Ivy_Man_t * Abc_NtkToAig( Abc_Ntk_t * pNtkOld );
|
||||
|
||||
static void Abc_NtkStrashPerformAig( Abc_Ntk_t * pNtk, Ivy_Man_t * pMan );
|
||||
static Ivy_Obj_t * Abc_NodeStrashAig( Ivy_Man_t * pMan, Abc_Obj_t * pNode );
|
||||
static Ivy_Obj_t * Abc_NodeStrashAigSopAig( Ivy_Man_t * pMan, Abc_Obj_t * pNode, char * pSop );
|
||||
static Ivy_Obj_t * Abc_NodeStrashAigExorAig( Ivy_Man_t * pMan, Abc_Obj_t * pNode, char * pSop );
|
||||
static Ivy_Obj_t * Abc_NodeStrashAigFactorAig( Ivy_Man_t * pMan, Abc_Obj_t * pNode, char * pSop );
|
||||
extern char * Mio_GateReadSop( void * pGate );
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
/// FUNCTION DEFINITIONS ///
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Gives the current ABC network to AIG manager for processing.]
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
Abc_Ntk_t * Abc_NtkIvy( Abc_Ntk_t * pNtk )
|
||||
{
|
||||
Ivy_Man_t * pMan;
|
||||
Abc_Ntk_t * pNtkAig;
|
||||
int fCleanup = 1;
|
||||
int nNodes;
|
||||
|
||||
assert( !Abc_NtkIsNetlist(pNtk) );
|
||||
assert( !Abc_NtkIsSeq(pNtk) );
|
||||
if ( Abc_NtkIsBddLogic(pNtk) )
|
||||
{
|
||||
if ( !Abc_NtkBddToSop(pNtk, 0) )
|
||||
{
|
||||
printf( "Converting to SOPs has failed.\n" );
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
// print warning about choice nodes
|
||||
if ( Abc_NtkGetChoiceNum( pNtk ) )
|
||||
printf( "Warning: The choice nodes in the initial AIG are removed by strashing.\n" );
|
||||
|
||||
// convert to the AIG manager
|
||||
pMan = Abc_NtkToAig( pNtk );
|
||||
|
||||
if ( !Ivy_ManCheck( pMan ) )
|
||||
{
|
||||
printf( "AIG check has failed.\n" );
|
||||
Ivy_ManStop( pMan );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
// Ivy_MffcTest( pMan );
|
||||
Ivy_ManPrintStats( pMan );
|
||||
Ivy_ManSeqRewrite( pMan, 0, 0 );
|
||||
Ivy_ManPrintStats( pMan );
|
||||
|
||||
// convert from the AIG manager
|
||||
pNtkAig = Abc_NtkFromAig( pNtk, pMan );
|
||||
Ivy_ManStop( pMan );
|
||||
|
||||
// report the cleanup results
|
||||
if ( fCleanup && (nNodes = Abc_AigCleanup(pNtkAig->pManFunc)) )
|
||||
printf( "Warning: AIG cleanup removed %d nodes (this is not a bug).\n", nNodes );
|
||||
// duplicate EXDC
|
||||
if ( pNtk->pExdc )
|
||||
pNtkAig->pExdc = Abc_NtkDup( pNtk->pExdc );
|
||||
// make sure everything is okay
|
||||
if ( !Abc_NtkCheck( pNtkAig ) )
|
||||
{
|
||||
printf( "Abc_NtkStrash: The network check has failed.\n" );
|
||||
Abc_NtkDelete( pNtkAig );
|
||||
return NULL;
|
||||
}
|
||||
return pNtkAig;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Converts the network from the AIG manager into ABC.]
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
Abc_Ntk_t * Abc_NtkFromAig( Abc_Ntk_t * pNtkOld, Ivy_Man_t * pMan )
|
||||
{
|
||||
Vec_Int_t * vNodes;
|
||||
Abc_Ntk_t * pNtk;
|
||||
Abc_Obj_t * pObj, * pObjNew, * pFaninNew, * pFaninNew0, * pFaninNew1;
|
||||
Ivy_Obj_t * pNode;
|
||||
int i, Fanin;
|
||||
// perform strashing
|
||||
pNtk = Abc_NtkStartFrom( pNtkOld, ABC_NTK_STRASH, ABC_FUNC_AIG );
|
||||
// transfer the pointers to the basic nodes
|
||||
Ivy_ManConst1(pMan)->TravId = (Abc_NtkConst1(pNtk)->Id << 1);
|
||||
Abc_NtkForEachCi( pNtkOld, pObj, i )
|
||||
Ivy_ManPi(pMan, i)->TravId = (pObj->pCopy->Id << 1);
|
||||
// rebuild the AIG
|
||||
vNodes = Ivy_ManDfs( pMan );
|
||||
Ivy_ManForEachNodeVec( pMan, vNodes, pNode, i )
|
||||
{
|
||||
// add the first fanins
|
||||
Fanin = Ivy_ObjFanin0(pNode)->TravId;
|
||||
pFaninNew0 = Abc_NtkObj( pNtk, Fanin >> 1 );
|
||||
pFaninNew0 = Abc_ObjNotCond( pFaninNew0, Ivy_ObjFaninC0(pNode) ^ (Fanin&1) );
|
||||
if ( Ivy_ObjIsBuf(pNode) )
|
||||
{
|
||||
pNode->TravId = (Abc_ObjRegular(pFaninNew0)->Id << 1) | Abc_ObjIsComplement(pFaninNew0);
|
||||
continue;
|
||||
}
|
||||
// add the first second
|
||||
Fanin = Ivy_ObjFanin1(pNode)->TravId;
|
||||
pFaninNew1 = Abc_NtkObj( pNtk, Fanin >> 1 );
|
||||
pFaninNew1 = Abc_ObjNotCond( pFaninNew1, Ivy_ObjFaninC1(pNode) ^ (Fanin&1) );
|
||||
// create the new node
|
||||
if ( Ivy_ObjIsExor(pNode) )
|
||||
pObjNew = Abc_AigXor( pNtk->pManFunc, pFaninNew0, pFaninNew1 );
|
||||
else
|
||||
pObjNew = Abc_AigAnd( pNtk->pManFunc, pFaninNew0, pFaninNew1 );
|
||||
pNode->TravId = (Abc_ObjRegular(pObjNew)->Id << 1) | Abc_ObjIsComplement(pObjNew);
|
||||
}
|
||||
Vec_IntFree( vNodes );
|
||||
// connect the PO nodes
|
||||
Abc_NtkForEachCo( pNtkOld, pObj, i )
|
||||
{
|
||||
pNode = Ivy_ManPo(pMan, i);
|
||||
Fanin = Ivy_ObjFanin0(pNode)->TravId;
|
||||
pFaninNew = Abc_NtkObj( pNtk, Fanin >> 1 );
|
||||
pFaninNew = Abc_ObjNotCond( pFaninNew, Ivy_ObjFaninC0(pNode) ^ (Fanin&1) );
|
||||
Abc_ObjAddFanin( pObj->pCopy, pFaninNew );
|
||||
}
|
||||
return pNtk;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Converts the network from the AIG manager into ABC.]
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
Ivy_Man_t * Abc_NtkToAig( Abc_Ntk_t * pNtkOld )
|
||||
{
|
||||
Ivy_Man_t * pMan;
|
||||
Abc_Obj_t * pObj;
|
||||
Ivy_Obj_t * pFanin;
|
||||
int i;
|
||||
// create the manager
|
||||
assert( Abc_NtkHasSop(pNtkOld) || Abc_NtkHasAig(pNtkOld) );
|
||||
if ( Abc_NtkHasSop(pNtkOld) )
|
||||
pMan = Ivy_ManStart( Abc_NtkCiNum(pNtkOld), Abc_NtkCoNum(pNtkOld), 3 * Abc_NtkGetLitNum(pNtkOld) + 10 );
|
||||
else
|
||||
pMan = Ivy_ManStart( Abc_NtkCiNum(pNtkOld), Abc_NtkCoNum(pNtkOld), 3 * Abc_NtkNodeNum(pNtkOld) + 10 );
|
||||
// create the PIs
|
||||
Abc_NtkConst1(pNtkOld)->pCopy = (Abc_Obj_t *)Ivy_ManConst1(pMan);
|
||||
Abc_NtkForEachCi( pNtkOld, pObj, i )
|
||||
pObj->pCopy = (Abc_Obj_t *)Ivy_ManPi(pMan, i);
|
||||
// perform the conversion of the internal nodes
|
||||
Abc_NtkStrashPerformAig( pNtkOld, pMan );
|
||||
// create the POs
|
||||
Abc_NtkForEachCo( pNtkOld, pObj, i )
|
||||
{
|
||||
pFanin = (Ivy_Obj_t *)Abc_ObjFanin0(pObj)->pCopy;
|
||||
pFanin = Ivy_NotCond( pFanin, Abc_ObjFaninC0(pObj) );
|
||||
Ivy_ObjConnect( Ivy_ManPo(pMan, i), pFanin );
|
||||
}
|
||||
Ivy_ManCleanup( pMan );
|
||||
return pMan;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Prepares the network for strashing.]
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void Abc_NtkStrashPerformAig( Abc_Ntk_t * pNtk, Ivy_Man_t * pMan )
|
||||
{
|
||||
// ProgressBar * pProgress;
|
||||
Vec_Ptr_t * vNodes;
|
||||
Abc_Obj_t * pNode;
|
||||
int i;
|
||||
vNodes = Abc_NtkDfs( pNtk, 0 );
|
||||
// pProgress = Extra_ProgressBarStart( stdout, vNodes->nSize );
|
||||
Vec_PtrForEachEntry( vNodes, pNode, i )
|
||||
{
|
||||
// Extra_ProgressBarUpdate( pProgress, i, NULL );
|
||||
pNode->pCopy = (Abc_Obj_t *)Abc_NodeStrashAig( pMan, pNode );
|
||||
}
|
||||
// Extra_ProgressBarStop( pProgress );
|
||||
Vec_PtrFree( vNodes );
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Strashes one logic node.]
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
Ivy_Obj_t * Abc_NodeStrashAig( Ivy_Man_t * pMan, Abc_Obj_t * pNode )
|
||||
{
|
||||
int fUseFactor = 1;
|
||||
char * pSop;
|
||||
Ivy_Obj_t * pFanin0, * pFanin1;
|
||||
extern int Abc_SopIsExorType( char * pSop );
|
||||
|
||||
assert( Abc_ObjIsNode(pNode) );
|
||||
|
||||
// consider the case when the graph is an AIG
|
||||
if ( Abc_NtkIsStrash(pNode->pNtk) )
|
||||
{
|
||||
if ( Abc_NodeIsConst(pNode) )
|
||||
return Ivy_ManConst1(pMan);
|
||||
pFanin0 = (Ivy_Obj_t *)Abc_ObjFanin0(pNode)->pCopy;
|
||||
pFanin0 = Ivy_NotCond( pFanin0, Abc_ObjFaninC0(pNode) );
|
||||
pFanin1 = (Ivy_Obj_t *)Abc_ObjFanin1(pNode)->pCopy;
|
||||
pFanin1 = Ivy_NotCond( pFanin1, Abc_ObjFaninC1(pNode) );
|
||||
return Ivy_And( pFanin0, pFanin1 );
|
||||
}
|
||||
|
||||
// get the SOP of the node
|
||||
if ( Abc_NtkHasMapping(pNode->pNtk) )
|
||||
pSop = Mio_GateReadSop(pNode->pData);
|
||||
else
|
||||
pSop = pNode->pData;
|
||||
|
||||
// consider the constant node
|
||||
if ( Abc_NodeIsConst(pNode) )
|
||||
return Ivy_NotCond( Ivy_ManConst1(pMan), Abc_SopIsConst0(pSop) );
|
||||
|
||||
// consider the special case of EXOR function
|
||||
if ( Abc_SopIsExorType(pSop) )
|
||||
return Abc_NodeStrashAigExorAig( pMan, pNode, pSop );
|
||||
|
||||
// decide when to use factoring
|
||||
if ( fUseFactor && Abc_ObjFaninNum(pNode) > 2 && Abc_SopGetCubeNum(pSop) > 1 )
|
||||
return Abc_NodeStrashAigFactorAig( pMan, pNode, pSop );
|
||||
return Abc_NodeStrashAigSopAig( pMan, pNode, pSop );
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Strashes one logic node using its SOP.]
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
Ivy_Obj_t * Abc_NodeStrashAigSopAig( Ivy_Man_t * pMan, Abc_Obj_t * pNode, char * pSop )
|
||||
{
|
||||
Abc_Obj_t * pFanin;
|
||||
Ivy_Obj_t * pAnd, * pSum;
|
||||
char * pCube;
|
||||
int i, nFanins;
|
||||
|
||||
// get the number of node's fanins
|
||||
nFanins = Abc_ObjFaninNum( pNode );
|
||||
assert( nFanins == Abc_SopGetVarNum(pSop) );
|
||||
// go through the cubes of the node's SOP
|
||||
pSum = Ivy_Not( Ivy_ManConst1(pMan) );
|
||||
Abc_SopForEachCube( pSop, nFanins, pCube )
|
||||
{
|
||||
// create the AND of literals
|
||||
pAnd = Ivy_ManConst1(pMan);
|
||||
Abc_ObjForEachFanin( pNode, pFanin, i ) // pFanin can be a net
|
||||
{
|
||||
if ( pCube[i] == '1' )
|
||||
pAnd = Ivy_And( pAnd, (Ivy_Obj_t *)pFanin->pCopy );
|
||||
else if ( pCube[i] == '0' )
|
||||
pAnd = Ivy_And( pAnd, Ivy_Not((Ivy_Obj_t *)pFanin->pCopy) );
|
||||
}
|
||||
// add to the sum of cubes
|
||||
pSum = Ivy_Or( pSum, pAnd );
|
||||
}
|
||||
// decide whether to complement the result
|
||||
if ( Abc_SopIsComplement(pSop) )
|
||||
pSum = Ivy_Not(pSum);
|
||||
return pSum;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Strashed n-input XOR function.]
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
Ivy_Obj_t * Abc_NodeStrashAigExorAig( Ivy_Man_t * pMan, Abc_Obj_t * pNode, char * pSop )
|
||||
{
|
||||
Abc_Obj_t * pFanin;
|
||||
Ivy_Obj_t * pSum;
|
||||
int i, nFanins;
|
||||
// get the number of node's fanins
|
||||
nFanins = Abc_ObjFaninNum( pNode );
|
||||
assert( nFanins == Abc_SopGetVarNum(pSop) );
|
||||
// go through the cubes of the node's SOP
|
||||
pSum = Ivy_Not( Ivy_ManConst1(pMan) );
|
||||
for ( i = 0; i < nFanins; i++ )
|
||||
{
|
||||
pFanin = Abc_ObjFanin( pNode, i );
|
||||
pSum = Ivy_Exor( pSum, (Ivy_Obj_t *)pFanin->pCopy );
|
||||
}
|
||||
if ( Abc_SopIsComplement(pSop) )
|
||||
pSum = Ivy_Not(pSum);
|
||||
return pSum;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Strashes one logic node using its SOP.]
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
Ivy_Obj_t * Abc_NodeStrashAigFactorAig( Ivy_Man_t * pMan, Abc_Obj_t * pRoot, char * pSop )
|
||||
{
|
||||
Dec_Graph_t * pFForm;
|
||||
Dec_Node_t * pNode;
|
||||
Ivy_Obj_t * pAnd;
|
||||
int i;
|
||||
|
||||
// extern Ivy_Obj_t * Dec_GraphToNetworkAig( Ivy_Man_t * pMan, Dec_Graph_t * pGraph );
|
||||
extern Ivy_Obj_t * Dec_GraphToNetworkIvy( Ivy_Man_t * pMan, Dec_Graph_t * pGraph );
|
||||
|
||||
// assert( 0 );
|
||||
|
||||
// perform factoring
|
||||
pFForm = Dec_Factor( pSop );
|
||||
// collect the fanins
|
||||
Dec_GraphForEachLeaf( pFForm, pNode, i )
|
||||
pNode->pFunc = Abc_ObjFanin(pRoot,i)->pCopy;
|
||||
// perform strashing
|
||||
// pAnd = Dec_GraphToNetworkAig( pMan, pFForm );
|
||||
pAnd = Dec_GraphToNetworkIvy( pMan, pFForm );
|
||||
// pAnd = NULL;
|
||||
|
||||
Dec_GraphFree( pFForm );
|
||||
return pAnd;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
/// END OF FILE ///
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
|
@ -81,7 +81,7 @@ Abc_Ntk_t * Abc_NtkMiter( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int fComb )
|
|||
***********************************************************************/
|
||||
Abc_Ntk_t * Abc_NtkMiterInt( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int fComb )
|
||||
{
|
||||
char Buffer[100];
|
||||
char Buffer[1000];
|
||||
Abc_Ntk_t * pNtkMiter;
|
||||
|
||||
assert( Abc_NtkIsStrash(pNtk1) );
|
||||
|
|
@ -168,16 +168,12 @@ void Abc_NtkMiterPrepare( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, Abc_Ntk_t * pNtk
|
|||
Abc_NtkForEachLatch( pNtk1, pObj, i )
|
||||
{
|
||||
pObjNew = Abc_NtkDupObj( pNtkMiter, pObj );
|
||||
Vec_PtrPush( pNtkMiter->vCis, pObjNew );
|
||||
Vec_PtrPush( pNtkMiter->vCos, pObjNew );
|
||||
// add name
|
||||
Abc_NtkLogicStoreNamePlus( pObjNew, Abc_ObjName(pObj), "_1" );
|
||||
}
|
||||
Abc_NtkForEachLatch( pNtk2, pObj, i )
|
||||
{
|
||||
pObjNew = Abc_NtkDupObj( pNtkMiter, pObj );
|
||||
Vec_PtrPush( pNtkMiter->vCis, pObjNew );
|
||||
Vec_PtrPush( pNtkMiter->vCos, pObjNew );
|
||||
// add name
|
||||
Abc_NtkLogicStoreNamePlus( pObjNew, Abc_ObjName(pObj), "_2" );
|
||||
}
|
||||
|
|
@ -295,7 +291,7 @@ void Abc_NtkMiterFinalize( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, Abc_Ntk_t * pNt
|
|||
***********************************************************************/
|
||||
Abc_Ntk_t * Abc_NtkMiterAnd( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2 )
|
||||
{
|
||||
char Buffer[100];
|
||||
char Buffer[1000];
|
||||
Abc_Ntk_t * pNtkMiter;
|
||||
Abc_Obj_t * pOutput1, * pOutput2;
|
||||
Abc_Obj_t * pRoot1, * pRoot2, * pMiter;
|
||||
|
|
@ -352,7 +348,7 @@ Abc_Ntk_t * Abc_NtkMiterAnd( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2 )
|
|||
***********************************************************************/
|
||||
Abc_Ntk_t * Abc_NtkMiterCofactor( Abc_Ntk_t * pNtk, Vec_Int_t * vPiValues )
|
||||
{
|
||||
char Buffer[100];
|
||||
char Buffer[1000];
|
||||
Abc_Ntk_t * pNtkMiter;
|
||||
Abc_Obj_t * pRoot, * pOutput1;
|
||||
int Value, i;
|
||||
|
|
@ -418,7 +414,7 @@ Abc_Ntk_t * Abc_NtkMiterCofactor( Abc_Ntk_t * pNtk, Vec_Int_t * vPiValues )
|
|||
***********************************************************************/
|
||||
Abc_Ntk_t * Abc_NtkMiterForCofactors( Abc_Ntk_t * pNtk, int Out, int In1, int In2 )
|
||||
{
|
||||
char Buffer[100];
|
||||
char Buffer[1000];
|
||||
Abc_Ntk_t * pNtkMiter;
|
||||
Abc_Obj_t * pRoot, * pOutput1, * pOutput2, * pMiter;
|
||||
|
||||
|
|
@ -665,7 +661,7 @@ void Abc_NtkMiterReport( Abc_Ntk_t * pMiter )
|
|||
***********************************************************************/
|
||||
Abc_Ntk_t * Abc_NtkFrames( Abc_Ntk_t * pNtk, int nFrames, int fInitial )
|
||||
{
|
||||
char Buffer[100];
|
||||
char Buffer[1000];
|
||||
ProgressBar * pProgress;
|
||||
Abc_Ntk_t * pNtkFrames;
|
||||
Abc_Obj_t * pLatch, * pLatchNew;
|
||||
|
|
@ -717,8 +713,6 @@ Abc_Ntk_t * Abc_NtkFrames( Abc_Ntk_t * pNtk, int nFrames, int fInitial )
|
|||
{
|
||||
pLatchNew = Abc_NtkLatch(pNtkFrames, i);
|
||||
Abc_ObjAddFanin( pLatchNew, pLatch->pCopy );
|
||||
Vec_PtrPush( pNtkFrames->vCis, pLatchNew );
|
||||
Vec_PtrPush( pNtkFrames->vCos, pLatchNew );
|
||||
Abc_NtkLogicStoreName( pLatchNew, Abc_ObjName(pLatch) );
|
||||
}
|
||||
}
|
||||
|
|
@ -728,6 +722,9 @@ Abc_Ntk_t * Abc_NtkFrames( Abc_Ntk_t * pNtk, int nFrames, int fInitial )
|
|||
// remove dangling nodes
|
||||
Abc_AigCleanup( pNtkFrames->pManFunc );
|
||||
|
||||
// reorder the latches
|
||||
Abc_NtkOrderCisCos( pNtkFrames );
|
||||
|
||||
// make sure that everything is okay
|
||||
if ( !Abc_NtkCheck( pNtkFrames ) )
|
||||
{
|
||||
|
|
@ -773,6 +770,12 @@ void Abc_NtkAddFrame( Abc_Ntk_t * pNtkFrames, Abc_Ntk_t * pNtk, int iFrame )
|
|||
Abc_NtkLogicStoreNamePlus( Abc_NtkDupObj(pNtkFrames, pNode), Abc_ObjName(pNode), Buffer );
|
||||
Abc_ObjAddFanin( pNode->pCopy, Abc_ObjChild0Copy(pNode) );
|
||||
}
|
||||
// add the new asserts
|
||||
Abc_NtkForEachAssert( pNtk, pNode, i )
|
||||
{
|
||||
Abc_NtkLogicStoreNamePlus( Abc_NtkDupObj(pNtkFrames, pNode), Abc_ObjName(pNode), Buffer );
|
||||
Abc_ObjAddFanin( pNode->pCopy, Abc_ObjChild0Copy(pNode) );
|
||||
}
|
||||
// transfer the implementation of the latch drivers to the latches
|
||||
Abc_NtkForEachLatch( pNtk, pLatch, i )
|
||||
pLatch->pNext = Abc_ObjChild0Copy(pLatch);
|
||||
|
|
@ -795,7 +798,7 @@ void Abc_NtkAddFrame( Abc_Ntk_t * pNtkFrames, Abc_Ntk_t * pNtk, int iFrame )
|
|||
***********************************************************************/
|
||||
Abc_Ntk_t * Abc_NtkFrames2( Abc_Ntk_t * pNtk, int nFrames, int fInitial, AddFrameMapping addFrameMapping, void* arg )
|
||||
{
|
||||
char Buffer[100];
|
||||
char Buffer[1000];
|
||||
ProgressBar * pProgress;
|
||||
Abc_Ntk_t * pNtkFrames;
|
||||
Vec_Ptr_t * vNodes;
|
||||
|
|
@ -854,9 +857,6 @@ Abc_Ntk_t * Abc_NtkFrames2( Abc_Ntk_t * pNtk, int nFrames, int fInitial, AddFram
|
|||
{
|
||||
pLatchNew = Abc_NtkLatch(pNtkFrames, i);
|
||||
Abc_ObjAddFanin( pLatchNew, pLatch->pCopy );
|
||||
|
||||
Vec_PtrPush( pNtkFrames->vCis, pLatchNew );
|
||||
Vec_PtrPush( pNtkFrames->vCos, pLatchNew );
|
||||
Abc_NtkLogicStoreName( pLatchNew, Abc_ObjName(pLatch) );
|
||||
}
|
||||
}
|
||||
|
|
@ -865,6 +865,9 @@ Abc_Ntk_t * Abc_NtkFrames2( Abc_Ntk_t * pNtk, int nFrames, int fInitial, AddFram
|
|||
|
||||
// remove dangling nodes
|
||||
Abc_AigCleanup( pNtkFrames->pManFunc );
|
||||
|
||||
// reorder the latches
|
||||
Abc_NtkOrderCisCos( pNtkFrames );
|
||||
|
||||
// make sure that everything is okay
|
||||
if ( !Abc_NtkCheck( pNtkFrames ) )
|
||||
|
|
|
|||
|
|
@ -0,0 +1,369 @@
|
|||
/**CFile****************************************************************
|
||||
|
||||
FileName [abcMv.c]
|
||||
|
||||
SystemName [ABC: Logic synthesis and verification system.]
|
||||
|
||||
PackageName [Network and node package.]
|
||||
|
||||
Synopsis [Multi-valued decomposition.]
|
||||
|
||||
Author [Alan Mishchenko]
|
||||
|
||||
Affiliation [UC Berkeley]
|
||||
|
||||
Date [Ver. 1.0. Started - June 20, 2005.]
|
||||
|
||||
Revision [$Id: abcMv.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
|
||||
|
||||
***********************************************************************/
|
||||
|
||||
#include "abc.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
/// DECLARATIONS ///
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
typedef struct Mv_Man_t_ Mv_Man_t;
|
||||
struct Mv_Man_t_
|
||||
{
|
||||
int nInputs; // the number of 4-valued input variables
|
||||
int nFuncs; // the number of 4-valued functions
|
||||
DdManager * dd; // representation of functions
|
||||
DdNode * bValues[15][4]; // representation of i-sets
|
||||
DdNode * bValueDcs[15][4]; // representation of i-sets don't-cares
|
||||
DdNode * bFuncs[15]; // representation of functions
|
||||
};
|
||||
|
||||
static void Abc_MvDecompose( Mv_Man_t * p );
|
||||
static void Abc_MvPrintStats( Mv_Man_t * p );
|
||||
static void Abc_MvRead( Mv_Man_t * p );
|
||||
static void Abc_MvDeref( Mv_Man_t * p );
|
||||
static DdNode * Abc_MvReadCube( DdManager * dd, char * pLine, int nVars );
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
/// FUNCTION DEFINITIONS ///
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis []
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void Abc_MvExperiment()
|
||||
{
|
||||
Mv_Man_t * p;
|
||||
// get the functions
|
||||
p = ALLOC( Mv_Man_t, 1 );
|
||||
memset( p, 0, sizeof(Mv_Man_t) );
|
||||
p->dd = Cudd_Init( 32, 0, CUDD_UNIQUE_SLOTS, CUDD_CACHE_SLOTS, 0 );
|
||||
p->nFuncs = 15;
|
||||
p->nInputs = 9;
|
||||
Abc_MvRead( p );
|
||||
// process the functions
|
||||
Abc_MvPrintStats( p );
|
||||
// Cudd_ReduceHeap( p->dd, CUDD_REORDER_SYMM_SIFT, 1 );
|
||||
// Abc_MvPrintStats( p );
|
||||
// try detecting support reducing bound set
|
||||
Abc_MvDecompose( p );
|
||||
|
||||
// remove the manager
|
||||
Abc_MvDeref( p );
|
||||
Extra_StopManager( p->dd );
|
||||
free( p );
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis []
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void Abc_MvPrintStats( Mv_Man_t * p )
|
||||
{
|
||||
int i, v;
|
||||
for ( i = 0; i < 15; i++ )
|
||||
{
|
||||
printf( "%2d : ", i );
|
||||
printf( "%3d (%2d) ", Cudd_DagSize(p->bFuncs[i])-1, Cudd_SupportSize(p->dd, p->bFuncs[i]) );
|
||||
for ( v = 0; v < 4; v++ )
|
||||
printf( "%d = %3d (%2d) ", v, Cudd_DagSize(p->bValues[i][v])-1, Cudd_SupportSize(p->dd, p->bValues[i][v]) );
|
||||
printf( "\n" );
|
||||
}
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis []
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
DdNode * Abc_MvReadCube( DdManager * dd, char * pLine, int nVars )
|
||||
{
|
||||
DdNode * bCube, * bVar, * bTemp;
|
||||
int i;
|
||||
bCube = Cudd_ReadOne(dd); Cudd_Ref( bCube );
|
||||
for ( i = 0; i < nVars; i++ )
|
||||
{
|
||||
if ( pLine[i] == '-' )
|
||||
continue;
|
||||
else if ( pLine[i] == '0' ) // 0
|
||||
bVar = Cudd_Not( Cudd_bddIthVar(dd, 29-i) );
|
||||
else if ( pLine[i] == '1' ) // 1
|
||||
bVar = Cudd_bddIthVar(dd, 29-i);
|
||||
else assert(0);
|
||||
bCube = Cudd_bddAnd( dd, bTemp = bCube, bVar ); Cudd_Ref( bCube );
|
||||
Cudd_RecursiveDeref( dd, bTemp );
|
||||
}
|
||||
Cudd_Deref( bCube );
|
||||
return bCube;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis []
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void Abc_MvRead( Mv_Man_t * p )
|
||||
{
|
||||
FILE * pFile;
|
||||
char Buffer[1000], * pLine;
|
||||
DdNode * bCube, * bTemp, * bProd, * bVar0, * bVar1, * bCubeSum;
|
||||
int i, v;
|
||||
|
||||
// start the cube
|
||||
bCubeSum = Cudd_ReadLogicZero(p->dd); Cudd_Ref( bCubeSum );
|
||||
|
||||
// start the values
|
||||
for ( i = 0; i < 15; i++ )
|
||||
for ( v = 0; v < 4; v++ )
|
||||
{
|
||||
p->bValues[i][v] = Cudd_ReadLogicZero(p->dd); Cudd_Ref( p->bValues[i][v] );
|
||||
p->bValueDcs[i][v] = Cudd_ReadLogicZero(p->dd); Cudd_Ref( p->bValueDcs[i][v] );
|
||||
}
|
||||
|
||||
// read the file
|
||||
pFile = fopen( "input.pla", "r" );
|
||||
while ( fgets( Buffer, 1000, pFile ) )
|
||||
{
|
||||
if ( Buffer[0] == '#' )
|
||||
continue;
|
||||
if ( Buffer[0] == '.' )
|
||||
{
|
||||
if ( Buffer[1] == 'e' )
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
|
||||
// get the cube
|
||||
bCube = Abc_MvReadCube( p->dd, Buffer, 18 ); Cudd_Ref( bCube );
|
||||
|
||||
// add it to the values of the output functions
|
||||
pLine = Buffer + 19;
|
||||
for ( i = 0; i < 15; i++ )
|
||||
{
|
||||
if ( pLine[2*i] == '-' && pLine[2*i+1] == '-' )
|
||||
{
|
||||
for ( v = 0; v < 4; v++ )
|
||||
{
|
||||
p->bValueDcs[i][v] = Cudd_bddOr( p->dd, bTemp = p->bValueDcs[i][v], bCube ); Cudd_Ref( p->bValueDcs[i][v] );
|
||||
Cudd_RecursiveDeref( p->dd, bTemp );
|
||||
}
|
||||
continue;
|
||||
}
|
||||
else if ( pLine[2*i] == '0' && pLine[2*i+1] == '0' ) // 0
|
||||
v = 0;
|
||||
else if ( pLine[2*i] == '1' && pLine[2*i+1] == '0' ) // 1
|
||||
v = 1;
|
||||
else if ( pLine[2*i] == '0' && pLine[2*i+1] == '1' ) // 2
|
||||
v = 2;
|
||||
else if ( pLine[2*i] == '1' && pLine[2*i+1] == '1' ) // 3
|
||||
v = 3;
|
||||
else assert( 0 );
|
||||
// add the value
|
||||
p->bValues[i][v] = Cudd_bddOr( p->dd, bTemp = p->bValues[i][v], bCube ); Cudd_Ref( p->bValues[i][v] );
|
||||
Cudd_RecursiveDeref( p->dd, bTemp );
|
||||
}
|
||||
|
||||
// add the cube
|
||||
bCubeSum = Cudd_bddOr( p->dd, bTemp = bCubeSum, bCube ); Cudd_Ref( bCubeSum );
|
||||
Cudd_RecursiveDeref( p->dd, bTemp );
|
||||
Cudd_RecursiveDeref( p->dd, bCube );
|
||||
}
|
||||
|
||||
// add the complement of the domain to all values
|
||||
for ( i = 0; i < 15; i++ )
|
||||
for ( v = 0; v < 4; v++ )
|
||||
{
|
||||
if ( p->bValues[i][v] == Cudd_Not(Cudd_ReadOne(p->dd)) )
|
||||
continue;
|
||||
p->bValues[i][v] = Cudd_bddOr( p->dd, bTemp = p->bValues[i][v], p->bValueDcs[i][v] ); Cudd_Ref( p->bValues[i][v] );
|
||||
Cudd_RecursiveDeref( p->dd, bTemp );
|
||||
p->bValues[i][v] = Cudd_bddOr( p->dd, bTemp = p->bValues[i][v], Cudd_Not(bCubeSum) ); Cudd_Ref( p->bValues[i][v] );
|
||||
Cudd_RecursiveDeref( p->dd, bTemp );
|
||||
}
|
||||
printf( "Domain = %5.2f %%.\n", 100.0*Cudd_CountMinterm(p->dd, bCubeSum, 32)/Cudd_CountMinterm(p->dd, Cudd_ReadOne(p->dd), 32) );
|
||||
Cudd_RecursiveDeref( p->dd, bCubeSum );
|
||||
|
||||
// create each output function
|
||||
for ( i = 0; i < 15; i++ )
|
||||
{
|
||||
p->bFuncs[i] = Cudd_ReadLogicZero(p->dd); Cudd_Ref( p->bFuncs[i] );
|
||||
for ( v = 0; v < 4; v++ )
|
||||
{
|
||||
bVar0 = Cudd_NotCond( Cudd_bddIthVar(p->dd, 30), ((v & 1) == 0) );
|
||||
bVar1 = Cudd_NotCond( Cudd_bddIthVar(p->dd, 31), ((v & 2) == 0) );
|
||||
bCube = Cudd_bddAnd( p->dd, bVar0, bVar1 ); Cudd_Ref( bCube );
|
||||
bProd = Cudd_bddAnd( p->dd, p->bValues[i][v], bCube ); Cudd_Ref( bProd );
|
||||
Cudd_RecursiveDeref( p->dd, bCube );
|
||||
// add the value
|
||||
p->bFuncs[i] = Cudd_bddOr( p->dd, bTemp = p->bFuncs[i], bProd ); Cudd_Ref( p->bFuncs[i] );
|
||||
Cudd_RecursiveDeref( p->dd, bTemp );
|
||||
Cudd_RecursiveDeref( p->dd, bProd );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis []
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void Abc_MvDeref( Mv_Man_t * p )
|
||||
{
|
||||
int i, v;
|
||||
for ( i = 0; i < 15; i++ )
|
||||
for ( v = 0; v < 4; v++ )
|
||||
{
|
||||
Cudd_RecursiveDeref( p->dd, p->bValues[i][v] );
|
||||
Cudd_RecursiveDeref( p->dd, p->bValueDcs[i][v] );
|
||||
}
|
||||
for ( i = 0; i < 15; i++ )
|
||||
Cudd_RecursiveDeref( p->dd, p->bFuncs[i] );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis []
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void Abc_MvDecompose( Mv_Man_t * p )
|
||||
{
|
||||
DdNode * bCofs[16], * bVarCube1, * bVarCube2, * bVarCube, * bCube, * bVar0, * bVar1;//, * bRes;
|
||||
int k, i1, i2, v1, v2;//, c1, c2, Counter;
|
||||
|
||||
bVar0 = Cudd_bddIthVar(p->dd, 30);
|
||||
bVar1 = Cudd_bddIthVar(p->dd, 31);
|
||||
bCube = Cudd_bddAnd( p->dd, bVar0, bVar1 ); Cudd_Ref( bCube );
|
||||
|
||||
for ( k = 0; k < p->nFuncs; k++ )
|
||||
{
|
||||
printf( "FUNCTION %d\n", k );
|
||||
for ( i1 = 0; i1 < p->nFuncs; i1++ )
|
||||
for ( i2 = i1+1; i2 < p->nFuncs; i2++ )
|
||||
{
|
||||
Vec_Ptr_t * vCofs;
|
||||
|
||||
for ( v1 = 0; v1 < 4; v1++ )
|
||||
{
|
||||
bVar0 = Cudd_NotCond( Cudd_bddIthVar(p->dd, 29-2*i1 ), ((v1 & 1) == 0) );
|
||||
bVar1 = Cudd_NotCond( Cudd_bddIthVar(p->dd, 29-2*i1-1), ((v1 & 2) == 0) );
|
||||
bVarCube1 = Cudd_bddAnd( p->dd, bVar0, bVar1 ); Cudd_Ref( bVarCube1 );
|
||||
for ( v2 = 0; v2 < 4; v2++ )
|
||||
{
|
||||
bVar0 = Cudd_NotCond( Cudd_bddIthVar(p->dd, 29-2*i2 ), ((v2 & 1) == 0) );
|
||||
bVar1 = Cudd_NotCond( Cudd_bddIthVar(p->dd, 29-2*i2-1), ((v2 & 2) == 0) );
|
||||
bVarCube2 = Cudd_bddAnd( p->dd, bVar0, bVar1 ); Cudd_Ref( bVarCube2 );
|
||||
bVarCube = Cudd_bddAnd( p->dd, bVarCube1, bVarCube2 ); Cudd_Ref( bVarCube );
|
||||
bCofs[v1 * 4 + v2] = Cudd_Cofactor( p->dd, p->bFuncs[k], bVarCube ); Cudd_Ref( bCofs[v1 * 4 + v2] );
|
||||
Cudd_RecursiveDeref( p->dd, bVarCube );
|
||||
Cudd_RecursiveDeref( p->dd, bVarCube2 );
|
||||
}
|
||||
Cudd_RecursiveDeref( p->dd, bVarCube1 );
|
||||
}
|
||||
/*
|
||||
// check the compatibility of cofactors
|
||||
Counter = 0;
|
||||
for ( c1 = 0; c1 < 16; c1++ )
|
||||
{
|
||||
for ( c2 = 0; c2 <= c1; c2++ )
|
||||
printf( " " );
|
||||
for ( c2 = c1+1; c2 < 16; c2++ )
|
||||
{
|
||||
bRes = Cudd_bddAndAbstract( p->dd, bCofs[c1], bCofs[c2], bCube ); Cudd_Ref( bRes );
|
||||
if ( bRes == Cudd_ReadOne(p->dd) )
|
||||
{
|
||||
printf( "+" );
|
||||
Counter++;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf( " " );
|
||||
}
|
||||
Cudd_RecursiveDeref( p->dd, bRes );
|
||||
}
|
||||
printf( "\n" );
|
||||
}
|
||||
*/
|
||||
|
||||
vCofs = Vec_PtrAlloc( 16 );
|
||||
for ( v1 = 0; v1 < 4; v1++ )
|
||||
for ( v2 = 0; v2 < 4; v2++ )
|
||||
Vec_PtrPushUnique( vCofs, bCofs[v1 * 4 + v2] );
|
||||
printf( "%d ", Vec_PtrSize(vCofs) );
|
||||
Vec_PtrFree( vCofs );
|
||||
|
||||
// free the cofactors
|
||||
for ( v1 = 0; v1 < 4; v1++ )
|
||||
for ( v2 = 0; v2 < 4; v2++ )
|
||||
Cudd_RecursiveDeref( p->dd, bCofs[v1 * 4 + v2] );
|
||||
|
||||
printf( "\n" );
|
||||
// printf( "%2d, %2d : %3d\n", i1, i2, Counter );
|
||||
}
|
||||
}
|
||||
|
||||
Cudd_RecursiveDeref( p->dd, bCube );
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
/// END OF FILE ///
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
|
@ -48,12 +48,15 @@
|
|||
***********************************************************************/
|
||||
void Abc_NtkPrintStats( FILE * pFile, Abc_Ntk_t * pNtk, int fFactored )
|
||||
{
|
||||
int Num, Num2;
|
||||
int Num;//, Num2;
|
||||
|
||||
// Abc_NtkDetectMatching( pNtk );
|
||||
// return;
|
||||
fprintf( pFile, "%-13s:", pNtk->pName );
|
||||
fprintf( pFile, " i/o = %4d/%4d", Abc_NtkPiNum(pNtk), Abc_NtkPoNum(pNtk) );
|
||||
if ( Abc_NtkAssertNum(pNtk) )
|
||||
fprintf( pFile, " i/o/a = %4d/%4d/%4d", Abc_NtkPiNum(pNtk), Abc_NtkPoNum(pNtk), Abc_NtkAssertNum(pNtk) );
|
||||
else
|
||||
fprintf( pFile, " i/o = %4d/%4d", Abc_NtkPiNum(pNtk), Abc_NtkPoNum(pNtk) );
|
||||
|
||||
if ( !Abc_NtkIsSeq(pNtk) )
|
||||
fprintf( pFile, " lat = %4d", Abc_NtkLatchNum(pNtk) );
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ extern int Abc_NtkRewrite( Abc_Ntk_t * pNtk, int fUpdateLevel, int fUseZeros, i
|
|||
extern int Abc_NtkRefactor( Abc_Ntk_t * pNtk, int nNodeSizeMax, int nConeSizeMax, bool fUpdateLevel, bool fUseZeros, bool fUseDcs, bool fVerbose );
|
||||
extern Abc_Ntk_t * Abc_NtkFromFraig( Fraig_Man_t * pMan, Abc_Ntk_t * pNtk );
|
||||
|
||||
static Abc_Ntk_t * Abc_NtkMiterFraig( Abc_Ntk_t * pNtk, int nBTLimit, int * pRetValue, int * pNumFails );
|
||||
static Abc_Ntk_t * Abc_NtkMiterFraig( Abc_Ntk_t * pNtk, int nBTLimit, sint64 nInspLimit, int * pRetValue, int * pNumFails, sint64 * pNumConfs, sint64 * pNumInspects );
|
||||
static void Abc_NtkMiterPrint( Abc_Ntk_t * pNtk, char * pString, int clk, int fVerbose );
|
||||
|
||||
|
||||
|
|
@ -56,13 +56,14 @@ int Abc_NtkMiterProve( Abc_Ntk_t ** ppNtk, void * pPars )
|
|||
{
|
||||
Prove_Params_t * pParams = pPars;
|
||||
Abc_Ntk_t * pNtk, * pNtkTemp;
|
||||
int RetValue, nIter, Counter, clk, timeStart = clock();
|
||||
int RetValue, nIter, nSatFails, Counter, clk, timeStart = clock();
|
||||
sint64 nSatConfs, nSatInspects, nInspectLimit;
|
||||
|
||||
// get the starting network
|
||||
pNtk = *ppNtk;
|
||||
assert( Abc_NtkIsStrash(pNtk) );
|
||||
assert( Abc_NtkPoNum(pNtk) == 1 );
|
||||
|
||||
|
||||
if ( pParams->fVerbose )
|
||||
{
|
||||
printf( "RESOURCE LIMITS: Iterations = %d. Rewriting = %s. Fraiging = %s.\n",
|
||||
|
|
@ -79,7 +80,7 @@ int Abc_NtkMiterProve( Abc_Ntk_t ** ppNtk, void * pPars )
|
|||
if ( !pParams->fUseRewriting && !pParams->fUseFraiging )
|
||||
{
|
||||
clk = clock();
|
||||
RetValue = Abc_NtkMiterSat( pNtk, pParams->nMiteringLimitLast, 0, 0, 0 );
|
||||
RetValue = Abc_NtkMiterSat( pNtk, (sint64)pParams->nMiteringLimitLast, (sint64)0, 0, 0, NULL, NULL );
|
||||
Abc_NtkMiterPrint( pNtk, "SAT solving", clk, pParams->fVerbose );
|
||||
*ppNtk = pNtk;
|
||||
return RetValue;
|
||||
|
|
@ -98,11 +99,24 @@ int Abc_NtkMiterProve( Abc_Ntk_t ** ppNtk, void * pPars )
|
|||
|
||||
// try brute-force SAT
|
||||
clk = clock();
|
||||
RetValue = Abc_NtkMiterSat( pNtk, (int)(pParams->nMiteringLimitStart * pow(pParams->nMiteringLimitMulti,nIter)), 0, 0, 0 );
|
||||
nInspectLimit = pParams->nTotalInspectLimit? pParams->nTotalInspectLimit - pParams->nTotalInspectsMade : 0;
|
||||
RetValue = Abc_NtkMiterSat( pNtk, (sint64)(pParams->nMiteringLimitStart * pow(pParams->nMiteringLimitMulti,nIter)), (sint64)nInspectLimit, 0, 0, &nSatConfs, &nSatInspects );
|
||||
Abc_NtkMiterPrint( pNtk, "SAT solving", clk, pParams->fVerbose );
|
||||
if ( RetValue >= 0 )
|
||||
break;
|
||||
|
||||
// add to the number of backtracks and inspects
|
||||
pParams->nTotalBacktracksMade += nSatConfs;
|
||||
pParams->nTotalInspectsMade += nSatInspects;
|
||||
// check if global resource limit is reached
|
||||
if ( (pParams->nTotalBacktrackLimit && pParams->nTotalBacktracksMade >= pParams->nTotalBacktrackLimit) ||
|
||||
(pParams->nTotalInspectLimit && pParams->nTotalInspectsMade >= pParams->nTotalInspectLimit) )
|
||||
{
|
||||
printf( "Reached global limit on conflicts/inspects. Quitting.\n" );
|
||||
*ppNtk = pNtk;
|
||||
return -1;
|
||||
}
|
||||
|
||||
// try rewriting
|
||||
if ( pParams->fUseRewriting )
|
||||
{
|
||||
|
|
@ -131,18 +145,30 @@ int Abc_NtkMiterProve( Abc_Ntk_t ** ppNtk, void * pPars )
|
|||
|
||||
if ( pParams->fUseFraiging )
|
||||
{
|
||||
int nSatFails;
|
||||
// try FRAIGing
|
||||
clk = clock();
|
||||
pNtk = Abc_NtkMiterFraig( pNtkTemp = pNtk, (int)(pParams->nFraigingLimitStart * pow(pParams->nFraigingLimitMulti,nIter)), &RetValue, &nSatFails ); Abc_NtkDelete( pNtkTemp );
|
||||
nInspectLimit = pParams->nTotalInspectLimit? pParams->nTotalInspectLimit - pParams->nTotalInspectsMade : 0;
|
||||
pNtk = Abc_NtkMiterFraig( pNtkTemp = pNtk, (int)(pParams->nFraigingLimitStart * pow(pParams->nFraigingLimitMulti,nIter)), nInspectLimit, &RetValue, &nSatFails, &nSatConfs, &nSatInspects ); Abc_NtkDelete( pNtkTemp );
|
||||
Abc_NtkMiterPrint( pNtk, "FRAIGing ", clk, pParams->fVerbose );
|
||||
// printf( "NumFails = %d\n", nSatFails );
|
||||
if ( RetValue >= 0 )
|
||||
break;
|
||||
|
||||
// add to the number of backtracks and inspects
|
||||
pParams->nTotalBacktracksMade += nSatConfs;
|
||||
pParams->nTotalInspectsMade += nSatInspects;
|
||||
// check if global resource limit is reached
|
||||
if ( (pParams->nTotalBacktrackLimit && pParams->nTotalBacktracksMade >= pParams->nTotalBacktrackLimit) ||
|
||||
(pParams->nTotalInspectLimit && pParams->nTotalInspectsMade >= pParams->nTotalInspectLimit) )
|
||||
{
|
||||
printf( "Reached global limit on conflicts/inspects. Quitting.\n" );
|
||||
*ppNtk = pNtk;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
|
||||
// try to prove it using brute force SAT
|
||||
if ( RetValue < 0 && pParams->fUseBdds )
|
||||
{
|
||||
|
|
@ -162,7 +188,6 @@ int Abc_NtkMiterProve( Abc_Ntk_t ** ppNtk, void * pPars )
|
|||
pNtk = pNtkTemp;
|
||||
Abc_NtkMiterPrint( pNtk, "BDD building", clk, pParams->fVerbose );
|
||||
}
|
||||
*/
|
||||
|
||||
if ( RetValue < 0 )
|
||||
{
|
||||
|
|
@ -172,7 +197,8 @@ int Abc_NtkMiterProve( Abc_Ntk_t ** ppNtk, void * pPars )
|
|||
fflush( stdout );
|
||||
}
|
||||
clk = clock();
|
||||
RetValue = Abc_NtkMiterSat( pNtk, pParams->nMiteringLimitLast, 0, 0, 0 );
|
||||
nInspectLimit = pParams->nTotalInspectLimit? pParams->nTotalInspectLimit - pParams->nTotalInspectsMade : 0;
|
||||
RetValue = Abc_NtkMiterSat( pNtk, (sint64)pParams->nMiteringLimitLast, (sint64)nInspectLimit, 0, 0, NULL, NULL );
|
||||
Abc_NtkMiterPrint( pNtk, "SAT solving", clk, pParams->fVerbose );
|
||||
}
|
||||
|
||||
|
|
@ -197,7 +223,7 @@ int Abc_NtkMiterProve( Abc_Ntk_t ** ppNtk, void * pPars )
|
|||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
Abc_Ntk_t * Abc_NtkMiterFraig( Abc_Ntk_t * pNtk, int nBTLimit, int * pRetValue, int * pNumFails )
|
||||
Abc_Ntk_t * Abc_NtkMiterFraig( Abc_Ntk_t * pNtk, int nBTLimit, sint64 nInspLimit, int * pRetValue, int * pNumFails, sint64 * pNumConfs, sint64 * pNumInspects )
|
||||
{
|
||||
Abc_Ntk_t * pNtkNew;
|
||||
Fraig_Params_t Params, * pParams = &Params;
|
||||
|
|
@ -222,6 +248,7 @@ Abc_Ntk_t * Abc_NtkMiterFraig( Abc_Ntk_t * pNtk, int nBTLimit, int * pRetValue,
|
|||
pParams->fTryProve = 0; // do not try to prove the final miter
|
||||
pParams->fDoSparse = 1; // try proving sparse functions
|
||||
pParams->fVerbose = 0;
|
||||
pParams->nInspLimit = nInspLimit;
|
||||
|
||||
// transform the target into a fraig
|
||||
pMan = Abc_NtkToFraig( pNtk, pParams, 0, 0 );
|
||||
|
|
@ -243,6 +270,8 @@ Abc_Ntk_t * Abc_NtkMiterFraig( Abc_Ntk_t * pNtk, int nBTLimit, int * pRetValue,
|
|||
// save the return values
|
||||
*pRetValue = RetValue;
|
||||
*pNumFails = Fraig_ManReadSatFails( pMan );
|
||||
*pNumConfs = Fraig_ManReadConflicts( pMan );
|
||||
*pNumInspects = Fraig_ManReadInspects( pMan );
|
||||
|
||||
// delete the fraig manager
|
||||
Fraig_ManFree( pMan );
|
||||
|
|
|
|||
|
|
@ -111,6 +111,9 @@ int Abc_NtkRefactor( Abc_Ntk_t * pNtk, int nNodeSizeMax, int nConeSizeMax, bool
|
|||
// skip the constant node
|
||||
if ( Abc_NodeIsConst(pNode) )
|
||||
continue;
|
||||
// skip persistant nodes
|
||||
if ( Abc_NodeIsPersistant(pNode) )
|
||||
continue;
|
||||
// skip the nodes with many fanouts
|
||||
if ( Abc_ObjFanoutNum(pNode) > 1000 )
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -377,7 +377,7 @@ int Abc_NtkRenodeLimit( Abc_Obj_t * pNode, Vec_Ptr_t * vCone, int nFaninMax )
|
|||
***********************************************************************/
|
||||
void Abc_NtkRenodeSetBounds( Abc_Ntk_t * pNtk, int nThresh, int nFaninMax )
|
||||
{
|
||||
Vec_Ptr_t * vCone = pNtk->vPtrTemp;
|
||||
Vec_Ptr_t * vCone = Vec_PtrAlloc(10);
|
||||
Abc_Obj_t * pNode;
|
||||
int i, nFanouts, nConeSize;
|
||||
|
||||
|
|
@ -414,6 +414,7 @@ void Abc_NtkRenodeSetBounds( Abc_Ntk_t * pNtk, int nThresh, int nFaninMax )
|
|||
while ( Abc_NtkRenodeLimit(pNode, vCone, nFaninMax) );
|
||||
assert( vCone->nSize <= nFaninMax );
|
||||
}
|
||||
Vec_PtrFree(vCone);
|
||||
/*
|
||||
// make sure the fanin limit is met
|
||||
Abc_NtkForEachNode( pNtk, pNode, i )
|
||||
|
|
|
|||
|
|
@ -134,6 +134,9 @@ pManRst->timeCut += clock() - clk;
|
|||
// skip the constant node
|
||||
if ( Abc_NodeIsConst(pNode) )
|
||||
continue;
|
||||
// skip persistant nodes
|
||||
if ( Abc_NodeIsPersistant(pNode) )
|
||||
continue;
|
||||
// skip the node if it is inside the tree
|
||||
// if ( Abc_ObjFanoutNum(pNode) < 2 )
|
||||
// continue;
|
||||
|
|
|
|||
|
|
@ -160,6 +160,9 @@ int Abc_NtkResubstitute( Abc_Ntk_t * pNtk, int nCutMax, int nStepsMax, bool fUpd
|
|||
// skip the constant node
|
||||
if ( Abc_NodeIsConst(pNode) )
|
||||
continue;
|
||||
// skip persistant nodes
|
||||
if ( Abc_NodeIsPersistant(pNode) )
|
||||
continue;
|
||||
// skip the nodes with many fanouts
|
||||
if ( Abc_ObjFanoutNum(pNode) > 1000 )
|
||||
continue;
|
||||
|
|
@ -278,7 +281,7 @@ Abc_ManRes_t * Abc_ManResubStart( int nLeavesMax, int nDivsMax )
|
|||
pData = p->vSims->pArray[k];
|
||||
for ( i = 0; i < p->nBits; i++ )
|
||||
if ( i & (1 << k) )
|
||||
pData[i/32] |= (1 << (i%32));
|
||||
pData[i>>5] |= (1 << (i&31));
|
||||
}
|
||||
// create the remaining divisors
|
||||
p->vDivs1UP = Vec_PtrAlloc( p->nDivsMax );
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@
|
|||
|
||||
static Cut_Man_t * Abc_NtkStartCutManForRewrite( Abc_Ntk_t * pNtk );
|
||||
static void Abc_NodePrintCuts( Abc_Obj_t * pNode );
|
||||
static void Abc_ManShowCutCone( Abc_Obj_t * pNode, Vec_Ptr_t * vLeaves );
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
/// FUNCTION DEFINITIONS ///
|
||||
|
|
@ -87,15 +88,39 @@ Rwr_ManAddTimeCuts( pManRwr, clock() - clk );
|
|||
// skip the constant node
|
||||
if ( Abc_NodeIsConst(pNode) )
|
||||
continue;
|
||||
// skip persistant nodes
|
||||
if ( Abc_NodeIsPersistant(pNode) )
|
||||
continue;
|
||||
// skip the nodes with many fanouts
|
||||
if ( Abc_ObjFanoutNum(pNode) > 1000 )
|
||||
continue;
|
||||
//printf( "*******Node %d: \n", pNode->Id );
|
||||
|
||||
// for each cut, try to resynthesize it
|
||||
nGain = Rwr_NodeRewrite( pManRwr, pManCut, pNode, fUpdateLevel, fUseZeros );
|
||||
if ( nGain > 0 || nGain == 0 && fUseZeros )
|
||||
{
|
||||
// extern void Abc_RwrExpWithCut( Abc_Obj_t * pNode, Vec_Ptr_t * vLeaves );
|
||||
|
||||
Dec_Graph_t * pGraph = Rwr_ManReadDecs(pManRwr);
|
||||
int fCompl = Rwr_ManReadCompl(pManRwr);
|
||||
|
||||
// Abc_RwrExpWithCut( pNode, Rwr_ManReadLeaves(pManRwr) );
|
||||
|
||||
/*
|
||||
{
|
||||
Abc_Obj_t * pObj;
|
||||
int i;
|
||||
printf( "USING: (" );
|
||||
Vec_PtrForEachEntry( Rwr_ManReadLeaves(pManRwr), pObj, i )
|
||||
printf( "%d ", Abc_ObjFanoutNum(Abc_ObjRegular(pObj)) );
|
||||
printf( ") Gain = %d.\n", nGain );
|
||||
}
|
||||
*/
|
||||
|
||||
// if ( nGain > 0 )
|
||||
// Abc_ManShowCutCone( pNode, Rwr_ManReadLeaves(pManRwr) );
|
||||
|
||||
/*
|
||||
if ( nGain > 0 )
|
||||
{ // print stats on the MFFC
|
||||
|
|
@ -209,6 +234,163 @@ void Abc_NodePrintCuts( Abc_Obj_t * pNode )
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis []
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void Abc_ManRewritePrintDivs( Vec_Ptr_t * vDivs, int nLeaves )
|
||||
{
|
||||
Abc_Obj_t * pFanin, * pNode, * pRoot;
|
||||
int i, k;
|
||||
pRoot = Vec_PtrEntryLast(vDivs);
|
||||
// print the nodes
|
||||
Vec_PtrForEachEntry( vDivs, pNode, i )
|
||||
{
|
||||
if ( i < nLeaves )
|
||||
{
|
||||
printf( "%6d : %c\n", pNode->Id, 'a'+i );
|
||||
continue;
|
||||
}
|
||||
printf( "%6d : %2d = ", pNode->Id, i );
|
||||
// find the first fanin
|
||||
Vec_PtrForEachEntry( vDivs, pFanin, k )
|
||||
if ( Abc_ObjFanin0(pNode) == pFanin )
|
||||
break;
|
||||
if ( k < nLeaves )
|
||||
printf( "%c", 'a' + k );
|
||||
else
|
||||
printf( "%d", k );
|
||||
printf( "%s ", Abc_ObjFaninC0(pNode)? "\'" : "" );
|
||||
// find the second fanin
|
||||
Vec_PtrForEachEntry( vDivs, pFanin, k )
|
||||
if ( Abc_ObjFanin1(pNode) == pFanin )
|
||||
break;
|
||||
if ( k < nLeaves )
|
||||
printf( "%c", 'a' + k );
|
||||
else
|
||||
printf( "%d", k );
|
||||
printf( "%s ", Abc_ObjFaninC1(pNode)? "\'" : "" );
|
||||
if ( pNode == pRoot )
|
||||
printf( " root" );
|
||||
printf( "\n" );
|
||||
}
|
||||
printf( "\n" );
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis []
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void Abc_ManShowCutCone_rec( Abc_Obj_t * pNode, Vec_Ptr_t * vDivs )
|
||||
{
|
||||
if ( Abc_NodeIsTravIdCurrent(pNode) )
|
||||
return;
|
||||
Abc_NodeSetTravIdCurrent(pNode);
|
||||
Abc_ManShowCutCone_rec( Abc_ObjFanin0(pNode), vDivs );
|
||||
Abc_ManShowCutCone_rec( Abc_ObjFanin1(pNode), vDivs );
|
||||
Vec_PtrPush( vDivs, pNode );
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis []
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void Abc_ManShowCutCone( Abc_Obj_t * pNode, Vec_Ptr_t * vLeaves )
|
||||
{
|
||||
Abc_Ntk_t * pNtk = pNode->pNtk;
|
||||
Abc_Obj_t * pObj;
|
||||
Vec_Ptr_t * vDivs;
|
||||
int i;
|
||||
vDivs = Vec_PtrAlloc( 100 );
|
||||
Abc_NtkIncrementTravId( pNtk );
|
||||
Vec_PtrForEachEntry( vLeaves, pObj, i )
|
||||
{
|
||||
Abc_NodeSetTravIdCurrent( Abc_ObjRegular(pObj) );
|
||||
Vec_PtrPush( vDivs, Abc_ObjRegular(pObj) );
|
||||
}
|
||||
Abc_ManShowCutCone_rec( pNode, vDivs );
|
||||
Abc_ManRewritePrintDivs( vDivs, Vec_PtrSize(vLeaves) );
|
||||
Vec_PtrFree( vDivs );
|
||||
}
|
||||
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis []
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void Abc_RwrExpWithCut_rec( Abc_Obj_t * pNode, Vec_Ptr_t * vLeaves, int fUseA )
|
||||
{
|
||||
if ( Vec_PtrFind(vLeaves, pNode) >= 0 || Vec_PtrFind(vLeaves, Abc_ObjNot(pNode)) >= 0 )
|
||||
{
|
||||
if ( fUseA )
|
||||
Abc_ObjRegular(pNode)->fMarkA = 1;
|
||||
else
|
||||
Abc_ObjRegular(pNode)->fMarkB = 1;
|
||||
return;
|
||||
}
|
||||
assert( Abc_ObjIsNode(pNode) );
|
||||
Abc_RwrExpWithCut_rec( Abc_ObjFanin0(pNode), vLeaves, fUseA );
|
||||
Abc_RwrExpWithCut_rec( Abc_ObjFanin1(pNode), vLeaves, fUseA );
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis []
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void Abc_RwrExpWithCut( Abc_Obj_t * pNode, Vec_Ptr_t * vLeaves )
|
||||
{
|
||||
Abc_Obj_t * pObj;
|
||||
int i, CountA, CountB;
|
||||
Abc_RwrExpWithCut_rec( Abc_ObjFanin0(pNode), vLeaves, 1 );
|
||||
Abc_RwrExpWithCut_rec( Abc_ObjFanin1(pNode), vLeaves, 0 );
|
||||
CountA = CountB = 0;
|
||||
Vec_PtrForEachEntry( vLeaves, pObj, i )
|
||||
{
|
||||
CountA += Abc_ObjRegular(pObj)->fMarkA;
|
||||
CountB += Abc_ObjRegular(pObj)->fMarkB;
|
||||
Abc_ObjRegular(pObj)->fMarkA = 0;
|
||||
Abc_ObjRegular(pObj)->fMarkB = 0;
|
||||
}
|
||||
printf( "(%d,%d:%d) ", CountA, CountB, CountA+CountB-Vec_PtrSize(vLeaves) );
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
/// END OF FILE ///
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -105,6 +105,9 @@ int Abc_NtkRR( Abc_Ntk_t * pNtk, int nFaninLevels, int nFanoutLevels, int fUseFa
|
|||
p->nFanoutLevels = nFanoutLevels;
|
||||
p->nNodesOld = Abc_NtkNodeNum(pNtk);
|
||||
p->nLevelsOld = Abc_AigGetLevelNum(pNtk);
|
||||
// remember latch values
|
||||
Abc_NtkForEachLatch( pNtk, pNode, i )
|
||||
pNode->pNext = pNode->pData;
|
||||
// go through the nodes
|
||||
Abc_NtkCleanCopy(pNtk);
|
||||
nNodes = Abc_NtkObjNumMax(pNtk);
|
||||
|
|
@ -119,6 +122,9 @@ int Abc_NtkRR( Abc_Ntk_t * pNtk, int nFaninLevels, int nFanoutLevels, int fUseFa
|
|||
// skip the constant node
|
||||
if ( Abc_NodeIsConst(pNode) )
|
||||
continue;
|
||||
// skip persistant nodes
|
||||
if ( Abc_NodeIsPersistant(pNode) )
|
||||
continue;
|
||||
// skip the nodes with many fanouts
|
||||
if ( Abc_ObjFanoutNum(pNode) > 1000 )
|
||||
continue;
|
||||
|
|
@ -209,6 +215,9 @@ int Abc_NtkRR( Abc_Ntk_t * pNtk, int nFaninLevels, int nFanoutLevels, int fUseFa
|
|||
if ( fVerbose )
|
||||
Abc_RRManPrintStats( p );
|
||||
Abc_RRManStop( p );
|
||||
// restore latch values
|
||||
Abc_NtkForEachLatch( pNtk, pNode, i )
|
||||
pNode->pData = pNode->pNext, pNode->pNext = NULL;
|
||||
// put the nodes into the DFS order and reassign their IDs
|
||||
Abc_NtkReassignIds( pNtk );
|
||||
Abc_NtkGetLevelNum( pNtk );
|
||||
|
|
@ -692,6 +701,7 @@ Abc_Ntk_t * Abc_NtkWindow( Abc_Ntk_t * pNtk, Vec_Ptr_t * vLeaves, Vec_Ptr_t * vC
|
|||
// add the PI/PO names
|
||||
Abc_NtkAddDummyPiNames( pNtkNew );
|
||||
Abc_NtkAddDummyPoNames( pNtkNew );
|
||||
Abc_NtkAddDummyAssertNames( pNtkNew );
|
||||
// check
|
||||
if ( fCheck && !Abc_NtkCheck( pNtkNew ) )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -42,12 +42,17 @@ static nMuxes;
|
|||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
int Abc_NtkMiterSat( Abc_Ntk_t * pNtk, int nConfLimit, int nImpLimit, int fJFront, int fVerbose )
|
||||
int Abc_NtkMiterSat( Abc_Ntk_t * pNtk, sint64 nConfLimit, sint64 nInsLimit, int fJFront, int fVerbose, sint64 * pNumConfs, sint64 * pNumInspects )
|
||||
{
|
||||
solver * pSat;
|
||||
lbool status;
|
||||
int RetValue, clk;
|
||||
|
||||
if ( pNumConfs )
|
||||
*pNumConfs = 0;
|
||||
if ( pNumInspects )
|
||||
*pNumInspects = 0;
|
||||
|
||||
assert( Abc_NtkIsStrash(pNtk) );
|
||||
assert( Abc_NtkLatchNum(pNtk) == 0 );
|
||||
|
||||
|
|
@ -78,7 +83,7 @@ int Abc_NtkMiterSat( Abc_Ntk_t * pNtk, int nConfLimit, int nImpLimit, int fJFron
|
|||
clk = clock();
|
||||
if ( fVerbose )
|
||||
pSat->verbosity = 1;
|
||||
status = solver_solve( pSat, NULL, NULL, nConfLimit, nImpLimit );
|
||||
status = solver_solve( pSat, NULL, NULL, (sint64)nConfLimit, (sint64)nInsLimit );
|
||||
if ( status == l_Undef )
|
||||
{
|
||||
// printf( "The problem timed out.\n" );
|
||||
|
|
@ -97,6 +102,7 @@ int Abc_NtkMiterSat( Abc_Ntk_t * pNtk, int nConfLimit, int nImpLimit, int fJFron
|
|||
else
|
||||
assert( 0 );
|
||||
// PRT( "SAT solver time", clock() - clk );
|
||||
// printf( "The number of conflicts = %d.\n", (int)pSat->solver_stats.conflicts );
|
||||
|
||||
// if the problem is SAT, get the counterexample
|
||||
if ( status == l_True )
|
||||
|
|
@ -109,6 +115,12 @@ int Abc_NtkMiterSat( Abc_Ntk_t * pNtk, int nConfLimit, int nImpLimit, int fJFron
|
|||
// free the solver
|
||||
if ( fVerbose )
|
||||
Asat_SatPrintStats( stdout, pSat );
|
||||
|
||||
if ( pNumConfs )
|
||||
*pNumConfs = (int)pSat->solver_stats.conflicts;
|
||||
if ( pNumInspects )
|
||||
*pNumInspects = (int)pSat->solver_stats.inspects;
|
||||
|
||||
solver_delete( pSat );
|
||||
return RetValue;
|
||||
}
|
||||
|
|
@ -401,6 +413,7 @@ int Abc_NtkMiterSatCreateInt( solver * pSat, Abc_Ntk_t * pNtk, int fJFront )
|
|||
Vec_Vec_t * vCircuit;
|
||||
int i, k, fUseMuxes = 1;
|
||||
int clk1 = clock(), clk;
|
||||
int fOrderCiVarsFirst = 0;
|
||||
|
||||
assert( Abc_NtkIsStrash(pNtk) );
|
||||
|
||||
|
|
@ -431,6 +444,7 @@ int Abc_NtkMiterSatCreateInt( solver * pSat, Abc_Ntk_t * pNtk, int fJFront )
|
|||
Vec_PtrPush( vNodes, pNode );
|
||||
}
|
||||
*/
|
||||
|
||||
// collect the nodes that need clauses and top-level assignments
|
||||
Abc_NtkForEachCo( pNtk, pNode, i )
|
||||
{
|
||||
|
|
@ -526,6 +540,21 @@ int Abc_NtkMiterSatCreateInt( solver * pSat, Abc_Ntk_t * pNtk, int fJFront )
|
|||
}
|
||||
}
|
||||
|
||||
// set preferred variables
|
||||
if ( fOrderCiVarsFirst )
|
||||
{
|
||||
int * pPrefVars = ALLOC( int, Abc_NtkCiNum(pNtk) );
|
||||
int nVars = 0;
|
||||
Abc_NtkForEachCi( pNtk, pNode, i )
|
||||
{
|
||||
if ( pNode->fMarkA == 0 )
|
||||
continue;
|
||||
pPrefVars[nVars++] = (int)pNode->pCopy;
|
||||
}
|
||||
nVars = ABC_MIN( nVars, 10 );
|
||||
Asat_SolverSetPrefVars( pSat, pPrefVars, nVars );
|
||||
}
|
||||
|
||||
// create the variable order
|
||||
if ( fJFront )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -571,12 +571,13 @@ int Abc_NtkSweep( Abc_Ntk_t * pNtk, int fVerbose )
|
|||
***********************************************************************/
|
||||
void Abc_NodeSweep( Abc_Obj_t * pNode, int fVerbose )
|
||||
{
|
||||
Vec_Ptr_t * vFanout = pNode->pNtk->vPtrTemp;
|
||||
Abc_Obj_t * pFanout, * pDriver;
|
||||
Vec_Ptr_t * vFanout;
|
||||
int i;
|
||||
assert( Abc_ObjFaninNum(pNode) < 2 );
|
||||
assert( Abc_ObjFanoutNum(pNode) > 0 );
|
||||
// iterate through the fanouts
|
||||
vFanout = Vec_PtrAlloc( Abc_ObjFanoutNum(pNode) );
|
||||
Abc_NodeCollectFanouts( pNode, vFanout );
|
||||
Vec_PtrForEachEntry( vFanout, pFanout, i )
|
||||
{
|
||||
|
|
@ -607,6 +608,7 @@ void Abc_NodeSweep( Abc_Obj_t * pNode, int fVerbose )
|
|||
Abc_ObjPatchFanin( pFanout, pNode, pDriver );
|
||||
}
|
||||
}
|
||||
Vec_PtrFree( vFanout );
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ void Abc_HManStart()
|
|||
pData = p->vSims->pArray[k];
|
||||
for ( i = 0; i < p->nBits; i++ )
|
||||
if ( i & (1 << k) )
|
||||
pData[i/32] |= (1 << (i%32));
|
||||
pData[i>>5] |= (1 << (i&31));
|
||||
}
|
||||
// allocate storage for the nodes
|
||||
p->pMmObj = Extra_MmFixedStart( sizeof(Abc_HObj_t) );
|
||||
|
|
|
|||
|
|
@ -544,8 +544,6 @@ Abc_Ntk_t * Abc_NtkVanEijkFrames( Abc_Ntk_t * pNtk, Vec_Ptr_t * vCorresp, int nF
|
|||
{
|
||||
pLatchNew = Abc_NtkLatch(pNtkFrames, i);
|
||||
Abc_ObjAddFanin( pLatchNew, pLatch->pCopy );
|
||||
Vec_PtrPush( pNtkFrames->vCis, pLatchNew );
|
||||
Vec_PtrPush( pNtkFrames->vCos, pLatchNew );
|
||||
Abc_NtkLogicStoreName( pLatchNew, Abc_ObjName(pLatch) );
|
||||
pLatch->pNext = NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ static void Abc_NtkVerifyReportErrorSeq( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2,
|
|||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void Abc_NtkCecSat( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int nConfLimit, int nImpLimit )
|
||||
void Abc_NtkCecSat( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int nConfLimit, int nInsLimit )
|
||||
{
|
||||
Abc_Ntk_t * pMiter;
|
||||
Abc_Ntk_t * pCnf;
|
||||
|
|
@ -85,7 +85,7 @@ void Abc_NtkCecSat( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int nConfLimit, int nI
|
|||
}
|
||||
|
||||
// solve the CNF using the SAT solver
|
||||
RetValue = Abc_NtkMiterSat( pCnf, nConfLimit, nImpLimit, 0, 0 );
|
||||
RetValue = Abc_NtkMiterSat( pCnf, (sint64)nConfLimit, (sint64)nInsLimit, 0, 0, NULL, NULL );
|
||||
if ( RetValue == -1 )
|
||||
printf( "Networks are undecided (SAT solver timed out).\n" );
|
||||
else if ( RetValue == 0 )
|
||||
|
|
@ -178,7 +178,14 @@ void Abc_NtkCecFraig( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int nSeconds, int fV
|
|||
if ( RetValue == -1 )
|
||||
printf( "Networks are undecided (resource limits is reached).\n" );
|
||||
else if ( RetValue == 0 )
|
||||
printf( "Networks are NOT EQUIVALENT.\n" );
|
||||
{
|
||||
int * pSimInfo = Abc_NtkVerifySimulatePattern( pMiter, pMiter->pModel );
|
||||
if ( pSimInfo[0] != 1 )
|
||||
printf( "ERROR in Abc_NtkMiterProve(): Generated counter-example is invalid.\n" );
|
||||
else
|
||||
printf( "Networks are NOT EQUIVALENT.\n" );
|
||||
free( pSimInfo );
|
||||
}
|
||||
else
|
||||
printf( "Networks are equivalent.\n" );
|
||||
if ( pMiter->pModel )
|
||||
|
|
@ -197,7 +204,7 @@ void Abc_NtkCecFraig( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int nSeconds, int fV
|
|||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void Abc_NtkSecSat( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int nConfLimit, int nImpLimit, int nFrames )
|
||||
void Abc_NtkSecSat( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int nConfLimit, int nInsLimit, int nFrames )
|
||||
{
|
||||
Abc_Ntk_t * pMiter;
|
||||
Abc_Ntk_t * pFrames;
|
||||
|
|
@ -257,7 +264,7 @@ void Abc_NtkSecSat( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int nConfLimit, int nI
|
|||
}
|
||||
|
||||
// solve the CNF using the SAT solver
|
||||
RetValue = Abc_NtkMiterSat( pCnf, nConfLimit, nImpLimit, 0, 0 );
|
||||
RetValue = Abc_NtkMiterSat( pCnf, (sint64)nConfLimit, (sint64)nInsLimit, 0, 0, NULL, NULL );
|
||||
if ( RetValue == -1 )
|
||||
printf( "Networks are undecided (SAT solver timed out).\n" );
|
||||
else if ( RetValue == 0 )
|
||||
|
|
@ -709,6 +716,52 @@ void Abc_NtkVerifyReportErrorSeq( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int * pM
|
|||
if ( fRemove2 ) Abc_NtkDelete( pNtk2 );
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Simulates buggy miter emailed by Mike.]
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void Abc_NtkSimulteBuggyMiter( Abc_Ntk_t * pNtk )
|
||||
{
|
||||
Abc_Obj_t * pObj;
|
||||
int i;
|
||||
int * pModel1, * pModel2, * pResult1, * pResult2;
|
||||
char * vPiValues1 = "01001011100000000011010110101000000";
|
||||
char * vPiValues2 = "11001101011101011111110100100010001";
|
||||
|
||||
assert( strlen(vPiValues1) == (unsigned)Abc_NtkPiNum(pNtk) );
|
||||
assert( 1 == Abc_NtkPoNum(pNtk) );
|
||||
|
||||
pModel1 = ALLOC( int, Abc_NtkCiNum(pNtk) );
|
||||
Abc_NtkForEachPi( pNtk, pObj, i )
|
||||
pModel1[i] = vPiValues1[i] - '0';
|
||||
Abc_NtkForEachLatch( pNtk, pObj, i )
|
||||
pModel1[Abc_NtkPiNum(pNtk)+i] = ((int)pObj->pData) - 1;
|
||||
|
||||
pResult1 = Abc_NtkVerifySimulatePattern( pNtk, pModel1 );
|
||||
printf( "Value = %d\n", pResult1[0] );
|
||||
|
||||
pModel2 = ALLOC( int, Abc_NtkCiNum(pNtk) );
|
||||
Abc_NtkForEachPi( pNtk, pObj, i )
|
||||
pModel2[i] = vPiValues2[i] - '0';
|
||||
Abc_NtkForEachLatch( pNtk, pObj, i )
|
||||
pModel2[Abc_NtkPiNum(pNtk)+i] = pResult1[Abc_NtkPoNum(pNtk)+i];
|
||||
|
||||
pResult2 = Abc_NtkVerifySimulatePattern( pNtk, pModel2 );
|
||||
printf( "Value = %d\n", pResult2[0] );
|
||||
|
||||
free( pModel1 );
|
||||
free( pModel2 );
|
||||
free( pResult1 );
|
||||
free( pResult2 );
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
/// END OF FILE ///
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ SRC += src/base/abci/abc.c \
|
|||
src/base/abci/abcFraig.c \
|
||||
src/base/abci/abcFxu.c \
|
||||
src/base/abci/abcGen.c \
|
||||
src/base/abci/abcIvy.c \
|
||||
src/base/abci/abcMap.c \
|
||||
src/base/abci/abcMiter.c \
|
||||
src/base/abci/abcNtbdd.c \
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ extern Abc_Ntk_t * Io_ReadPla( char * pFileName, int fCheck );
|
|||
/*=== abcUtil.c ==========================================================*/
|
||||
extern Abc_Obj_t * Io_ReadCreatePi( Abc_Ntk_t * pNtk, char * pName );
|
||||
extern Abc_Obj_t * Io_ReadCreatePo( Abc_Ntk_t * pNtk, char * pName );
|
||||
extern Abc_Obj_t * Io_ReadCreateAssert( Abc_Ntk_t * pNtk, char * pName );
|
||||
extern Abc_Obj_t * Io_ReadCreateLatch( Abc_Ntk_t * pNtk, char * pNetLI, char * pNetLO );
|
||||
extern Abc_Obj_t * Io_ReadCreateNode( Abc_Ntk_t * pNtk, char * pNameOut, char * pNamesIn[], int nInputs );
|
||||
extern Abc_Obj_t * Io_ReadCreateConst( Abc_Ntk_t * pNtk, char * pName, bool fConst1 );
|
||||
|
|
|
|||
|
|
@ -100,8 +100,6 @@ Abc_Ntk_t * Io_ReadBaf( char * pFileName, int fCheck )
|
|||
pObj = Abc_NtkCreateLatch(pNtkNew);
|
||||
Abc_NtkLogicStoreName( pObj, pCur ); while ( *pCur++ );
|
||||
Vec_PtrPush( vNodes, pObj );
|
||||
Vec_PtrPush( pNtkNew->vCis, pObj );
|
||||
Vec_PtrPush( pNtkNew->vCos, pObj );
|
||||
}
|
||||
|
||||
// get the pointer to the beginning of the node array
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ struct Io_ReadBlif_t_
|
|||
char * pFileName; // the name of the file
|
||||
Extra_FileReader_t * pReader; // the input file reader
|
||||
// current processing info
|
||||
Abc_Ntk_t * pNtkMaster; // the primary network
|
||||
Abc_Ntk_t * pNtkCur; // the primary network
|
||||
int LineCur; // the line currently parsed
|
||||
// temporary storage for tokens
|
||||
|
|
@ -54,6 +55,7 @@ static Abc_Ntk_t * Io_ReadBlifNetwork( Io_ReadBlif_t * p );
|
|||
static Abc_Ntk_t * Io_ReadBlifNetworkOne( Io_ReadBlif_t * p );
|
||||
static int Io_ReadBlifNetworkInputs( Io_ReadBlif_t * p, Vec_Ptr_t * vTokens );
|
||||
static int Io_ReadBlifNetworkOutputs( Io_ReadBlif_t * p, Vec_Ptr_t * vTokens );
|
||||
static int Io_ReadBlifNetworkAsserts( Io_ReadBlif_t * p, Vec_Ptr_t * vTokens );
|
||||
static int Io_ReadBlifNetworkLatch( Io_ReadBlif_t * p, Vec_Ptr_t * vTokens );
|
||||
static int Io_ReadBlifNetworkNames( Io_ReadBlif_t * p, Vec_Ptr_t ** pvTokens );
|
||||
static int Io_ReadBlifNetworkGate( Io_ReadBlif_t * p, Vec_Ptr_t * vTokens );
|
||||
|
|
@ -151,7 +153,7 @@ Abc_Ntk_t * Io_ReadBlifNetwork( Io_ReadBlif_t * p )
|
|||
// add this network as part of the hierarchy
|
||||
if ( pNtkMaster == NULL ) // no master network so far
|
||||
{
|
||||
pNtkMaster = pNtk;
|
||||
p->pNtkMaster = pNtkMaster = pNtk;
|
||||
continue;
|
||||
}
|
||||
// make sure hierarchy does not have the network with this name
|
||||
|
|
@ -222,11 +224,12 @@ Abc_Ntk_t * Io_ReadBlifNetworkOne( Io_ReadBlif_t * p )
|
|||
}
|
||||
|
||||
// read the inputs/outputs
|
||||
if ( p->pNtkMaster == NULL )
|
||||
pProgress = Extra_ProgressBarStart( stdout, Extra_FileReaderGetFileSize(p->pReader) );
|
||||
fTokensReady = fStatus = 0;
|
||||
for ( iLine = 0; fTokensReady || (p->vTokens = Io_ReadBlifGetTokens(p)); iLine++ )
|
||||
{
|
||||
if ( iLine % 1000 == 0 )
|
||||
if ( p->pNtkMaster == NULL && iLine % 1000 == 0 )
|
||||
Extra_ProgressBarUpdate( pProgress, Extra_FileReaderGetCurPosition(p->pReader), NULL );
|
||||
|
||||
// consider different line types
|
||||
|
|
@ -242,6 +245,8 @@ Abc_Ntk_t * Io_ReadBlifNetworkOne( Io_ReadBlif_t * p )
|
|||
fStatus = Io_ReadBlifNetworkInputs( p, p->vTokens );
|
||||
else if ( !strcmp( pDirective, ".outputs" ) )
|
||||
fStatus = Io_ReadBlifNetworkOutputs( p, p->vTokens );
|
||||
else if ( !strcmp( pDirective, ".asserts" ) )
|
||||
fStatus = Io_ReadBlifNetworkAsserts( p, p->vTokens );
|
||||
else if ( !strcmp( pDirective, ".input_arrival" ) )
|
||||
fStatus = Io_ReadBlifNetworkInputArrival( p, p->vTokens );
|
||||
else if ( !strcmp( pDirective, ".default_input_arrival" ) )
|
||||
|
|
@ -257,8 +262,10 @@ Abc_Ntk_t * Io_ReadBlifNetworkOne( Io_ReadBlif_t * p )
|
|||
}
|
||||
else if ( !strcmp( pDirective, ".blackbox" ) )
|
||||
{
|
||||
pNtk->ntkType = ABC_NTK_BLACKBOX;
|
||||
pNtk->ntkType = ABC_NTK_NETLIST;
|
||||
pNtk->ntkFunc = ABC_FUNC_BLACKBOX;
|
||||
Extra_MmFlexStop( pNtk->pManFunc, 0 );
|
||||
pNtk->pManFunc = NULL;
|
||||
}
|
||||
else
|
||||
printf( "%s (line %d): Skipping directive \"%s\".\n", p->pFileName,
|
||||
|
|
@ -268,6 +275,7 @@ Abc_Ntk_t * Io_ReadBlifNetworkOne( Io_ReadBlif_t * p )
|
|||
if ( fStatus == 1 )
|
||||
return NULL;
|
||||
}
|
||||
if ( p->pNtkMaster == NULL )
|
||||
Extra_ProgressBarStop( pProgress );
|
||||
return pNtk;
|
||||
}
|
||||
|
|
@ -310,6 +318,25 @@ int Io_ReadBlifNetworkOutputs( Io_ReadBlif_t * p, Vec_Ptr_t * vTokens )
|
|||
return 0;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis []
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
int Io_ReadBlifNetworkAsserts( Io_ReadBlif_t * p, Vec_Ptr_t * vTokens )
|
||||
{
|
||||
int i;
|
||||
for ( i = 1; i < vTokens->nSize; i++ )
|
||||
Io_ReadCreateAssert( p->pNtkCur, vTokens->pArray[i] );
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis []
|
||||
|
|
@ -340,7 +367,7 @@ int Io_ReadBlifNetworkLatch( Io_ReadBlif_t * p, Vec_Ptr_t * vTokens )
|
|||
Abc_LatchSetInitDc( pLatch );
|
||||
else
|
||||
{
|
||||
ResetValue = atoi(vTokens->pArray[3]);
|
||||
ResetValue = atoi(vTokens->pArray[vTokens->nSize-1]);
|
||||
if ( ResetValue != 0 && ResetValue != 1 && ResetValue != 2 )
|
||||
{
|
||||
p->LineCur = Extra_FileReaderGetLineNumber(p->pReader, 0);
|
||||
|
|
@ -870,50 +897,55 @@ int Io_ReadBlifNetworkConnectBoxesOneBox( Io_ReadBlif_t * p, Abc_Obj_t * pBox, s
|
|||
// create the fanins of the box
|
||||
Abc_NtkForEachPi( pNtkModel, pObj, i )
|
||||
pObj->pCopy = NULL;
|
||||
Vec_PtrForEachEntryStart( pNames, pName, i, 1 )
|
||||
if ( Abc_NtkPiNum(pNtkModel) == 0 )
|
||||
Start = 1;
|
||||
else
|
||||
{
|
||||
pActual = Io_ReadBlifCleanName(pName);
|
||||
if ( pActual == NULL )
|
||||
Vec_PtrForEachEntryStart( pNames, pName, i, 1 )
|
||||
{
|
||||
p->LineCur = (int)pBox->pCopy;
|
||||
sprintf( p->sError, "Cannot parse formal/actual name pair \"%s\".", pName );
|
||||
Io_ReadBlifPrintErrorMessage( p );
|
||||
return 1;
|
||||
}
|
||||
Length = pActual - pName - 1;
|
||||
pName[Length] = 0;
|
||||
// find the PI net with this name
|
||||
pObj = Abc_NtkFindNet( pNtkModel, pName );
|
||||
if ( pObj == NULL )
|
||||
{
|
||||
p->LineCur = (int)pBox->pCopy;
|
||||
sprintf( p->sError, "Cannot find formal input \"%s\" as an PI of model \"%s\".", pName, Vec_PtrEntry(pNames, 0) );
|
||||
Io_ReadBlifPrintErrorMessage( p );
|
||||
return 1;
|
||||
}
|
||||
// get the PI
|
||||
pObj = Abc_ObjFanin0(pObj);
|
||||
// quit if this is not a PI net
|
||||
if ( !Abc_ObjIsPi(pObj) )
|
||||
{
|
||||
pName[Length] = '=';
|
||||
Start = i;
|
||||
break;
|
||||
}
|
||||
// remember the actual name in the net
|
||||
if ( pObj->pCopy != NULL )
|
||||
{
|
||||
p->LineCur = (int)pBox->pCopy;
|
||||
sprintf( p->sError, "Formal input \"%s\" is used more than once.", pName );
|
||||
Io_ReadBlifPrintErrorMessage( p );
|
||||
return 1;
|
||||
}
|
||||
pObj->pCopy = (void *)pActual;
|
||||
// quit if we processed all PIs
|
||||
if ( i == Abc_NtkPiNum(pNtkModel) )
|
||||
{
|
||||
Start = i+1;
|
||||
break;
|
||||
pActual = Io_ReadBlifCleanName(pName);
|
||||
if ( pActual == NULL )
|
||||
{
|
||||
p->LineCur = (int)pBox->pCopy;
|
||||
sprintf( p->sError, "Cannot parse formal/actual name pair \"%s\".", pName );
|
||||
Io_ReadBlifPrintErrorMessage( p );
|
||||
return 1;
|
||||
}
|
||||
Length = pActual - pName - 1;
|
||||
pName[Length] = 0;
|
||||
// find the PI net with this name
|
||||
pObj = Abc_NtkFindNet( pNtkModel, pName );
|
||||
if ( pObj == NULL )
|
||||
{
|
||||
p->LineCur = (int)pBox->pCopy;
|
||||
sprintf( p->sError, "Cannot find formal input \"%s\" as an PI of model \"%s\".", pName, Vec_PtrEntry(pNames, 0) );
|
||||
Io_ReadBlifPrintErrorMessage( p );
|
||||
return 1;
|
||||
}
|
||||
// get the PI
|
||||
pObj = Abc_ObjFanin0(pObj);
|
||||
// quit if this is not a PI net
|
||||
if ( !Abc_ObjIsPi(pObj) )
|
||||
{
|
||||
pName[Length] = '=';
|
||||
Start = i;
|
||||
break;
|
||||
}
|
||||
// remember the actual name in the net
|
||||
if ( pObj->pCopy != NULL )
|
||||
{
|
||||
p->LineCur = (int)pBox->pCopy;
|
||||
sprintf( p->sError, "Formal input \"%s\" is used more than once.", pName );
|
||||
Io_ReadBlifPrintErrorMessage( p );
|
||||
return 1;
|
||||
}
|
||||
pObj->pCopy = (void *)pActual;
|
||||
// quit if we processed all PIs
|
||||
if ( i == Abc_NtkPiNum(pNtkModel) )
|
||||
{
|
||||
Start = i+1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// create the fanins of the box
|
||||
|
|
@ -986,6 +1018,8 @@ int Io_ReadBlifNetworkConnectBoxesOneBox( Io_ReadBlif_t * p, Abc_Obj_t * pBox, s
|
|||
pObj->pCopy = NULL;
|
||||
|
||||
// remove the array of names, assign the pointer to the model
|
||||
Vec_PtrForEachEntry( pBox->pData, pName, i )
|
||||
free( pName );
|
||||
Vec_PtrFree( pBox->pData );
|
||||
pBox->pData = pNtkModel;
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -78,6 +78,31 @@ Abc_Obj_t * Io_ReadCreatePo( Abc_Ntk_t * pNtk, char * pName )
|
|||
return pTerm;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Creates PO terminal and net.]
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
Abc_Obj_t * Io_ReadCreateAssert( Abc_Ntk_t * pNtk, char * pName )
|
||||
{
|
||||
Abc_Obj_t * pNet, * pTerm;
|
||||
// get the PO net
|
||||
pNet = Abc_NtkFindNet( pNtk, pName );
|
||||
if ( pNet && Abc_ObjFaninNum(pNet) == 0 )
|
||||
printf( "Warning: Assert \"%s\" appears twice in the list.\n", pName );
|
||||
pNet = Abc_NtkFindOrCreateNet( pNtk, pName );
|
||||
// add the PO node
|
||||
pTerm = Abc_NtkCreateAssert( pNtk );
|
||||
Abc_ObjAddFanin( pTerm, pNet );
|
||||
return pTerm;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Create a latch with the given input/output.]
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ static void Io_NtkWrite( FILE * pFile, Abc_Ntk_t * pNtk, int fWriteLatches );
|
|||
static void Io_NtkWriteOne( FILE * pFile, Abc_Ntk_t * pNtk, int fWriteLatches );
|
||||
static void Io_NtkWritePis( FILE * pFile, Abc_Ntk_t * pNtk, int fWriteLatches );
|
||||
static void Io_NtkWritePos( FILE * pFile, Abc_Ntk_t * pNtk, int fWriteLatches );
|
||||
static void Io_NtkWriteAsserts( FILE * pFile, Abc_Ntk_t * pNtk );
|
||||
static void Io_NtkWriteNodeGate( FILE * pFile, Abc_Obj_t * pNode );
|
||||
static void Io_NtkWriteNodeFanins( FILE * pFile, Abc_Obj_t * pNode );
|
||||
static void Io_NtkWriteNode( FILE * pFile, Abc_Obj_t * pNode );
|
||||
|
|
@ -115,7 +116,7 @@ void Io_WriteBlifNetlist( Abc_Ntk_t * pNtk, char * FileName, int fWriteLatches )
|
|||
void Io_NtkWrite( FILE * pFile, Abc_Ntk_t * pNtk, int fWriteLatches )
|
||||
{
|
||||
Abc_Ntk_t * pExdc;
|
||||
assert( Abc_NtkIsNetlist(pNtk) || Abc_NtkIsBlackbox(pNtk) );
|
||||
assert( Abc_NtkIsNetlist(pNtk) );
|
||||
// write the model name
|
||||
fprintf( pFile, ".model %s\n", Abc_NtkName(pNtk) );
|
||||
// write the network
|
||||
|
|
@ -159,8 +160,16 @@ void Io_NtkWriteOne( FILE * pFile, Abc_Ntk_t * pNtk, int fWriteLatches )
|
|||
Io_NtkWritePos( pFile, pNtk, fWriteLatches );
|
||||
fprintf( pFile, "\n" );
|
||||
|
||||
// write the assertions
|
||||
if ( Abc_NtkAssertNum(pNtk) )
|
||||
{
|
||||
fprintf( pFile, ".asserts" );
|
||||
Io_NtkWriteAsserts( pFile, pNtk );
|
||||
fprintf( pFile, "\n" );
|
||||
}
|
||||
|
||||
// write the blackbox
|
||||
if ( Abc_NtkIsBlackbox( pNtk ) )
|
||||
if ( Abc_NtkHasBlackbox( pNtk ) )
|
||||
{
|
||||
fprintf( pFile, ".blackbox\n" );
|
||||
return;
|
||||
|
|
@ -296,6 +305,8 @@ void Io_NtkWritePos( FILE * pFile, Abc_Ntk_t * pNtk, int fWriteLatches )
|
|||
{
|
||||
Abc_NtkForEachCo( pNtk, pTerm, i )
|
||||
{
|
||||
if ( Abc_ObjIsAssert(pTerm) )
|
||||
continue;
|
||||
pNet = Abc_ObjFanin0(pTerm);
|
||||
// get the line length after this name is written
|
||||
AddedLength = strlen(Abc_ObjName(pNet)) + 1;
|
||||
|
|
@ -313,6 +324,45 @@ void Io_NtkWritePos( FILE * pFile, Abc_Ntk_t * pNtk, int fWriteLatches )
|
|||
}
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Writes the assertion list.]
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void Io_NtkWriteAsserts( FILE * pFile, Abc_Ntk_t * pNtk )
|
||||
{
|
||||
Abc_Obj_t * pTerm, * pNet;
|
||||
int LineLength;
|
||||
int AddedLength;
|
||||
int NameCounter;
|
||||
int i;
|
||||
|
||||
LineLength = 8;
|
||||
NameCounter = 0;
|
||||
|
||||
Abc_NtkForEachAssert( pNtk, pTerm, i )
|
||||
{
|
||||
pNet = Abc_ObjFanin0(pTerm);
|
||||
// get the line length after this name is written
|
||||
AddedLength = strlen(Abc_ObjName(pNet)) + 1;
|
||||
if ( NameCounter && LineLength + AddedLength + 3 > IO_WRITE_LINE_LENGTH )
|
||||
{ // write the line extender
|
||||
fprintf( pFile, " \\\n" );
|
||||
// reset the line length
|
||||
LineLength = 0;
|
||||
NameCounter = 0;
|
||||
}
|
||||
fprintf( pFile, " %s", Abc_ObjName(pNet) );
|
||||
LineLength += AddedLength;
|
||||
NameCounter++;
|
||||
}
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ static void Io_WriteVerilogWires( FILE * pFile, Abc_Ntk_t * pNtk, int Start );
|
|||
static void Io_WriteVerilogRegs( FILE * pFile, Abc_Ntk_t * pNtk, int Start );
|
||||
static void Io_WriteVerilogGates( FILE * pFile, Abc_Ntk_t * pNtk );
|
||||
static void Io_WriteVerilogNodes( FILE * pFile, Abc_Ntk_t * pNtk );
|
||||
static void Io_WriteVerilogArgs( FILE * pFile, Abc_Obj_t * pObj, int nInMax, int fPadZeros );
|
||||
static void Io_WriteVerilogLatches( FILE * pFile, Abc_Ntk_t * pNtk );
|
||||
static int Io_WriteVerilogCheckNtk( Abc_Ntk_t * pNtk );
|
||||
static char * Io_WriteVerilogGetName( Abc_Obj_t * pObj );
|
||||
|
|
@ -225,7 +224,7 @@ void Io_WriteVerilogWires( FILE * pFile, Abc_Ntk_t * pNtk, int Start )
|
|||
int i, Counter, nNodes;
|
||||
|
||||
// count the number of wires
|
||||
nNodes = 0;
|
||||
nNodes = Abc_NtkLatchNum(pNtk);
|
||||
Abc_NtkForEachNode( pNtk, pTerm, i )
|
||||
{
|
||||
if ( i == 0 )
|
||||
|
|
@ -261,6 +260,24 @@ void Io_WriteVerilogWires( FILE * pFile, Abc_Ntk_t * pNtk, int Start )
|
|||
LineLength += AddedLength;
|
||||
NameCounter++;
|
||||
}
|
||||
Abc_NtkForEachLatch( pNtk, pTerm, i )
|
||||
{
|
||||
pNet = Abc_ObjFanin0(pTerm);
|
||||
Counter++;
|
||||
// get the line length after this name is written
|
||||
AddedLength = strlen(Abc_ObjName(pNet)) + 2;
|
||||
if ( NameCounter && LineLength + AddedLength + 3 > IO_WRITE_LINE_LENGTH )
|
||||
{ // write the line extender
|
||||
fprintf( pFile, "\n " );
|
||||
// reset the line length
|
||||
LineLength = 3;
|
||||
NameCounter = 0;
|
||||
}
|
||||
fprintf( pFile, " %s%s", Io_WriteVerilogGetName(pNet), (Counter==nNodes)? "" : "," );
|
||||
LineLength += AddedLength;
|
||||
NameCounter++;
|
||||
}
|
||||
assert( Counter == nNodes );
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
|
@ -325,12 +342,15 @@ void Io_WriteVerilogLatches( FILE * pFile, Abc_Ntk_t * pNtk )
|
|||
int i;
|
||||
Abc_NtkForEachLatch( pNtk, pLatch, i )
|
||||
{
|
||||
if ( Abc_LatchInit(pLatch) == ABC_INIT_ZERO )
|
||||
fprintf( pFile, " initial begin %s = 1\'b0; end\n", Abc_ObjName(Abc_ObjFanout0(pLatch)) );
|
||||
else if ( Abc_LatchInit(pLatch) == ABC_INIT_ONE )
|
||||
fprintf( pFile, " initial begin %s = 1\'b1; end\n", Abc_ObjName(Abc_ObjFanout0(pLatch)) );
|
||||
fprintf( pFile, " always@(posedge gclk) begin %s", Abc_ObjName(Abc_ObjFanout0(pLatch)) );
|
||||
// fprintf( pFile, " always@(posedge gclk) begin %s", Abc_ObjName(Abc_ObjFanout0(pLatch)) );
|
||||
fprintf( pFile, " always begin %s", Abc_ObjName(Abc_ObjFanout0(pLatch)) );
|
||||
fprintf( pFile, " = %s; end\n", Abc_ObjName(Abc_ObjFanin0(pLatch)) );
|
||||
if ( Abc_LatchInit(pLatch) == ABC_INIT_ZERO )
|
||||
// fprintf( pFile, " initial begin %s = 1\'b0; end\n", Abc_ObjName(Abc_ObjFanout0(pLatch)) );
|
||||
fprintf( pFile, " initial begin %s = 0; end\n", Abc_ObjName(Abc_ObjFanout0(pLatch)) );
|
||||
else if ( Abc_LatchInit(pLatch) == ABC_INIT_ONE )
|
||||
// fprintf( pFile, " initial begin %s = 1\'b1; end\n", Abc_ObjName(Abc_ObjFanout0(pLatch)) );
|
||||
fprintf( pFile, " initial begin %s = 1; end\n", Abc_ObjName(Abc_ObjFanout0(pLatch)) );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -378,7 +398,7 @@ void Io_WriteVerilogGates( FILE * pFile, Abc_Ntk_t * pNtk )
|
|||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void Io_WriteVerilogNodes( FILE * pFile, Abc_Ntk_t * pNtk )
|
||||
void Io_WriteVerilogNodes2( FILE * pFile, Abc_Ntk_t * pNtk )
|
||||
{
|
||||
Abc_Obj_t * pObj, * pFanin;
|
||||
int i, k, nFanins;
|
||||
|
|
@ -390,7 +410,8 @@ void Io_WriteVerilogNodes( FILE * pFile, Abc_Ntk_t * pNtk )
|
|||
nFanins = Abc_ObjFaninNum(pObj);
|
||||
if ( nFanins == 0 )
|
||||
{
|
||||
fprintf( pFile, " assign %s = 1'b%d;\n", Io_WriteVerilogGetName(Abc_ObjFanout0(pObj)), !Abc_SopIsComplement(pObj->pData) );
|
||||
// fprintf( pFile, " assign %s = 1'b%d;\n", Io_WriteVerilogGetName(Abc_ObjFanout0(pObj)), !Abc_SopIsComplement(pObj->pData) );
|
||||
fprintf( pFile, " assign %s = %d;\n", Io_WriteVerilogGetName(Abc_ObjFanout0(pObj)), !Abc_SopIsComplement(pObj->pData) );
|
||||
continue;
|
||||
}
|
||||
if ( nFanins == 1 )
|
||||
|
|
@ -410,7 +431,7 @@ void Io_WriteVerilogNodes( FILE * pFile, Abc_Ntk_t * pNtk )
|
|||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Writes the inputs.]
|
||||
Synopsis [Writes the nodes.]
|
||||
|
||||
Description []
|
||||
|
||||
|
|
@ -419,24 +440,32 @@ void Io_WriteVerilogNodes( FILE * pFile, Abc_Ntk_t * pNtk )
|
|||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void Io_WriteVerilogArgs( FILE * pFile, Abc_Obj_t * pObj, int nInMax, int fPadZeros )
|
||||
void Io_WriteVerilogNodes( FILE * pFile, Abc_Ntk_t * pNtk )
|
||||
{
|
||||
Abc_Obj_t * pFanin;
|
||||
int i, Counter = 2;
|
||||
fprintf( pFile, "(.z (%s)", Io_WriteVerilogGetName(Abc_ObjFanout0(pObj)) );
|
||||
Abc_ObjForEachFanin( pObj, pFanin, i )
|
||||
Abc_Obj_t * pObj, * pFanin;
|
||||
int i, k, nFanins;
|
||||
char pOper[] = " ? ", Symb;
|
||||
Abc_NtkForEachNode( pNtk, pObj, i )
|
||||
{
|
||||
if ( Counter++ % 4 == 0 )
|
||||
fprintf( pFile, "\n " );
|
||||
fprintf( pFile, " .i%d (%s)", i+1, Io_WriteVerilogGetName(Abc_ObjFanin(pObj,i)) );
|
||||
assert( Abc_SopGetCubeNum(pObj->pData) == 1 );
|
||||
nFanins = Abc_ObjFaninNum(pObj);
|
||||
if ( nFanins == 0 )
|
||||
{
|
||||
fprintf( pFile, " assign %s = 1'b%d;\n", Io_WriteVerilogGetName(Abc_ObjFanout0(pObj)), !Abc_SopIsComplement(pObj->pData) );
|
||||
continue;
|
||||
}
|
||||
fprintf( pFile, " assign %s = ", Io_WriteVerilogGetName(Abc_ObjFanout0(pObj)) );
|
||||
pOper[1] = Abc_SopIsComplement(pObj->pData) ? '|' : '&';
|
||||
Abc_ObjForEachFanin( pObj, pFanin, k )
|
||||
{
|
||||
Symb = ((char*)pObj->pData)[k];
|
||||
assert( Symb == '0' || Symb == '1' );
|
||||
if ( Symb == '0' )
|
||||
fprintf( pFile, "~" );
|
||||
fprintf( pFile, "%s%s", Io_WriteVerilogGetName(pFanin), (k==nFanins-1? "" : pOper) );
|
||||
}
|
||||
fprintf( pFile, ";\n" );
|
||||
}
|
||||
for ( ; i < nInMax; i++ )
|
||||
{
|
||||
if ( Counter++ % 4 == 0 )
|
||||
fprintf( pFile, "\n " );
|
||||
fprintf( pFile, " .i%d (%s)", i+1, fPadZeros? "1\'b0" : "1\'b1" );
|
||||
}
|
||||
fprintf( pFile, ");\n" );
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
|
|
|||
|
|
@ -446,7 +446,7 @@ void Abc_FrameDeleteAllNetworks( Abc_Frame_t * p )
|
|||
Abc_NtkDelete( pNtk );
|
||||
// set the current network empty
|
||||
p->pNtkCur = NULL;
|
||||
fprintf( p->Out, "All networks have been deleted.\n" );
|
||||
// fprintf( p->Out, "All networks have been deleted.\n" );
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
SRC += src/base/main/main.c \
|
||||
src/base/main/mainFrame.c \
|
||||
src/base/main/mainInit.c \
|
||||
src/base/main/mainUtils.c \
|
||||
src/base/main/libSupport.c
|
||||
src/base/main/libSupport.c \
|
||||
src/base/main/mainUtils.c
|
||||
|
|
|
|||
|
|
@ -319,6 +319,7 @@ int Seq_NtkImplementRetimingBackward( Abc_Ntk_t * pNtk, Vec_Ptr_t * vMoves, int
|
|||
// add the PI/PO names
|
||||
Abc_NtkAddDummyPiNames( pNtkProb );
|
||||
Abc_NtkAddDummyPoNames( pNtkProb );
|
||||
Abc_NtkAddDummyAssertNames( pNtkProb );
|
||||
|
||||
// make sure everything is okay with the network structure
|
||||
if ( !Abc_NtkDoCheck( pNtkProb ) )
|
||||
|
|
@ -358,7 +359,7 @@ int Seq_NtkImplementRetimingBackward( Abc_Ntk_t * pNtk, Vec_Ptr_t * vMoves, int
|
|||
// solve the miter
|
||||
clk = clock();
|
||||
// RetValue = Abc_NtkMiterSat_OldAndRusty( pNtkCnf, 30, 0 );
|
||||
RetValue = Abc_NtkMiterSat( pNtkCnf, 500000, 50000000, 0, 0 );
|
||||
RetValue = Abc_NtkMiterSat( pNtkCnf, (sint64)500000, (sint64)50000000, 0, 0, NULL, NULL );
|
||||
if ( fVerbose )
|
||||
if ( clock() - clk > 100 )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -110,17 +110,23 @@ Abc_Ntk_t * Abc_NtkAigToSeq( Abc_Ntk_t * pNtk )
|
|||
pNtkNew->nObjs++;
|
||||
}
|
||||
pNtkNew->nNodes = pNtk->nNodes;
|
||||
pNtkNew->nPis = pNtk->nPis;
|
||||
pNtkNew->nPos = pNtk->nPos;
|
||||
|
||||
// create PI/PO and their names
|
||||
Abc_NtkForEachPi( pNtk, pObj, i )
|
||||
{
|
||||
Vec_PtrPush( pNtkNew->vPis, pObj->pCopy );
|
||||
Vec_PtrPush( pNtkNew->vCis, pObj->pCopy );
|
||||
Abc_NtkLogicStoreName( pObj->pCopy, Abc_ObjName(pObj) );
|
||||
}
|
||||
Abc_NtkForEachPo( pNtk, pObj, i )
|
||||
{
|
||||
Vec_PtrPush( pNtkNew->vPos, pObj->pCopy );
|
||||
Vec_PtrPush( pNtkNew->vCos, pObj->pCopy );
|
||||
Abc_NtkLogicStoreName( pObj->pCopy, Abc_ObjName(pObj) );
|
||||
}
|
||||
Abc_NtkForEachAssert( pNtk, pObj, i )
|
||||
{
|
||||
Vec_PtrPush( pNtkNew->vAsserts, pObj->pCopy );
|
||||
Vec_PtrPush( pNtkNew->vCos, pObj->pCopy );
|
||||
Abc_NtkLogicStoreName( pObj->pCopy, Abc_ObjName(pObj) );
|
||||
}
|
||||
|
|
@ -252,7 +258,7 @@ void Abc_NtkAigCutsetCopy( Abc_Ntk_t * pNtk )
|
|||
Abc_Ntk_t * Abc_NtkSeqToLogicSop( Abc_Ntk_t * pNtk )
|
||||
{
|
||||
Abc_Ntk_t * pNtkNew;
|
||||
Abc_Obj_t * pObj, * pObjNew, * pFaninNew;
|
||||
Abc_Obj_t * pObj, * pFaninNew;
|
||||
Seq_Lat_t * pRing;
|
||||
int i;
|
||||
|
||||
|
|
@ -297,11 +303,7 @@ Abc_Ntk_t * Abc_NtkSeqToLogicSop( Abc_Ntk_t * pNtk )
|
|||
|
||||
// add the latches and their names
|
||||
Abc_NtkAddDummyLatchNames( pNtkNew );
|
||||
Abc_NtkForEachLatch( pNtkNew, pObjNew, i )
|
||||
{
|
||||
Vec_PtrPush( pNtkNew->vCis, pObjNew );
|
||||
Vec_PtrPush( pNtkNew->vCos, pObjNew );
|
||||
}
|
||||
Abc_NtkOrderCisCos( pNtkNew );
|
||||
// fix the problem with complemented and duplicated CO edges
|
||||
Abc_NtkLogicMakeSimpleCos( pNtkNew, 0 );
|
||||
if ( !Abc_NtkCheck( pNtkNew ) )
|
||||
|
|
@ -324,7 +326,7 @@ Abc_Ntk_t * Abc_NtkSeqToLogicSop( Abc_Ntk_t * pNtk )
|
|||
Abc_Ntk_t * Abc_NtkSeqToLogicSop_old( Abc_Ntk_t * pNtk )
|
||||
{
|
||||
Abc_Ntk_t * pNtkNew;
|
||||
Abc_Obj_t * pObj, * pObjNew, * pFaninNew;
|
||||
Abc_Obj_t * pObj, * pFaninNew;
|
||||
int i;
|
||||
|
||||
assert( Abc_NtkIsSeq(pNtk) );
|
||||
|
|
@ -371,11 +373,7 @@ Abc_Ntk_t * Abc_NtkSeqToLogicSop_old( Abc_Ntk_t * pNtk )
|
|||
}
|
||||
// add the latches and their names
|
||||
Abc_NtkAddDummyLatchNames( pNtkNew );
|
||||
Abc_NtkForEachLatch( pNtkNew, pObjNew, i )
|
||||
{
|
||||
Vec_PtrPush( pNtkNew->vCis, pObjNew );
|
||||
Vec_PtrPush( pNtkNew->vCos, pObjNew );
|
||||
}
|
||||
Abc_NtkOrderCisCos( pNtkNew );
|
||||
// fix the problem with complemented and duplicated CO edges
|
||||
Abc_NtkLogicMakeSimpleCos( pNtkNew, 0 );
|
||||
if ( !Abc_NtkCheck( pNtkNew ) )
|
||||
|
|
|
|||
|
|
@ -280,7 +280,7 @@ Abc_Ntk_t * Seq_NtkSeqFpgaMapped( Abc_Ntk_t * pNtk )
|
|||
Abc_Seq_t * p = pNtk->pManFunc;
|
||||
Abc_Ntk_t * pNtkMap;
|
||||
Vec_Ptr_t * vLeaves;
|
||||
Abc_Obj_t * pObj, * pLatch, * pFaninNew;
|
||||
Abc_Obj_t * pObj, * pFaninNew;
|
||||
Seq_Lat_t * pRing;
|
||||
int i;
|
||||
|
||||
|
|
@ -322,11 +322,7 @@ Abc_Ntk_t * Seq_NtkSeqFpgaMapped( Abc_Ntk_t * pNtk )
|
|||
|
||||
// add the latches and their names
|
||||
Abc_NtkAddDummyLatchNames( pNtkMap );
|
||||
Abc_NtkForEachLatch( pNtkMap, pLatch, i )
|
||||
{
|
||||
Vec_PtrPush( pNtkMap->vCis, pLatch );
|
||||
Vec_PtrPush( pNtkMap->vCos, pLatch );
|
||||
}
|
||||
Abc_NtkOrderCisCos( pNtkMap );
|
||||
// fix the problem with complemented and duplicated CO edges
|
||||
Abc_NtkLogicMakeSimpleCos( pNtkMap, 1 );
|
||||
// make the network minimum base
|
||||
|
|
|
|||
|
|
@ -370,7 +370,7 @@ Abc_Ntk_t * Seq_NtkSeqMapMapped( Abc_Ntk_t * pNtk )
|
|||
Seq_Match_t * pMatch;
|
||||
Abc_Ntk_t * pNtkMap;
|
||||
Vec_Ptr_t * vLeaves;
|
||||
Abc_Obj_t * pObj, * pLatch, * pFaninNew;
|
||||
Abc_Obj_t * pObj, * pFaninNew;
|
||||
Seq_Lat_t * pRing;
|
||||
int i;
|
||||
|
||||
|
|
@ -413,11 +413,7 @@ Abc_Ntk_t * Seq_NtkSeqMapMapped( Abc_Ntk_t * pNtk )
|
|||
|
||||
// add the latches and their names
|
||||
Abc_NtkAddDummyLatchNames( pNtkMap );
|
||||
Abc_NtkForEachLatch( pNtkMap, pLatch, i )
|
||||
{
|
||||
Vec_PtrPush( pNtkMap->vCis, pLatch );
|
||||
Vec_PtrPush( pNtkMap->vCos, pLatch );
|
||||
}
|
||||
Abc_NtkOrderCisCos( pNtkMap );
|
||||
// fix the problem with complemented and duplicated CO edges
|
||||
Abc_NtkLogicMakeSimpleCos( pNtkMap, 1 );
|
||||
// make the network minimum base
|
||||
|
|
|
|||
|
|
@ -327,7 +327,7 @@ Abc_Ntk_t * Seq_NtkRetimeReconstruct( Abc_Ntk_t * pNtkOld, Abc_Ntk_t * pNtkSeq )
|
|||
Abc_Seq_t * p = pNtkSeq->pManFunc;
|
||||
Seq_Lat_t * pRing0, * pRing1;
|
||||
Abc_Ntk_t * pNtkNew;
|
||||
Abc_Obj_t * pObj, * pObjNew, * pFanin, * pFaninNew, * pMirror;
|
||||
Abc_Obj_t * pObj, * pFanin, * pFaninNew, * pMirror;
|
||||
Vec_Ptr_t * vMirrors;
|
||||
int i, k;
|
||||
|
||||
|
|
@ -408,11 +408,7 @@ Abc_Ntk_t * Seq_NtkRetimeReconstruct( Abc_Ntk_t * pNtkOld, Abc_Ntk_t * pNtkSeq )
|
|||
|
||||
// add the latches and their names
|
||||
Abc_NtkAddDummyLatchNames( pNtkNew );
|
||||
Abc_NtkForEachLatch( pNtkNew, pObjNew, i )
|
||||
{
|
||||
Vec_PtrPush( pNtkNew->vCis, pObjNew );
|
||||
Vec_PtrPush( pNtkNew->vCos, pObjNew );
|
||||
}
|
||||
Abc_NtkOrderCisCos( pNtkNew );
|
||||
// fix the problem with complemented and duplicated CO edges
|
||||
Abc_NtkLogicMakeSimpleCos( pNtkNew, 1 );
|
||||
if ( !Abc_NtkCheck( pNtkNew ) )
|
||||
|
|
|
|||
|
|
@ -1082,7 +1082,7 @@ Fpga_Cut_t * Fpga_CutSortCuts( Fpga_Man_t * pMan, Fpga_CutTable_t * p, Fpga_Cut_
|
|||
nCuts = Fpga_CutList2Array( p->pCuts1, pList );
|
||||
assert( nCuts <= FPGA_CUTS_MAX_COMPUTE );
|
||||
// sort the cuts
|
||||
qsort( (void *)p->pCuts1, nCuts, sizeof(Fpga_Cut_t *),
|
||||
qsort( (void *)p->pCuts1, nCuts, sizeof(void *),
|
||||
(int (*)(const void *, const void *)) Fpga_CutSortCutsCompare );
|
||||
// move them back into the list
|
||||
if ( nCuts > FPGA_CUTS_MAX_USE - 1 )
|
||||
|
|
|
|||
|
|
@ -325,7 +325,7 @@ void Map_SuperTableSortSupergates( Map_HashTable_t * p, int nSupersMax )
|
|||
ppSupers[nSupers++] = pSuper;
|
||||
|
||||
// sort by usage
|
||||
qsort( (void *)ppSupers, nSupers, sizeof(int),
|
||||
qsort( (void *)ppSupers, nSupers, sizeof(Map_Super_t *),
|
||||
(int (*)(const void *, const void *)) Map_SuperTableCompareSupergates );
|
||||
assert( Map_SuperTableCompareSupergates( ppSupers, ppSupers + nSupers - 1 ) <= 0 );
|
||||
|
||||
|
|
@ -380,7 +380,7 @@ void Map_SuperTableSortSupergatesByDelay( Map_HashTable_t * p, int nSupersMax )
|
|||
if ( nSupers == 0 )
|
||||
continue;
|
||||
// sort the gates by delay
|
||||
qsort( (void *)ppSupers, nSupers, sizeof(int),
|
||||
qsort( (void *)ppSupers, nSupers, sizeof(Map_Super_t *),
|
||||
(int (*)(const void *, const void *)) Map_SuperTableCompareGatesInList );
|
||||
assert( Map_SuperTableCompareGatesInList( ppSupers, ppSupers + nSupers - 1 ) <= 0 );
|
||||
// link them in the reverse order
|
||||
|
|
|
|||
|
|
@ -89,14 +89,15 @@ void Map_MappingTruths( Map_Man_t * pMan )
|
|||
|
||||
***********************************************************************/
|
||||
void Map_TruthsCut( Map_Man_t * p, Map_Cut_t * pCut )
|
||||
{
|
||||
{
|
||||
// unsigned uCanon1, uCanon2;
|
||||
unsigned uTruth[2], uCanon[2];
|
||||
unsigned char uPhases[16];
|
||||
unsigned * uCanon2;
|
||||
char * pPhases2;
|
||||
int fUseFast = 0;
|
||||
int fUseRec = 1;
|
||||
int fUseFast = 1;
|
||||
int fUseSlow = 0;
|
||||
int fUseRec = 0; // this does not work for Solaris
|
||||
|
||||
extern int Map_CanonCompute( int nVarsMax, int nVarsReal, unsigned * pt, unsigned ** pptRes, char ** ppfRes );
|
||||
|
||||
|
|
@ -117,6 +118,8 @@ void Map_TruthsCut( Map_Man_t * p, Map_Cut_t * pCut )
|
|||
// compute the canonical form for the positive phase
|
||||
if ( fUseFast )
|
||||
Map_CanonComputeFast( p, p->nVarsMax, pCut->nLeaves, uTruth, uPhases, uCanon );
|
||||
else if ( fUseSlow )
|
||||
Map_CanonComputeSlow( p->uTruths, p->nVarsMax, pCut->nLeaves, uTruth, uPhases, uCanon );
|
||||
else if ( fUseRec )
|
||||
{
|
||||
// Map_CanonComputeSlow( p->uTruths, p->nVarsMax, pCut->nLeaves, uTruth, uPhases, uCanon );
|
||||
|
|
@ -145,6 +148,8 @@ void Map_TruthsCut( Map_Man_t * p, Map_Cut_t * pCut )
|
|||
uTruth[1] = ~uTruth[1];
|
||||
if ( fUseFast )
|
||||
Map_CanonComputeFast( p, p->nVarsMax, pCut->nLeaves, uTruth, uPhases, uCanon );
|
||||
else if ( fUseSlow )
|
||||
Map_CanonComputeSlow( p->uTruths, p->nVarsMax, pCut->nLeaves, uTruth, uPhases, uCanon );
|
||||
else if ( fUseRec )
|
||||
{
|
||||
// Map_CanonComputeSlow( p->uTruths, p->nVarsMax, pCut->nLeaves, uTruth, uPhases, uCanon );
|
||||
|
|
|
|||
|
|
@ -464,9 +464,8 @@ extern unsigned Extra_TruthSemiCanonicize( unsigned * pInOut, unsigned * pAux, i
|
|||
#define ALLOC(type, num) ((type *) malloc(sizeof(type) * (num)))
|
||||
#define FREE(obj) ((obj) ? (free((char *) (obj)), (obj) = 0) : 0)
|
||||
#define REALLOC(type, obj, num) \
|
||||
(obj) ? ((type *) realloc((char *) obj, sizeof(type) * (num))) : \
|
||||
((type *) malloc(sizeof(type) * (num)))
|
||||
|
||||
((obj) ? ((type *) realloc((char *)(obj), sizeof(type) * (num))) : \
|
||||
((type *) malloc(sizeof(type) * (num))))
|
||||
|
||||
extern long Extra_CpuTime();
|
||||
extern int Extra_GetSoftDataLimit();
|
||||
|
|
|
|||
|
|
@ -348,7 +348,7 @@ int Extra_BitMatrixCountOnesUpper( Extra_BitMat_t * p )
|
|||
int i, k, nTotal = 0;
|
||||
for ( i = 0; i < p->nSize; i++ )
|
||||
for ( k = i + 1; k < p->nSize; k++ )
|
||||
nTotal += ( (p->ppData[i][k/32] & (1 << (k%32))) > 0 );
|
||||
nTotal += ( (p->ppData[i][k>>5] & (1 << (k&31))) > 0 );
|
||||
return nTotal;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1323,9 +1323,9 @@ void Extra_TruthExpand( int nVars, int nWords, unsigned * puTruth, unsigned uPha
|
|||
{ 0xF0F0F0F0,0xF0F0F0F0,0xF0F0F0F0,0xF0F0F0F0,0xF0F0F0F0,0xF0F0F0F0,0xF0F0F0F0,0xF0F0F0F0 },
|
||||
{ 0xFF00FF00,0xFF00FF00,0xFF00FF00,0xFF00FF00,0xFF00FF00,0xFF00FF00,0xFF00FF00,0xFF00FF00 },
|
||||
{ 0xFFFF0000,0xFFFF0000,0xFFFF0000,0xFFFF0000,0xFFFF0000,0xFFFF0000,0xFFFF0000,0xFFFF0000 },
|
||||
{ 0xFFFFFFFF,0x00000000,0xFFFFFFFF,0x00000000,0xFFFFFFFF,0x00000000,0xFFFFFFFF,0x00000000 },
|
||||
{ 0xFFFFFFFF,0xFFFFFFFF,0x00000000,0x00000000,0xFFFFFFFF,0xFFFFFFFF,0x00000000,0x00000000 },
|
||||
{ 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0x00000000,0x00000000,0x00000000,0x00000000 }
|
||||
{ 0x00000000,0xFFFFFFFF,0x00000000,0xFFFFFFFF,0x00000000,0xFFFFFFFF,0x00000000,0xFFFFFFFF },
|
||||
{ 0x00000000,0x00000000,0xFFFFFFFF,0xFFFFFFFF,0x00000000,0x00000000,0xFFFFFFFF,0xFFFFFFFF },
|
||||
{ 0x00000000,0x00000000,0x00000000,0x00000000,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF }
|
||||
};
|
||||
static char Cases[256] = {
|
||||
0, // 00000000
|
||||
|
|
@ -1922,12 +1922,12 @@ void Extra_TruthExpand( int nVars, int nWords, unsigned * puTruth, unsigned uPha
|
|||
puTruthR[i] = 0;
|
||||
nMints = (1 << nVars);
|
||||
for ( i = 0; i < nMints; i++ )
|
||||
if ( puTruth[i/32] & (1 << (i%32)) )
|
||||
if ( puTruth[i>>5] & (1 << (i&31)) )
|
||||
{
|
||||
for ( iRes = 0, k = 0; k < 5; k++ )
|
||||
if ( i & (1 << pPerm[k]) )
|
||||
iRes |= (1 << k);
|
||||
puTruthR[iRes/32] |= (1 << (iRes%32));
|
||||
puTruthR[iRes>>5] |= (1 << (iRes&31));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2058,9 +2058,9 @@ unsigned ** Extra_Truths8()
|
|||
{ 0xF0F0F0F0,0xF0F0F0F0,0xF0F0F0F0,0xF0F0F0F0,0xF0F0F0F0,0xF0F0F0F0,0xF0F0F0F0,0xF0F0F0F0 },
|
||||
{ 0xFF00FF00,0xFF00FF00,0xFF00FF00,0xFF00FF00,0xFF00FF00,0xFF00FF00,0xFF00FF00,0xFF00FF00 },
|
||||
{ 0xFFFF0000,0xFFFF0000,0xFFFF0000,0xFFFF0000,0xFFFF0000,0xFFFF0000,0xFFFF0000,0xFFFF0000 },
|
||||
{ 0xFFFFFFFF,0x00000000,0xFFFFFFFF,0x00000000,0xFFFFFFFF,0x00000000,0xFFFFFFFF,0x00000000 },
|
||||
{ 0xFFFFFFFF,0xFFFFFFFF,0x00000000,0x00000000,0xFFFFFFFF,0xFFFFFFFF,0x00000000,0x00000000 },
|
||||
{ 0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0x00000000,0x00000000,0x00000000,0x00000000 }
|
||||
{ 0x00000000,0xFFFFFFFF,0x00000000,0xFFFFFFFF,0x00000000,0xFFFFFFFF,0x00000000,0xFFFFFFFF },
|
||||
{ 0x00000000,0x00000000,0xFFFFFFFF,0xFFFFFFFF,0x00000000,0x00000000,0xFFFFFFFF,0xFFFFFFFF },
|
||||
{ 0x00000000,0x00000000,0x00000000,0x00000000,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF }
|
||||
};
|
||||
static unsigned * puResult[8] = {
|
||||
uTruths[0], uTruths[1], uTruths[2], uTruths[3], uTruths[4], uTruths[5], uTruths[6], uTruths[7]
|
||||
|
|
|
|||
|
|
@ -264,15 +264,15 @@ DdNode * Extra_TruthToBdd_rec( DdManager * dd, unsigned * pTruth, int iBit, int
|
|||
DdNode * bF0, * bF1, * bF;
|
||||
if ( nVars == 0 )
|
||||
{
|
||||
if ( pTruth[iBit/32] & (1 << iBit%32) )
|
||||
if ( pTruth[iBit>>5] & (1 << iBit&31) )
|
||||
return b1;
|
||||
return b0;
|
||||
}
|
||||
if ( nVars == 5 )
|
||||
{
|
||||
if ( pTruth[iBit/32] == 0xFFFFFFFF )
|
||||
if ( pTruth[iBit>>5] == 0xFFFFFFFF )
|
||||
return b1;
|
||||
if ( pTruth[iBit/32] == 0 )
|
||||
if ( pTruth[iBit>>5] == 0 )
|
||||
return b0;
|
||||
}
|
||||
// other special cases can be added
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@
|
|||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// cube/list/cover/data
|
||||
typedef unsigned long Mvc_CubeWord_t;
|
||||
typedef unsigned int Mvc_CubeWord_t;
|
||||
typedef struct MvcCubeStruct Mvc_Cube_t;
|
||||
typedef struct MvcListStruct Mvc_List_t;
|
||||
typedef struct MvcCoverStruct Mvc_Cover_t;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,2 @@
|
|||
SRC += src/misc/nm/nmApi.c \
|
||||
src/misc/nm/nmTable.c
|
||||
|
|
@ -52,10 +52,12 @@ extern Nm_Man_t * Nm_ManCreate( int nSize );
|
|||
extern void Nm_ManFree( Nm_Man_t * p );
|
||||
extern int Nm_ManNumEntries( Nm_Man_t * p );
|
||||
extern char * Nm_ManStoreIdName( Nm_Man_t * p, int ObjId, char * pName, char * pSuffix );
|
||||
extern void Nm_ManDeleteIdName( Nm_Man_t * p, int ObjId );
|
||||
extern char * Nm_ManCreateUniqueName( Nm_Man_t * p, int ObjId );
|
||||
extern char * Nm_ManFindNameById( Nm_Man_t * p, int ObjId );
|
||||
extern int Nm_ManFindIdByName( Nm_Man_t * p, char * pName, int * pSecond );
|
||||
extern void Nm_ManPrintTables( Nm_Man_t * p );
|
||||
extern Vec_Int_t * Nm_ManReturnNameIds( Nm_Man_t * p );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
|||
|
|
@ -135,6 +135,31 @@ char * Nm_ManStoreIdName( Nm_Man_t * p, int ObjId, char * pName, char * pSuffix
|
|||
return pEntry->Name;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Creates a new entry in the name manager.]
|
||||
|
||||
Description [Returns 1 if the entry with the given object ID
|
||||
already exists in the name manager.]
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void Nm_ManDeleteIdName( Nm_Man_t * p, int ObjId )
|
||||
{
|
||||
Nm_Entry_t * pEntry;
|
||||
pEntry = Nm_ManTableLookupId(p, ObjId);
|
||||
if ( pEntry == NULL )
|
||||
{
|
||||
printf( "Nm_ManDeleteIdName(): This entry is not in the table.\n" );
|
||||
return;
|
||||
}
|
||||
// remove entry from the table
|
||||
Nm_ManTableDelete( p, pEntry );
|
||||
}
|
||||
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
|
|
@ -255,6 +280,28 @@ void Nm_ManPrintTables( Nm_Man_t * p )
|
|||
printf( "\n" );
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Return the IDs of objects with names.]
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
Vec_Int_t * Nm_ManReturnNameIds( Nm_Man_t * p )
|
||||
{
|
||||
Vec_Int_t * vNameIds;
|
||||
int i;
|
||||
vNameIds = Vec_IntAlloc( p->nEntries );
|
||||
for ( i = 0; i < p->nBins; i++ )
|
||||
if ( p->pBinsI2N[i] )
|
||||
Vec_IntPush( vNameIds, p->pBinsI2N[i]->ObjId );
|
||||
return vNameIds;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
/// END OF FILE ///
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ extern "C" {
|
|||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "extra.h"
|
||||
#include "vec.h"
|
||||
#include "nm.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -73,8 +73,8 @@ extern "C" {
|
|||
#define ALLOC(type, num) ((type *) malloc(sizeof(type) * (num)))
|
||||
#define FREE(obj) ((obj) ? (free((char *) (obj)), (obj) = 0) : 0)
|
||||
#define REALLOC(type, obj, num) \
|
||||
(obj) ? ((type *) realloc((char *) obj, sizeof(type) * (num))) : \
|
||||
((type *) malloc(sizeof(type) * (num)))
|
||||
((obj) ? ((type *) realloc((char *)(obj), sizeof(type) * (num))) : \
|
||||
((type *) malloc(sizeof(type) * (num))))
|
||||
|
||||
extern long Extra_CpuTime();
|
||||
extern int Extra_GetSoftDataLimit();
|
||||
|
|
|
|||
|
|
@ -538,6 +538,27 @@ static inline void Vec_IntPushOrder( Vec_Int_t * p, int Entry )
|
|||
p->pArray[i+1] = Entry;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Inserts the entry while preserving the increasing order.]
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
static inline int Vec_IntPushUniqueOrder( Vec_Int_t * p, int Entry )
|
||||
{
|
||||
int i;
|
||||
for ( i = 0; i < p->nSize; i++ )
|
||||
if ( p->pArray[i] == Entry )
|
||||
return 1;
|
||||
Vec_IntPushOrder( p, Entry );
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis []
|
||||
|
|
|
|||
|
|
@ -470,6 +470,26 @@ static inline void * Vec_PtrPop( Vec_Ptr_t * p )
|
|||
return p->pArray[--p->nSize];
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Find entry.]
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
static inline int Vec_PtrFind( Vec_Ptr_t * p, void * Entry )
|
||||
{
|
||||
int i;
|
||||
for ( i = 0; i < p->nSize; i++ )
|
||||
if ( p->pArray[i] == Entry )
|
||||
return i;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis []
|
||||
|
|
|
|||
|
|
@ -494,10 +494,10 @@ static inline int Vec_StrSortCompare2( char * pp1, char * pp2 )
|
|||
static inline void Vec_StrSort( Vec_Str_t * p, int fReverse )
|
||||
{
|
||||
if ( fReverse )
|
||||
qsort( (void *)p->pArray, p->nSize, sizeof(int),
|
||||
qsort( (void *)p->pArray, p->nSize, sizeof(char),
|
||||
(int (*)(const void *, const void *)) Vec_StrSortCompare2 );
|
||||
else
|
||||
qsort( (void *)p->pArray, p->nSize, sizeof(int),
|
||||
qsort( (void *)p->pArray, p->nSize, sizeof(char),
|
||||
(int (*)(const void *, const void *)) Vec_StrSortCompare1 );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,988 @@
|
|||
/**CFile****************************************************************
|
||||
|
||||
FileName [cutPre22.c]
|
||||
|
||||
SystemName [ABC: Logic synthesis and verification system.]
|
||||
|
||||
PackageName [Network and node package.]
|
||||
|
||||
Synopsis [Precomputes truth tables for the 2x2 macro cell.]
|
||||
|
||||
Author [Alan Mishchenko]
|
||||
|
||||
Affiliation [UC Berkeley]
|
||||
|
||||
Date [Ver. 1.0. Started - June 20, 2005.]
|
||||
|
||||
Revision [$Id: cutPre22.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
|
||||
|
||||
***********************************************************************/
|
||||
|
||||
#include "cutInt.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
/// DECLARATIONS ///
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define CUT_CELL_MVAR 9
|
||||
|
||||
typedef struct Cut_Cell_t_ Cut_Cell_t;
|
||||
typedef struct Cut_CMan_t_ Cut_CMan_t;
|
||||
|
||||
struct Cut_Cell_t_
|
||||
{
|
||||
Cut_Cell_t * pNext; // pointer to the next cell in the table
|
||||
Cut_Cell_t * pNextVar; // pointer to the next cell of this support size
|
||||
Cut_Cell_t * pParent; // pointer to the cell used to derive this one
|
||||
int nUsed; // the number of times the cell is used
|
||||
char Box[4]; // functions in the boxes
|
||||
unsigned nVars : 4; // the number of variables
|
||||
unsigned CrossBar0 : 4; // the variable set equal
|
||||
unsigned CrossBar1 : 4; // the variable set equal
|
||||
unsigned CrossBarPhase : 2; // the phase of the cross bar (0, 1, or 2)
|
||||
unsigned CanonPhase : 18; // the canonical phase
|
||||
char CanonPerm[CUT_CELL_MVAR+3]; // semicanonical permutation
|
||||
short Store[2*CUT_CELL_MVAR]; // minterm counts in the cofactors
|
||||
unsigned uTruth[1<<(CUT_CELL_MVAR-5)]; // the current truth table
|
||||
};
|
||||
|
||||
struct Cut_CMan_t_
|
||||
{
|
||||
// storage for canonical cells
|
||||
Extra_MmFixed_t * pMem;
|
||||
st_table * tTable;
|
||||
Cut_Cell_t * pSameVar[CUT_CELL_MVAR+1];
|
||||
// elementary truth tables
|
||||
unsigned uInputs[CUT_CELL_MVAR][1<<(CUT_CELL_MVAR-5)];
|
||||
// temporary truth tables
|
||||
unsigned uTemp1[22][1<<(CUT_CELL_MVAR-5)];
|
||||
unsigned uTemp2[22][1<<(CUT_CELL_MVAR-5)];
|
||||
unsigned uTemp3[22][1<<(CUT_CELL_MVAR-5)];
|
||||
unsigned uFinal[1<<(CUT_CELL_MVAR-5)];
|
||||
unsigned puAux[1<<(CUT_CELL_MVAR-5)];
|
||||
// statistical variables
|
||||
int nTotal;
|
||||
int nGood;
|
||||
int nVarCounts[CUT_CELL_MVAR+1];
|
||||
int nSymGroups[CUT_CELL_MVAR+1];
|
||||
int nSymGroupsE[CUT_CELL_MVAR+1];
|
||||
int timeCanon;
|
||||
int timeSupp;
|
||||
int timeTable;
|
||||
int nCellFound;
|
||||
int nCellNotFound;
|
||||
};
|
||||
|
||||
// NP-classes of functions of 3 variables (22)
|
||||
static char * s_NP3[22] = {
|
||||
" 0\n", // 00 const 0 // 0 vars
|
||||
" 1\n", // 01 const 1 // 0 vars
|
||||
"1 1\n", // 02 a // 1 vars
|
||||
"11 1\n", // 03 ab // 2 vars
|
||||
"11 0\n", // 04 (ab)' // 2 vars
|
||||
"10 1\n01 1\n", // 05 a<+>b // 2 vars
|
||||
"111 1\n", // 06 0s abc // 3 vars
|
||||
"111 0\n", // 07 (abc)' //
|
||||
"11- 1\n1-1 1\n", // 08 1p a(b+c) //
|
||||
"11- 0\n1-1 0\n", // 09 (a(b+c))' //
|
||||
"111 1\n100 1\n010 1\n001 1\n", // 10 2s a<+>b<+>c //
|
||||
"10- 0\n1-0 0\n011 0\n", // 11 3p a<+>bc //
|
||||
"101 1\n110 1\n", // 12 4p a(b<+>c) //
|
||||
"101 0\n110 0\n", // 13 (a(b<+>c))' //
|
||||
"11- 1\n1-1 1\n-11 1\n", // 14 5s ab+bc+ac //
|
||||
"111 1\n000 1\n", // 15 6s abc+a'b'c' //
|
||||
"111 0\n000 0\n", // 16 (abc+a'b'c')' //
|
||||
"11- 1\n-11 1\n0-1 1\n", // 17 7 ab+bc+a'c //
|
||||
"011 1\n101 1\n110 1\n", // 18 8s a'bc+ab'c+abc' //
|
||||
"011 0\n101 0\n110 0\n", // 19 (a'bc+ab'c+abc')' //
|
||||
"100 1\n-11 1\n", // 20 9p ab'c'+bc //
|
||||
"100 0\n-11 0\n" // 21 (ab'c'+bc)' //
|
||||
};
|
||||
|
||||
// NP-classes of functions of 3 variables (22)
|
||||
static char * s_NP3Names[22] = {
|
||||
" const 0 ",
|
||||
" const 1 ",
|
||||
" a ",
|
||||
" ab ",
|
||||
" (ab)' ",
|
||||
" a<+>b ",
|
||||
"0s abc ",
|
||||
" (abc)' ",
|
||||
"1p a(b+c) ",
|
||||
" (a(b+c))' ",
|
||||
"2s a<+>b<+>c ",
|
||||
"3p a<+>bc ",
|
||||
"4p a(b<+>c) ",
|
||||
" (a(b<+>c))' ",
|
||||
"5s ab+bc+ac ",
|
||||
"6s abc+a'b'c' ",
|
||||
" (abc+a'b'c')' ",
|
||||
"7 ab+bc+a'c ",
|
||||
"8s a'bc+ab'c+abc' ",
|
||||
" (a'bc+ab'c+abc')' ",
|
||||
"9p ab'c'+bc ",
|
||||
" (ab'c'+bc)' "
|
||||
};
|
||||
|
||||
// the number of variables in each function
|
||||
static int s_NP3VarNums[22] = { 0, 0, 1, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 };
|
||||
|
||||
// NPN classes of functions of exactly 3 inputs (10)
|
||||
static int s_NPNe3[10] = { 6, 8, 10, 11, 12, 14, 15, 17, 18, 20 };
|
||||
|
||||
// NPN classes of functions of exactly 3 inputs that are symmetric (5)
|
||||
static int s_NPNe3s[10] = { 6, 10, 14, 15, 18 };
|
||||
|
||||
// NPN classes of functions of exactly 3 inputs (4)
|
||||
static int s_NPNe3p[10] = { 8, 11, 12, 20 };
|
||||
|
||||
static Cut_CMan_t * Cut_CManStart();
|
||||
static void Cut_CManStop( Cut_CMan_t * p );
|
||||
static void Cut_CellTruthElem( unsigned * InA, unsigned * InB, unsigned * InC, unsigned * pOut, int nVars, int Type );
|
||||
static void Cut_CellCanonicize( Cut_CMan_t * p, Cut_Cell_t * pCell );
|
||||
static int Cut_CellTableLookup( Cut_CMan_t * p, Cut_Cell_t * pCell );
|
||||
static void Cut_CellSuppMin( Cut_Cell_t * pCell );
|
||||
static void Cut_CellCrossBar( Cut_Cell_t * pCell );
|
||||
|
||||
|
||||
static Cut_CMan_t * s_pCMan = NULL;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
/// FUNCTION DEFINITIONS ///
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Start the precomputation manager.]
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void Cut_CellLoad()
|
||||
{
|
||||
FILE * pFile;
|
||||
char * pFileName = "cells22_daomap_iwls.txt";
|
||||
char pString[1000];
|
||||
Cut_CMan_t * p;
|
||||
Cut_Cell_t * pCell;
|
||||
int Length; //, i;
|
||||
pFile = fopen( pFileName, "r" );
|
||||
if ( pFile == NULL )
|
||||
{
|
||||
printf( "Cannot open file \"%s\".\n", pFileName );
|
||||
return;
|
||||
}
|
||||
// start the manager
|
||||
p = Cut_CManStart();
|
||||
// load truth tables
|
||||
while ( fgets(pString, 1000, pFile) )
|
||||
{
|
||||
Length = strlen(pString);
|
||||
pString[Length--] = 0;
|
||||
if ( Length == 0 )
|
||||
continue;
|
||||
// derive the cell
|
||||
pCell = (Cut_Cell_t *)Extra_MmFixedEntryFetch( p->pMem );
|
||||
memset( pCell, 0, sizeof(Cut_Cell_t) );
|
||||
pCell->nVars = Extra_Base2Log(Length*4);
|
||||
pCell->nUsed = 1;
|
||||
// Extra_TruthCopy( pCell->uTruth, pTruth, nVars );
|
||||
Extra_ReadHexadecimal( pCell->uTruth, pString, pCell->nVars );
|
||||
Cut_CellSuppMin( pCell );
|
||||
/*
|
||||
// set the elementary permutation
|
||||
for ( i = 0; i < (int)pCell->nVars; i++ )
|
||||
pCell->CanonPerm[i] = i;
|
||||
// canonicize
|
||||
pCell->CanonPhase = Extra_TruthSemiCanonicize( pCell->uTruth, p->puAux, pCell->nVars, pCell->CanonPerm, pCell->Store );
|
||||
*/
|
||||
// add to the table
|
||||
p->nTotal++;
|
||||
|
||||
// Extra_PrintHexadecimal( stdout, pCell->uTruth, pCell->nVars ); printf( "\n" );
|
||||
// if ( p->nTotal == 500 )
|
||||
// break;
|
||||
|
||||
if ( !Cut_CellTableLookup( p, pCell ) ) // new cell
|
||||
p->nGood++;
|
||||
}
|
||||
printf( "Read %d cells from file \"%s\". Added %d cells to the table.\n", p->nTotal, pFileName, p->nGood );
|
||||
fclose( pFile );
|
||||
// return p;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Precomputes truth tables for the 2x2 macro cell.]
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void Cut_CellPrecompute()
|
||||
{
|
||||
Cut_CMan_t * p;
|
||||
Cut_Cell_t * pCell, * pTemp;
|
||||
int i1, i2, i3, i, j, k, c, clk = clock(), clk2 = clock();
|
||||
|
||||
p = Cut_CManStart();
|
||||
|
||||
// precompute truth tables
|
||||
for ( i = 0; i < 22; i++ )
|
||||
Cut_CellTruthElem( p->uInputs[0], p->uInputs[1], p->uInputs[2], p->uTemp1[i], 9, i );
|
||||
for ( i = 0; i < 22; i++ )
|
||||
Cut_CellTruthElem( p->uInputs[3], p->uInputs[4], p->uInputs[5], p->uTemp2[i], 9, i );
|
||||
for ( i = 0; i < 22; i++ )
|
||||
Cut_CellTruthElem( p->uInputs[6], p->uInputs[7], p->uInputs[8], p->uTemp3[i], 9, i );
|
||||
/*
|
||||
if ( k == 8 && ((i1 == 6 && i2 == 14 && i3 == 20) || (i1 == 20 && i2 == 6 && i3 == 14)) )
|
||||
{
|
||||
Extra_PrintBinary( stdout, &pCell->CanonPhase, pCell->nVars+1 ); printf( " : " );
|
||||
for ( i = 0; i < pCell->nVars; i++ )
|
||||
printf( "%d=%d/%d ", pCell->CanonPerm[i], pCell->Store[2*i], pCell->Store[2*i+1] );
|
||||
Extra_PrintHexadecimal( stdout, pCell->uTruth, pCell->nVars );
|
||||
printf( "\n" );
|
||||
}
|
||||
*/
|
||||
/*
|
||||
// go through symmetric roots
|
||||
for ( k = 0; k < 5; k++ )
|
||||
for ( i1 = 0; i1 < 22; i1++ )
|
||||
for ( i2 = i1; i2 < 22; i2++ )
|
||||
for ( i3 = i2; i3 < 22; i3++ )
|
||||
{
|
||||
// derive the cell
|
||||
pCell = (Cut_Cell_t *)Extra_MmFixedEntryFetch( p->pMem );
|
||||
memset( pCell, 0, sizeof(Cut_Cell_t) );
|
||||
pCell->nVars = 9;
|
||||
pCell->Box[0] = s_NPNe3s[k];
|
||||
pCell->Box[1] = i1;
|
||||
pCell->Box[2] = i2;
|
||||
pCell->Box[3] = i3;
|
||||
// fill in the truth table
|
||||
Cut_CellTruthElem( p->uTemp1[i1], p->uTemp2[i2], p->uTemp3[i3], pCell->uTruth, 9, s_NPNe3s[k] );
|
||||
// canonicize
|
||||
Cut_CellCanonicize( pCell );
|
||||
|
||||
// add to the table
|
||||
p->nTotal++;
|
||||
if ( Cut_CellTableLookup( p, pCell ) ) // already exists
|
||||
Extra_MmFixedEntryRecycle( p->pMem, (char *)pCell );
|
||||
else
|
||||
p->nGood++;
|
||||
}
|
||||
|
||||
// go through partially symmetric roots
|
||||
for ( k = 0; k < 4; k++ )
|
||||
for ( i1 = 0; i1 < 22; i1++ )
|
||||
for ( i2 = 0; i2 < 22; i2++ )
|
||||
for ( i3 = i2; i3 < 22; i3++ )
|
||||
{
|
||||
// derive the cell
|
||||
pCell = (Cut_Cell_t *)Extra_MmFixedEntryFetch( p->pMem );
|
||||
memset( pCell, 0, sizeof(Cut_Cell_t) );
|
||||
pCell->nVars = 9;
|
||||
pCell->Box[0] = s_NPNe3p[k];
|
||||
pCell->Box[1] = i1;
|
||||
pCell->Box[2] = i2;
|
||||
pCell->Box[3] = i3;
|
||||
// fill in the truth table
|
||||
Cut_CellTruthElem( p->uTemp1[i1], p->uTemp2[i2], p->uTemp3[i3], pCell->uTruth, 9, s_NPNe3p[k] );
|
||||
// canonicize
|
||||
Cut_CellCanonicize( pCell );
|
||||
|
||||
// add to the table
|
||||
p->nTotal++;
|
||||
if ( Cut_CellTableLookup( p, pCell ) ) // already exists
|
||||
Extra_MmFixedEntryRecycle( p->pMem, (char *)pCell );
|
||||
else
|
||||
p->nGood++;
|
||||
}
|
||||
|
||||
// go through non-symmetric functions
|
||||
for ( i1 = 0; i1 < 22; i1++ )
|
||||
for ( i2 = 0; i2 < 22; i2++ )
|
||||
for ( i3 = 0; i3 < 22; i3++ )
|
||||
{
|
||||
// derive the cell
|
||||
pCell = (Cut_Cell_t *)Extra_MmFixedEntryFetch( p->pMem );
|
||||
memset( pCell, 0, sizeof(Cut_Cell_t) );
|
||||
pCell->nVars = 9;
|
||||
pCell->Box[0] = 17;
|
||||
pCell->Box[1] = i1;
|
||||
pCell->Box[2] = i2;
|
||||
pCell->Box[3] = i3;
|
||||
// fill in the truth table
|
||||
Cut_CellTruthElem( p->uTemp1[i1], p->uTemp2[i2], p->uTemp3[i3], pCell->uTruth, 9, 17 );
|
||||
// canonicize
|
||||
Cut_CellCanonicize( pCell );
|
||||
|
||||
// add to the table
|
||||
p->nTotal++;
|
||||
if ( Cut_CellTableLookup( p, pCell ) ) // already exists
|
||||
Extra_MmFixedEntryRecycle( p->pMem, (char *)pCell );
|
||||
else
|
||||
p->nGood++;
|
||||
}
|
||||
*/
|
||||
|
||||
// go through non-symmetric functions
|
||||
for ( k = 0; k < 10; k++ )
|
||||
for ( i1 = 0; i1 < 22; i1++ )
|
||||
for ( i2 = 0; i2 < 22; i2++ )
|
||||
for ( i3 = 0; i3 < 22; i3++ )
|
||||
{
|
||||
// derive the cell
|
||||
pCell = (Cut_Cell_t *)Extra_MmFixedEntryFetch( p->pMem );
|
||||
memset( pCell, 0, sizeof(Cut_Cell_t) );
|
||||
pCell->nVars = 9;
|
||||
pCell->Box[0] = s_NPNe3[k];
|
||||
pCell->Box[1] = i1;
|
||||
pCell->Box[2] = i2;
|
||||
pCell->Box[3] = i3;
|
||||
// set the elementary permutation
|
||||
for ( i = 0; i < (int)pCell->nVars; i++ )
|
||||
pCell->CanonPerm[i] = i;
|
||||
// fill in the truth table
|
||||
Cut_CellTruthElem( p->uTemp1[i1], p->uTemp2[i2], p->uTemp3[i3], pCell->uTruth, 9, s_NPNe3[k] );
|
||||
// minimize the support
|
||||
Cut_CellSuppMin( pCell );
|
||||
|
||||
// canonicize
|
||||
pCell->CanonPhase = Extra_TruthSemiCanonicize( pCell->uTruth, p->puAux, pCell->nVars, pCell->CanonPerm, pCell->Store );
|
||||
|
||||
// add to the table
|
||||
p->nTotal++;
|
||||
if ( Cut_CellTableLookup( p, pCell ) ) // already exists
|
||||
Extra_MmFixedEntryRecycle( p->pMem, (char *)pCell );
|
||||
else
|
||||
{
|
||||
p->nGood++;
|
||||
p->nVarCounts[pCell->nVars]++;
|
||||
|
||||
if ( pCell->nVars )
|
||||
for ( i = 0; i < (int)pCell->nVars-1; i++ )
|
||||
{
|
||||
if ( pCell->Store[2*i] != pCell->Store[2*(i+1)] ) // i and i+1 cannot be symmetric
|
||||
continue;
|
||||
// i and i+1 can be symmetric
|
||||
// find the end of this group
|
||||
for ( j = i+1; j < (int)pCell->nVars; j++ )
|
||||
if ( pCell->Store[2*i] != pCell->Store[2*j] )
|
||||
break;
|
||||
|
||||
if ( pCell->Store[2*i] == pCell->Store[2*i+1] )
|
||||
p->nSymGroupsE[j-i]++;
|
||||
else
|
||||
p->nSymGroups[j-i]++;
|
||||
i = j - 1;
|
||||
}
|
||||
/*
|
||||
if ( pCell->nVars == 3 )
|
||||
{
|
||||
Extra_PrintBinary( stdout, pCell->uTruth, 32 ); printf( "\n" );
|
||||
for ( i = 0; i < (int)pCell->nVars; i++ )
|
||||
printf( "%d=%d/%d ", pCell->CanonPerm[i], pCell->Store[2*i], pCell->Store[2*i+1] );
|
||||
printf( "\n" );
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
printf( "BASIC: Total = %d. Good = %d. Entry = %d. ", p->nTotal, p->nGood, sizeof(Cut_Cell_t) );
|
||||
PRT( "Time", clock() - clk );
|
||||
printf( "Cells: " );
|
||||
for ( i = 0; i <= 9; i++ )
|
||||
printf( "%d=%d ", i, p->nVarCounts[i] );
|
||||
printf( "\nDiffs: " );
|
||||
for ( i = 0; i <= 9; i++ )
|
||||
printf( "%d=%d ", i, p->nSymGroups[i] );
|
||||
printf( "\nEquals: " );
|
||||
for ( i = 0; i <= 9; i++ )
|
||||
printf( "%d=%d ", i, p->nSymGroupsE[i] );
|
||||
printf( "\n" );
|
||||
|
||||
// continue adding new cells using support
|
||||
for ( k = CUT_CELL_MVAR; k > 3; k-- )
|
||||
{
|
||||
for ( pTemp = p->pSameVar[k]; pTemp; pTemp = pTemp->pNextVar )
|
||||
for ( i1 = 0; i1 < k; i1++ )
|
||||
for ( i2 = i1+1; i2 < k; i2++ )
|
||||
for ( c = 0; c < 3; c++ )
|
||||
{
|
||||
// derive the cell
|
||||
pCell = (Cut_Cell_t *)Extra_MmFixedEntryFetch( p->pMem );
|
||||
memset( pCell, 0, sizeof(Cut_Cell_t) );
|
||||
pCell->nVars = pTemp->nVars;
|
||||
pCell->pParent = pTemp;
|
||||
// set the elementary permutation
|
||||
for ( i = 0; i < (int)pCell->nVars; i++ )
|
||||
pCell->CanonPerm[i] = i;
|
||||
// fill in the truth table
|
||||
Extra_TruthCopy( pCell->uTruth, pTemp->uTruth, pTemp->nVars );
|
||||
// create the cross-bar
|
||||
pCell->CrossBar0 = i1;
|
||||
pCell->CrossBar1 = i2;
|
||||
pCell->CrossBarPhase = c;
|
||||
Cut_CellCrossBar( pCell );
|
||||
// minimize the support
|
||||
//clk2 = clock();
|
||||
Cut_CellSuppMin( pCell );
|
||||
//p->timeSupp += clock() - clk2;
|
||||
// canonicize
|
||||
//clk2 = clock();
|
||||
pCell->CanonPhase = Extra_TruthSemiCanonicize( pCell->uTruth, p->puAux, pCell->nVars, pCell->CanonPerm, pCell->Store );
|
||||
//p->timeCanon += clock() - clk2;
|
||||
|
||||
// add to the table
|
||||
//clk2 = clock();
|
||||
p->nTotal++;
|
||||
if ( Cut_CellTableLookup( p, pCell ) ) // already exists
|
||||
Extra_MmFixedEntryRecycle( p->pMem, (char *)pCell );
|
||||
else
|
||||
{
|
||||
p->nGood++;
|
||||
p->nVarCounts[pCell->nVars]++;
|
||||
|
||||
for ( i = 0; i < (int)pCell->nVars-1; i++ )
|
||||
{
|
||||
if ( pCell->Store[2*i] != pCell->Store[2*(i+1)] ) // i and i+1 cannot be symmetric
|
||||
continue;
|
||||
// i and i+1 can be symmetric
|
||||
// find the end of this group
|
||||
for ( j = i+1; j < (int)pCell->nVars; j++ )
|
||||
if ( pCell->Store[2*i] != pCell->Store[2*j] )
|
||||
break;
|
||||
|
||||
if ( pCell->Store[2*i] == pCell->Store[2*i+1] )
|
||||
p->nSymGroupsE[j-i]++;
|
||||
else
|
||||
p->nSymGroups[j-i]++;
|
||||
i = j - 1;
|
||||
}
|
||||
/*
|
||||
if ( pCell->nVars == 3 )
|
||||
{
|
||||
Extra_PrintBinary( stdout, pCell->uTruth, 32 ); printf( "\n" );
|
||||
for ( i = 0; i < (int)pCell->nVars; i++ )
|
||||
printf( "%d=%d/%d ", pCell->CanonPerm[i], pCell->Store[2*i], pCell->Store[2*i+1] );
|
||||
printf( "\n" );
|
||||
}
|
||||
*/
|
||||
}
|
||||
//p->timeTable += clock() - clk2;
|
||||
}
|
||||
|
||||
printf( "VAR %d: Total = %d. Good = %d. Entry = %d. ", k, p->nTotal, p->nGood, sizeof(Cut_Cell_t) );
|
||||
PRT( "Time", clock() - clk );
|
||||
printf( "Cells: " );
|
||||
for ( i = 0; i <= 9; i++ )
|
||||
printf( "%d=%d ", i, p->nVarCounts[i] );
|
||||
printf( "\nDiffs: " );
|
||||
for ( i = 0; i <= 9; i++ )
|
||||
printf( "%d=%d ", i, p->nSymGroups[i] );
|
||||
printf( "\nEquals: " );
|
||||
for ( i = 0; i <= 9; i++ )
|
||||
printf( "%d=%d ", i, p->nSymGroupsE[i] );
|
||||
printf( "\n" );
|
||||
}
|
||||
// printf( "\n" );
|
||||
PRT( "Supp ", p->timeSupp );
|
||||
PRT( "Canon", p->timeCanon );
|
||||
PRT( "Table", p->timeTable );
|
||||
// Cut_CManStop( p );
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Check the table.]
|
||||
|
||||
Description [Returns 1 if such a truth table already exists.]
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
int Cut_CellTableLookup( Cut_CMan_t * p, Cut_Cell_t * pCell )
|
||||
{
|
||||
Cut_Cell_t ** pSlot, * pTemp;
|
||||
unsigned Hash;
|
||||
Hash = Extra_TruthHash( pCell->uTruth, Extra_TruthWordNum( pCell->nVars ) );
|
||||
if ( !st_find_or_add( p->tTable, (char *)Hash, (char ***)&pSlot ) )
|
||||
*pSlot = NULL;
|
||||
for ( pTemp = *pSlot; pTemp; pTemp = pTemp->pNext )
|
||||
{
|
||||
if ( pTemp->nVars != pCell->nVars )
|
||||
continue;
|
||||
if ( Extra_TruthIsEqual(pTemp->uTruth, pCell->uTruth, pCell->nVars) )
|
||||
return 1;
|
||||
}
|
||||
// the entry is new
|
||||
pCell->pNext = *pSlot;
|
||||
*pSlot = pCell;
|
||||
// add it to the variable support list
|
||||
pCell->pNextVar = p->pSameVar[pCell->nVars];
|
||||
p->pSameVar[pCell->nVars] = pCell;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis []
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void Cut_CellSuppMin( Cut_Cell_t * pCell )
|
||||
{
|
||||
static unsigned uTemp[1<<(CUT_CELL_MVAR-5)];
|
||||
unsigned * pIn, * pOut, * pTemp;
|
||||
int i, k, Counter, Temp;
|
||||
|
||||
// go backward through the support variables and remove redundant
|
||||
for ( k = pCell->nVars - 1; k >= 0; k-- )
|
||||
if ( !Extra_TruthVarInSupport(pCell->uTruth, pCell->nVars, k) )
|
||||
{
|
||||
// shift all the variables above this one
|
||||
Counter = 0;
|
||||
pIn = pCell->uTruth; pOut = uTemp;
|
||||
for ( i = k; i < (int)pCell->nVars - 1; i++ )
|
||||
{
|
||||
Extra_TruthSwapAdjacentVars( pOut, pIn, pCell->nVars, i );
|
||||
pTemp = pIn; pIn = pOut; pOut = pTemp;
|
||||
// swap the support vars
|
||||
Temp = pCell->CanonPerm[i];
|
||||
pCell->CanonPerm[i] = pCell->CanonPerm[i+1];
|
||||
pCell->CanonPerm[i+1] = Temp;
|
||||
Counter++;
|
||||
}
|
||||
// return the function back into its place
|
||||
if ( Counter & 1 )
|
||||
Extra_TruthCopy( pOut, pIn, pCell->nVars );
|
||||
// remove one variable
|
||||
pCell->nVars--;
|
||||
// Extra_PrintBinary( stdout, pCell->uTruth, (1<<pCell->nVars) ); printf( "\n" );
|
||||
}
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis []
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void Cut_CellCrossBar( Cut_Cell_t * pCell )
|
||||
{
|
||||
static unsigned uTemp0[1<<(CUT_CELL_MVAR-5)];
|
||||
static unsigned uTemp1[1<<(CUT_CELL_MVAR-5)];
|
||||
Extra_TruthCopy( uTemp0, pCell->uTruth, pCell->nVars );
|
||||
Extra_TruthCopy( uTemp1, pCell->uTruth, pCell->nVars );
|
||||
if ( pCell->CanonPhase == 0 )
|
||||
{
|
||||
Extra_TruthCofactor0( uTemp0, pCell->nVars, pCell->CrossBar0 );
|
||||
Extra_TruthCofactor0( uTemp0, pCell->nVars, pCell->CrossBar1 );
|
||||
Extra_TruthCofactor1( uTemp1, pCell->nVars, pCell->CrossBar0 );
|
||||
Extra_TruthCofactor1( uTemp1, pCell->nVars, pCell->CrossBar1 );
|
||||
}
|
||||
else if ( pCell->CanonPhase == 1 )
|
||||
{
|
||||
Extra_TruthCofactor1( uTemp0, pCell->nVars, pCell->CrossBar0 );
|
||||
Extra_TruthCofactor0( uTemp0, pCell->nVars, pCell->CrossBar1 );
|
||||
Extra_TruthCofactor0( uTemp1, pCell->nVars, pCell->CrossBar0 );
|
||||
Extra_TruthCofactor1( uTemp1, pCell->nVars, pCell->CrossBar1 );
|
||||
}
|
||||
else if ( pCell->CanonPhase == 2 )
|
||||
{
|
||||
Extra_TruthCofactor0( uTemp0, pCell->nVars, pCell->CrossBar0 );
|
||||
Extra_TruthCofactor1( uTemp0, pCell->nVars, pCell->CrossBar1 );
|
||||
Extra_TruthCofactor1( uTemp1, pCell->nVars, pCell->CrossBar0 );
|
||||
Extra_TruthCofactor0( uTemp1, pCell->nVars, pCell->CrossBar1 );
|
||||
}
|
||||
else assert( 0 );
|
||||
Extra_TruthCombine( pCell->uTruth, uTemp0, uTemp1, pCell->nVars, pCell->CrossBar0 );
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis []
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void Cut_CellTruthElem( unsigned * InA, unsigned * InB, unsigned * InC, unsigned * pOut, int nVars, int Type )
|
||||
{
|
||||
int nWords = Extra_TruthWordNum( nVars );
|
||||
int i;
|
||||
|
||||
assert( Type < 22 );
|
||||
switch ( Type )
|
||||
{
|
||||
// " 0\n", // 00 const 0
|
||||
case 0:
|
||||
for ( i = 0; i < nWords; i++ )
|
||||
pOut[i] = 0;
|
||||
return;
|
||||
// " 1\n", // 01 const 1
|
||||
case 1:
|
||||
for ( i = 0; i < nWords; i++ )
|
||||
pOut[i] = 0xFFFFFFFF;
|
||||
return;
|
||||
// "1 1\n", // 02 a
|
||||
case 2:
|
||||
for ( i = 0; i < nWords; i++ )
|
||||
pOut[i] = InA[i];
|
||||
return;
|
||||
// "11 1\n", // 03 ab
|
||||
case 3:
|
||||
for ( i = 0; i < nWords; i++ )
|
||||
pOut[i] = InA[i] & InB[i];
|
||||
return;
|
||||
// "11 0\n", // 04 (ab)'
|
||||
case 4:
|
||||
for ( i = 0; i < nWords; i++ )
|
||||
pOut[i] = ~(InA[i] & InB[i]);
|
||||
return;
|
||||
// "10 1\n01 1\n", // 05 a<+>b
|
||||
case 5:
|
||||
for ( i = 0; i < nWords; i++ )
|
||||
pOut[i] = InA[i] ^ InB[i];
|
||||
return;
|
||||
// "111 1\n", // 06 + abc
|
||||
case 6:
|
||||
for ( i = 0; i < nWords; i++ )
|
||||
pOut[i] = InA[i] & InB[i] & InC[i];
|
||||
return;
|
||||
// "111 0\n", // 07 (abc)'
|
||||
case 7:
|
||||
for ( i = 0; i < nWords; i++ )
|
||||
pOut[i] = ~(InA[i] & InB[i] & InC[i]);
|
||||
return;
|
||||
// "11- 1\n1-1 1\n", // 08 + a(b+c)
|
||||
case 8:
|
||||
for ( i = 0; i < nWords; i++ )
|
||||
pOut[i] = InA[i] & (InB[i] | InC[i]);
|
||||
return;
|
||||
// "11- 0\n1-1 0\n", // 09 (a(b+c))'
|
||||
case 9:
|
||||
for ( i = 0; i < nWords; i++ )
|
||||
pOut[i] = ~(InA[i] & (InB[i] | InC[i]));
|
||||
return;
|
||||
// "111 1\n100 1\n010 1\n001 1\n", // 10 + a<+>b<+>c
|
||||
case 10:
|
||||
for ( i = 0; i < nWords; i++ )
|
||||
pOut[i] = InA[i] ^ InB[i] ^ InC[i];
|
||||
return;
|
||||
// "10- 0\n1-0 0\n011 0\n", // 11 + a<+>bc
|
||||
case 11:
|
||||
for ( i = 0; i < nWords; i++ )
|
||||
pOut[i] = InA[i] ^ (InB[i] & InC[i]);
|
||||
return;
|
||||
// "101 1\n110 1\n", // 12 + a(b<+>c)
|
||||
case 12:
|
||||
for ( i = 0; i < nWords; i++ )
|
||||
pOut[i] = InA[i] & (InB[i] ^ InC[i]);
|
||||
return;
|
||||
// "101 0\n110 0\n", // 13 (a(b<+>c))'
|
||||
case 13:
|
||||
for ( i = 0; i < nWords; i++ )
|
||||
pOut[i] = ~(InA[i] & (InB[i] ^ InC[i]));
|
||||
return;
|
||||
// "11- 1\n1-1 1\n-11 1\n", // 14 + ab+bc+ac
|
||||
case 14:
|
||||
for ( i = 0; i < nWords; i++ )
|
||||
pOut[i] = (InA[i] & InB[i]) | (InB[i] & InC[i]) | (InA[i] & InC[i]);
|
||||
return;
|
||||
// "111 1\n000 1\n", // 15 + abc+a'b'c'
|
||||
case 15:
|
||||
for ( i = 0; i < nWords; i++ )
|
||||
pOut[i] = (InA[i] & InB[i] & InC[i]) | (~InA[i] & ~InB[i] & ~InC[i]);
|
||||
return;
|
||||
// "111 0\n000 0\n", // 16 (abc+a'b'c')'
|
||||
case 16:
|
||||
for ( i = 0; i < nWords; i++ )
|
||||
pOut[i] = ~((InA[i] & InB[i] & InC[i]) | (~InA[i] & ~InB[i] & ~InC[i]));
|
||||
return;
|
||||
// "11- 1\n-11 1\n0-1 1\n", // 17 + ab+bc+a'c
|
||||
case 17:
|
||||
for ( i = 0; i < nWords; i++ )
|
||||
pOut[i] = (InA[i] & InB[i]) | (InB[i] & InC[i]) | (~InA[i] & InC[i]);
|
||||
return;
|
||||
// "011 1\n101 1\n110 1\n", // 18 + a'bc+ab'c+abc'
|
||||
case 18:
|
||||
for ( i = 0; i < nWords; i++ )
|
||||
pOut[i] = (~InA[i] & InB[i] & InC[i]) | (InA[i] & ~InB[i] & InC[i]) | (InA[i] & InB[i] & ~InC[i]);
|
||||
return;
|
||||
// "011 0\n101 0\n110 0\n", // 19 (a'bc+ab'c+abc')'
|
||||
case 19:
|
||||
for ( i = 0; i < nWords; i++ )
|
||||
pOut[i] = ~((~InA[i] & InB[i] & InC[i]) | (InA[i] & ~InB[i] & InC[i]) | (InA[i] & InB[i] & ~InC[i]));
|
||||
return;
|
||||
// "100 1\n-11 1\n", // 20 + ab'c'+bc
|
||||
case 20:
|
||||
for ( i = 0; i < nWords; i++ )
|
||||
pOut[i] = (InA[i] & ~InB[i] & ~InC[i]) | (InB[i] & InC[i]);
|
||||
return;
|
||||
// "100 0\n-11 0\n" // 21 (ab'c'+bc)'
|
||||
case 21:
|
||||
for ( i = 0; i < nWords; i++ )
|
||||
pOut[i] = ~((InA[i] & ~InB[i] & ~InC[i]) | (InB[i] & InC[i]));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Start the precomputation manager.]
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
Cut_CMan_t * Cut_CManStart()
|
||||
{
|
||||
Cut_CMan_t * p;
|
||||
int i, k;
|
||||
// start the manager
|
||||
assert( sizeof(unsigned) == 4 );
|
||||
p = ALLOC( Cut_CMan_t, 1 );
|
||||
memset( p, 0, sizeof(Cut_CMan_t) );
|
||||
// start the table and the memory manager
|
||||
p->tTable = st_init_table(st_ptrcmp,st_ptrhash);
|
||||
p->pMem = Extra_MmFixedStart( sizeof(Cut_Cell_t) );
|
||||
// set elementary truth tables
|
||||
for ( k = 0; k < CUT_CELL_MVAR; k++ )
|
||||
for ( i = 0; i < (1<<CUT_CELL_MVAR); i++ )
|
||||
if ( i & (1 << k) )
|
||||
p->uInputs[k][i>>5] |= (1 << (i&31));
|
||||
s_pCMan = p;
|
||||
return p;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis []
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void Cut_CManStop( Cut_CMan_t * p )
|
||||
{
|
||||
st_free_table( p->tTable );
|
||||
Extra_MmFixedStop( p->pMem, 0 );
|
||||
free( p );
|
||||
}
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis []
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
int Cut_CellIsRunning()
|
||||
{
|
||||
return s_pCMan != NULL;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis []
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void Cut_CellDumpToFile()
|
||||
{
|
||||
FILE * pFile;
|
||||
Cut_CMan_t * p = s_pCMan;
|
||||
Cut_Cell_t * pTemp;
|
||||
char * pFileName = "celllib22.txt";
|
||||
int NumUsed[10][5] = {{0}};
|
||||
int BoxUsed[22][5] = {{0}};
|
||||
int i, k, Counter;
|
||||
int clk = clock();
|
||||
|
||||
if ( p == NULL )
|
||||
{
|
||||
printf( "Cut_CellDumpToFile: Cell manager is not defined.\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
// count the number of cells used
|
||||
for ( k = CUT_CELL_MVAR; k >= 0; k-- )
|
||||
{
|
||||
for ( pTemp = p->pSameVar[k]; pTemp; pTemp = pTemp->pNextVar )
|
||||
{
|
||||
if ( pTemp->nUsed == 0 )
|
||||
NumUsed[k][0]++;
|
||||
else if ( pTemp->nUsed < 10 )
|
||||
NumUsed[k][1]++;
|
||||
else if ( pTemp->nUsed < 100 )
|
||||
NumUsed[k][2]++;
|
||||
else if ( pTemp->nUsed < 1000 )
|
||||
NumUsed[k][3]++;
|
||||
else
|
||||
NumUsed[k][4]++;
|
||||
|
||||
for ( i = 0; i < 4; i++ )
|
||||
if ( pTemp->nUsed == 0 )
|
||||
BoxUsed[ pTemp->Box[i] ][0]++;
|
||||
else if ( pTemp->nUsed < 10 )
|
||||
BoxUsed[ pTemp->Box[i] ][1]++;
|
||||
else if ( pTemp->nUsed < 100 )
|
||||
BoxUsed[ pTemp->Box[i] ][2]++;
|
||||
else if ( pTemp->nUsed < 1000 )
|
||||
BoxUsed[ pTemp->Box[i] ][3]++;
|
||||
else
|
||||
BoxUsed[ pTemp->Box[i] ][4]++;
|
||||
}
|
||||
}
|
||||
|
||||
printf( "Functions found = %10d. Functions not found = %10d.\n", p->nCellFound, p->nCellNotFound );
|
||||
for ( k = 0; k <= CUT_CELL_MVAR; k++ )
|
||||
{
|
||||
printf( "%3d : ", k );
|
||||
for ( i = 0; i < 5; i++ )
|
||||
printf( "%8d ", NumUsed[k][i] );
|
||||
printf( "\n" );
|
||||
}
|
||||
printf( "Box usage:\n" );
|
||||
for ( k = 0; k < 22; k++ )
|
||||
{
|
||||
printf( "%3d : ", k );
|
||||
for ( i = 0; i < 5; i++ )
|
||||
printf( "%8d ", BoxUsed[k][i] );
|
||||
printf( " %s", s_NP3Names[k] );
|
||||
printf( "\n" );
|
||||
}
|
||||
|
||||
pFile = fopen( pFileName, "w" );
|
||||
if ( pFile == NULL )
|
||||
{
|
||||
printf( "Cut_CellDumpToFile: Cannout open output file.\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
Counter = 0;
|
||||
for ( k = 0; k <= CUT_CELL_MVAR; k++ )
|
||||
{
|
||||
for ( pTemp = p->pSameVar[k]; pTemp; pTemp = pTemp->pNextVar )
|
||||
if ( pTemp->nUsed > 0 )
|
||||
{
|
||||
Extra_PrintHexadecimal( pFile, pTemp->uTruth, (k <= 5? 5 : k) );
|
||||
fprintf( pFile, "\n" );
|
||||
Counter++;
|
||||
}
|
||||
fprintf( pFile, "\n" );
|
||||
}
|
||||
fclose( pFile );
|
||||
|
||||
printf( "Library composed of %d functions is written into file \"%s\". ", Counter, pFileName );
|
||||
|
||||
PRT( "Time", clock() - clk );
|
||||
}
|
||||
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Looks up if the given function exists in the hash table.]
|
||||
|
||||
Description [If the function exists, returns 1, meaning that it can be
|
||||
implemented using two levels of 3-input LUTs. If the function does not
|
||||
exist, return 0.]
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
int Cut_CellTruthLookup( unsigned * pTruth, int nVars )
|
||||
{
|
||||
Cut_CMan_t * p = s_pCMan;
|
||||
Cut_Cell_t * pTemp;
|
||||
Cut_Cell_t Cell, * pCell = &Cell;
|
||||
unsigned Hash;
|
||||
int i;
|
||||
|
||||
// cell manager is not defined
|
||||
if ( p == NULL )
|
||||
{
|
||||
printf( "Cut_CellTruthLookup: Cell manager is not defined.\n" );
|
||||
return 0;
|
||||
}
|
||||
|
||||
// canonicize
|
||||
memset( pCell, 0, sizeof(Cut_Cell_t) );
|
||||
pCell->nVars = nVars;
|
||||
Extra_TruthCopy( pCell->uTruth, pTruth, nVars );
|
||||
Cut_CellSuppMin( pCell );
|
||||
// set the elementary permutation
|
||||
for ( i = 0; i < (int)pCell->nVars; i++ )
|
||||
pCell->CanonPerm[i] = i;
|
||||
// canonicize
|
||||
pCell->CanonPhase = Extra_TruthSemiCanonicize( pCell->uTruth, p->puAux, pCell->nVars, pCell->CanonPerm, pCell->Store );
|
||||
|
||||
|
||||
// check if the cell exists
|
||||
Hash = Extra_TruthHash( pCell->uTruth, Extra_TruthWordNum(pCell->nVars) );
|
||||
if ( st_lookup( p->tTable, (char *)Hash, (char **)&pTemp ) )
|
||||
{
|
||||
for ( ; pTemp; pTemp = pTemp->pNext )
|
||||
{
|
||||
if ( pTemp->nVars != pCell->nVars )
|
||||
continue;
|
||||
if ( Extra_TruthIsEqual(pTemp->uTruth, pCell->uTruth, pCell->nVars) )
|
||||
{
|
||||
pTemp->nUsed++;
|
||||
p->nCellFound++;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
p->nCellNotFound++;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
/// END OF FILE ///
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
|
@ -45,6 +45,8 @@ Cut_Man_t * Cut_ManStart( Cut_Params_t * pParams )
|
|||
{
|
||||
Cut_Man_t * p;
|
||||
int clk = clock();
|
||||
// extern int nTruthDsd;
|
||||
// nTruthDsd = 0;
|
||||
assert( pParams->nVarsMax >= 3 && pParams->nVarsMax <= CUT_SIZE_MAX );
|
||||
p = ALLOC( Cut_Man_t, 1 );
|
||||
memset( p, 0, sizeof(Cut_Man_t) );
|
||||
|
|
@ -114,6 +116,9 @@ void Cut_ManStop( Cut_Man_t * p )
|
|||
{
|
||||
Cut_Cut_t * pCut;
|
||||
int i;
|
||||
// extern int nTruthDsd;
|
||||
// printf( "Decomposable cuts = %d.\n", nTruthDsd );
|
||||
|
||||
Vec_PtrForEachEntry( p->vCutsNew, pCut, i )
|
||||
if ( pCut != NULL )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -779,7 +779,7 @@ Cut_CMan_t * Cut_CManStart()
|
|||
for ( k = 0; k < CUT_CELL_MVAR; k++ )
|
||||
for ( i = 0; i < (1<<CUT_CELL_MVAR); i++ )
|
||||
if ( i & (1 << k) )
|
||||
p->uInputs[k][i/32] |= (1 << (i%32));
|
||||
p->uInputs[k][i>>5] |= (1 << (i&31));
|
||||
s_pCMan = p;
|
||||
return p;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -189,6 +189,9 @@ void Cut_TruthCompute( Cut_Man_t * p, Cut_Cut_t * pCut, Cut_Cut_t * pCut0, Cut_C
|
|||
Extra_TruthNand( Cut_CutReadTruth(pCut), p->puTemp[2], p->puTemp[3], pCut->nVarsMax );
|
||||
else
|
||||
Extra_TruthAnd( Cut_CutReadTruth(pCut), p->puTemp[2], p->puTemp[3], pCut->nVarsMax );
|
||||
|
||||
// Ivy_TruthTestOne( *Cut_CutReadTruth(pCut) );
|
||||
|
||||
// quit if no fancy computation is needed
|
||||
if ( !p->pParams->fFancy )
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
#include "abc.h"
|
||||
#include "dec.h"
|
||||
//#include "aig.h"
|
||||
#include "ivy.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
/// DECLARATIONS ///
|
||||
|
|
@ -238,6 +239,41 @@ Aig_Node_t * Dec_GraphToNetworkAig( Aig_Man_t * pMan, Dec_Graph_t * pGraph )
|
|||
}
|
||||
*/
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Transforms the decomposition graph into the AIG.]
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
|
||||
Ivy_Obj_t * Dec_GraphToNetworkIvy( Ivy_Man_t * pMan, Dec_Graph_t * pGraph )
|
||||
{
|
||||
Dec_Node_t * pNode;
|
||||
Ivy_Obj_t * pAnd0, * pAnd1;
|
||||
int i;
|
||||
// check for constant function
|
||||
if ( Dec_GraphIsConst(pGraph) )
|
||||
return Ivy_NotCond( Ivy_ManConst1(pMan), Dec_GraphIsComplement(pGraph) );
|
||||
// check for a literal
|
||||
if ( Dec_GraphIsVar(pGraph) )
|
||||
return Ivy_NotCond( Dec_GraphVar(pGraph)->pFunc, Dec_GraphIsComplement(pGraph) );
|
||||
// build the AIG nodes corresponding to the AND gates of the graph
|
||||
Dec_GraphForEachNode( pGraph, pNode, i )
|
||||
{
|
||||
pAnd0 = Ivy_NotCond( Dec_GraphNode(pGraph, pNode->eEdge0.Node)->pFunc, pNode->eEdge0.fCompl );
|
||||
pAnd1 = Ivy_NotCond( Dec_GraphNode(pGraph, pNode->eEdge1.Node)->pFunc, pNode->eEdge1.fCompl );
|
||||
pNode->pFunc = Ivy_And( pAnd0, pAnd1 );
|
||||
}
|
||||
// complement the result if necessary
|
||||
return Ivy_NotCond( pNode->pFunc, Dec_GraphIsComplement(pGraph) );
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
/// END OF FILE ///
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -258,16 +258,15 @@ Dec_Edge_t Dec_FactorTrivial( Dec_Graph_t * pFForm, Mvc_Cover_t * pCover )
|
|||
***********************************************************************/
|
||||
Dec_Edge_t Dec_FactorTrivialCube( Dec_Graph_t * pFForm, Mvc_Cover_t * pCover, Mvc_Cube_t * pCube, Vec_Int_t * vEdgeLits )
|
||||
{
|
||||
// Dec_Edge_t eNode;
|
||||
Dec_Edge_t eNode;
|
||||
int iBit, Value;
|
||||
// create the factored form for each literal
|
||||
Vec_IntClear( vEdgeLits );
|
||||
Mvc_CubeForEachBit( pCover, pCube, iBit, Value )
|
||||
if ( Value )
|
||||
{
|
||||
// eNode = Dec_EdgeCreate( iBit/2, iBit%2 ); // CST
|
||||
// Vec_IntPush( vEdgeLits, Dec_EdgeToInt_(eNode) );
|
||||
Vec_IntPush( vEdgeLits, iBit );
|
||||
eNode = Dec_EdgeCreate( iBit/2, iBit%2 ); // CST
|
||||
Vec_IntPush( vEdgeLits, Dec_EdgeToInt_(eNode) );
|
||||
}
|
||||
// balance the factored forms
|
||||
return Dec_FactorTrivialTree_rec( pFForm, (Dec_Edge_t *)vEdgeLits->pArray, vEdgeLits->nSize, 0 );
|
||||
|
|
|
|||
|
|
@ -37,9 +37,11 @@ extern "C" {
|
|||
/// STRUCTURE DEFINITIONS ///
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __cplusplus
|
||||
#ifndef bool
|
||||
#define bool int
|
||||
#endif
|
||||
#endif
|
||||
|
||||
typedef struct FxuDataStruct Fxu_Data_t;
|
||||
|
||||
|
|
|
|||
|
|
@ -135,6 +135,7 @@ extern void Rwr_ManStop( Rwr_Man_t * p );
|
|||
extern void Rwr_ManPrintStats( Rwr_Man_t * p );
|
||||
extern void Rwr_ManPrintStatsFile( Rwr_Man_t * p );
|
||||
extern void * Rwr_ManReadDecs( Rwr_Man_t * p );
|
||||
extern Vec_Ptr_t * Rwr_ManReadLeaves( Rwr_Man_t * p );
|
||||
extern int Rwr_ManReadCompl( Rwr_Man_t * p );
|
||||
extern void Rwr_ManAddTimeCuts( Rwr_Man_t * p, int Time );
|
||||
extern void Rwr_ManAddTimeUpdate( Rwr_Man_t * p, int Time );
|
||||
|
|
|
|||
|
|
@ -100,9 +100,16 @@ clk = clock();
|
|||
p->nCutsGood++;
|
||||
|
||||
clk2 = clock();
|
||||
/*
|
||||
printf( "Considering: (" );
|
||||
Vec_PtrForEachEntry( p->vFaninsCur, pFanin, i )
|
||||
printf( "%d ", Abc_ObjFanoutNum(Abc_ObjRegular(pFanin)) );
|
||||
printf( ")\n" );
|
||||
*/
|
||||
// mark the fanin boundary
|
||||
Vec_PtrForEachEntry( p->vFaninsCur, pFanin, i )
|
||||
Abc_ObjRegular(pFanin)->vFanouts.nSize++;
|
||||
|
||||
// label MFFC with current ID
|
||||
Abc_NtkIncrementTravId( pNode->pNtk );
|
||||
nNodesSaved = Abc_NodeMffcLabel( pNode );
|
||||
|
|
@ -136,6 +143,8 @@ p->timeRes += clock() - clk;
|
|||
if ( GainBest == -1 )
|
||||
return -1;
|
||||
|
||||
// printf( "%d", nNodesSaveCur - GainBest );
|
||||
|
||||
// copy the leaves
|
||||
Vec_PtrForEachEntry( p->vFanins, pFanin, i )
|
||||
Dec_GraphNode(p->pGraph, i)->pFunc = pFanin;
|
||||
|
|
|
|||
|
|
@ -163,7 +163,11 @@ void Rwr_ManPrintStats( Rwr_Man_t * p )
|
|||
printf( "The scores are:\n" );
|
||||
for ( i = 0; i < 222; i++ )
|
||||
if ( p->nScores[i] > 0 )
|
||||
printf( "%3d = %8d canon = %5d\n", i, p->nScores[i], p->pMapInv[i] );
|
||||
{
|
||||
extern void Ivy_TruthDsdComputePrint( unsigned uTruth );
|
||||
printf( "%3d = %8d canon = %5d ", i, p->nScores[i], p->pMapInv[i] );
|
||||
Ivy_TruthDsdComputePrint( (unsigned)p->pMapInv[i] | ((unsigned)p->pMapInv[i] << 16) );
|
||||
}
|
||||
printf( "\n" );
|
||||
|
||||
}
|
||||
|
|
@ -207,6 +211,22 @@ void * Rwr_ManReadDecs( Rwr_Man_t * p )
|
|||
return p->pGraph;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Stops the resynthesis manager.]
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
Vec_Ptr_t * Rwr_ManReadLeaves( Rwr_Man_t * p )
|
||||
{
|
||||
return p->vFanins;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Stops the resynthesis manager.]
|
||||
|
|
|
|||
|
|
@ -0,0 +1,121 @@
|
|||
/**CFile****************************************************************
|
||||
|
||||
FileName [rwrCut.c]
|
||||
|
||||
SystemName [ABC: Logic synthesis and verification system.]
|
||||
|
||||
PackageName [DAG-aware AIG rewriting package.]
|
||||
|
||||
Synopsis [Cut computation.]
|
||||
|
||||
Author [Alan Mishchenko]
|
||||
|
||||
Affiliation [UC Berkeley]
|
||||
|
||||
Date [Ver. 1.0. Started - June 20, 2005.]
|
||||
|
||||
Revision [$Id: rwrCut.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
|
||||
|
||||
***********************************************************************/
|
||||
|
||||
#include "rwr.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
/// DECLARATIONS ///
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static int pTruths[13719];
|
||||
static int pFreqs[13719];
|
||||
static int pPerm[13719];
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
/// FUNCTION DEFINITIONS ///
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis []
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
int Rwr_TempCompare( int * pNum1, int * pNum2 )
|
||||
{
|
||||
int Freq1 = pFreqs[*pNum1];
|
||||
int Freq2 = pFreqs[*pNum2];
|
||||
if ( Freq1 < Freq2 )
|
||||
return 1;
|
||||
if ( Freq1 > Freq2 )
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis []
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void Rwr_Temp()
|
||||
{
|
||||
char Buffer[32];
|
||||
int nFuncs = 13719;
|
||||
int nEntries = 100;
|
||||
unsigned uTruth;
|
||||
int i, k;
|
||||
FILE * pFile;
|
||||
|
||||
pFile = fopen( "nnclass_stats5.txt", "r" );
|
||||
for ( i = 0; i < 13719; i++ )
|
||||
{
|
||||
fscanf( pFile, "%s%d", Buffer, &pFreqs[i] );
|
||||
Extra_ReadHexadecimal( &uTruth, Buffer+2, 5 );
|
||||
pTruths[i] = uTruth;
|
||||
}
|
||||
fclose( pFile );
|
||||
|
||||
for ( i = 0; i < 13719; i++ )
|
||||
pPerm[i] = i;
|
||||
|
||||
qsort( (void *)pPerm, 13719, sizeof(int),
|
||||
(int (*)(const void *, const void *)) Rwr_TempCompare );
|
||||
|
||||
|
||||
pFile = fopen( "5npn_100.blif", "w" );
|
||||
fprintf( pFile, "# Most frequent NPN classes of 5 vars.\n" );
|
||||
fprintf( pFile, ".model 5npn\n" );
|
||||
fprintf( pFile, ".inputs a b c d e\n" );
|
||||
fprintf( pFile, ".outputs" );
|
||||
for ( i = 0; i < nEntries; i++ )
|
||||
fprintf( pFile, " %02d", i );
|
||||
fprintf( pFile, "\n" );
|
||||
|
||||
for ( i = 0; i < nEntries; i++ )
|
||||
{
|
||||
fprintf( pFile, ".names a b c d e %02d\n", i );
|
||||
uTruth = pTruths[pPerm[i]];
|
||||
for ( k = 0; k < 32; k++ )
|
||||
if ( uTruth & (1 << k) )
|
||||
{
|
||||
Extra_PrintBinary( pFile, &k, 5 );
|
||||
fprintf( pFile, " 1\n" );
|
||||
}
|
||||
}
|
||||
fprintf( pFile, ".end\n" );
|
||||
fclose( pFile );
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
/// END OF FILE ///
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
|
@ -143,8 +143,8 @@ struct Sim_Pat_t_
|
|||
/// MACRO DEFINITIONS ///
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define SIM_NUM_WORDS(n) ((n)/32 + (((n)%32) > 0))
|
||||
#define SIM_LAST_BITS(n) ((((n)%32) > 0)? (n)%32 : 32)
|
||||
#define SIM_NUM_WORDS(n) (((n)>>5) + (((n)&31) > 0))
|
||||
#define SIM_LAST_BITS(n) ((((n)&31) > 0)? (n)&31 : 32)
|
||||
|
||||
#define SIM_MASK_FULL (0xFFFFFFFF)
|
||||
#define SIM_MASK_BEG(n) (SIM_MASK_FULL >> (32-n))
|
||||
|
|
|
|||
|
|
@ -1,8 +0,0 @@
|
|||
SRC += src/opt/xyz/xyzBuild.c \
|
||||
src/opt/xyz/xyzCore.c \
|
||||
src/opt/xyz/xyzMan.c \
|
||||
src/opt/xyz/xyzMinEsop.c \
|
||||
src/opt/xyz/xyzMinMan.c \
|
||||
src/opt/xyz/xyzMinSop.c \
|
||||
src/opt/xyz/xyzMinUtil.c \
|
||||
src/opt/xyz/xyzTest.c
|
||||
|
|
@ -1,110 +0,0 @@
|
|||
/**CFile****************************************************************
|
||||
|
||||
FileName [xyz.h]
|
||||
|
||||
SystemName [ABC: Logic synthesis and verification system.]
|
||||
|
||||
PackageName [Cover manipulation package.]
|
||||
|
||||
Synopsis [External declarations.]
|
||||
|
||||
Author [Alan Mishchenko]
|
||||
|
||||
Affiliation [UC Berkeley]
|
||||
|
||||
Date [Ver. 1.0. Started - June 20, 2005.]
|
||||
|
||||
Revision [$Id: xyz.h,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
|
||||
|
||||
***********************************************************************/
|
||||
|
||||
#ifndef __XYZ_H__
|
||||
#define __XYZ_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "abc.h"
|
||||
#include "xyzInt.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
/// DECLARATIONS ///
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
typedef struct Xyz_Man_t_ Xyz_Man_t;
|
||||
typedef struct Xyz_Obj_t_ Xyz_Obj_t;
|
||||
|
||||
// storage for node information
|
||||
struct Xyz_Obj_t_
|
||||
{
|
||||
Min_Cube_t * pCover[3]; // pos/neg/esop
|
||||
Vec_Int_t * vSupp; // computed support (all nodes except CIs)
|
||||
};
|
||||
|
||||
// storage for additional information
|
||||
struct Xyz_Man_t_
|
||||
{
|
||||
// general characteristics
|
||||
int nFaninMax; // the number of vars
|
||||
int nCubesMax; // the limit on the number of cubes in the intermediate covers
|
||||
int nWords; // the number of words
|
||||
Vec_Int_t * vFanCounts; // fanout counts
|
||||
Vec_Ptr_t * vObjStrs; // object structures
|
||||
void * pMemory; // memory for the internal data strctures
|
||||
Min_Man_t * pManMin; // the cub manager
|
||||
int fUseEsop; // enables ESOPs
|
||||
int fUseSop; // enables SOPs
|
||||
// arrays to map local variables
|
||||
Vec_Int_t * vComTo0; // mapping of common variables into first fanin
|
||||
Vec_Int_t * vComTo1; // mapping of common variables into second fanin
|
||||
Vec_Int_t * vPairs0; // the first var in each pair of common vars
|
||||
Vec_Int_t * vPairs1; // the second var in each pair of common vars
|
||||
Vec_Int_t * vTriv0; // trival support of the first node
|
||||
Vec_Int_t * vTriv1; // trival support of the second node
|
||||
// statistics
|
||||
int nSupps; // supports created
|
||||
int nSuppsMax; // the maximum number of supports
|
||||
int nBoundary; // the boundary size
|
||||
int nNodes; // the number of nodes processed
|
||||
};
|
||||
|
||||
static inline Xyz_Obj_t * Abc_ObjGetStr( Abc_Obj_t * pObj ) { return Vec_PtrEntry(((Xyz_Man_t *)pObj->pNtk->pManCut)->vObjStrs, pObj->Id); }
|
||||
|
||||
static inline void Abc_ObjSetSupp( Abc_Obj_t * pObj, Vec_Int_t * vVec ) { Abc_ObjGetStr(pObj)->vSupp = vVec; }
|
||||
static inline Vec_Int_t * Abc_ObjGetSupp( Abc_Obj_t * pObj ) { return Abc_ObjGetStr(pObj)->vSupp; }
|
||||
|
||||
static inline void Abc_ObjSetCover2( Abc_Obj_t * pObj, Min_Cube_t * pCov ) { Abc_ObjGetStr(pObj)->pCover[2] = pCov; }
|
||||
static inline Min_Cube_t * Abc_ObjGetCover2( Abc_Obj_t * pObj ) { return Abc_ObjGetStr(pObj)->pCover[2]; }
|
||||
|
||||
static inline void Abc_ObjSetCover( Abc_Obj_t * pObj, Min_Cube_t * pCov, int Pol ) { Abc_ObjGetStr(pObj)->pCover[Pol] = pCov; }
|
||||
static inline Min_Cube_t * Abc_ObjGetCover( Abc_Obj_t * pObj, int Pol ) { return Abc_ObjGetStr(pObj)->pCover[Pol]; }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
/// FUNCTION DEFINITIONS ///
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/*=== xyzBuild.c ==========================================================*/
|
||||
extern Abc_Ntk_t * Abc_NtkXyzDerive( Xyz_Man_t * p, Abc_Ntk_t * pNtk );
|
||||
extern Abc_Ntk_t * Abc_NtkXyzDeriveClean( Xyz_Man_t * p, Abc_Ntk_t * pNtk );
|
||||
/*=== xyzCore.c ===========================================================*/
|
||||
extern Abc_Ntk_t * Abc_NtkXyz( Abc_Ntk_t * pNtk, int nFaninMax, bool fUseEsop, bool fUseSop, bool fUseInvs, bool fVerbose );
|
||||
/*=== xyzMan.c ============================================================*/
|
||||
extern Xyz_Man_t * Xyz_ManAlloc( Abc_Ntk_t * pNtk, int nFaninMax );
|
||||
extern void Xyz_ManFree( Xyz_Man_t * p );
|
||||
extern void Abc_NodeXyzDropData( Xyz_Man_t * p, Abc_Obj_t * pObj );
|
||||
/*=== xyzTest.c ===========================================================*/
|
||||
extern Abc_Ntk_t * Abc_NtkXyzTestSop( Abc_Ntk_t * pNtk );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
/// END OF FILE ///
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,379 +0,0 @@
|
|||
/**CFile****************************************************************
|
||||
|
||||
FileName [xyzBuild.c]
|
||||
|
||||
SystemName [ABC: Logic synthesis and verification system.]
|
||||
|
||||
PackageName [Cover manipulation package.]
|
||||
|
||||
Synopsis [Network construction procedures.]
|
||||
|
||||
Author [Alan Mishchenko]
|
||||
|
||||
Affiliation [UC Berkeley]
|
||||
|
||||
Date [Ver. 1.0. Started - June 20, 2005.]
|
||||
|
||||
Revision [$Id: xyzBuild.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
|
||||
|
||||
***********************************************************************/
|
||||
|
||||
#include "xyz.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
/// DECLARATIONS ///
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
/// FUNCTION DEFINITIONS ///
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Derives the decomposed network.]
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
Abc_Obj_t * Abc_NtkXyzDeriveCube( Abc_Ntk_t * pNtkNew, Abc_Obj_t * pObj, Min_Cube_t * pCube, Vec_Int_t * vSupp )
|
||||
{
|
||||
Vec_Int_t * vLits;
|
||||
Abc_Obj_t * pNodeNew, * pFanin;
|
||||
int i, iFanin, Lit;
|
||||
// create empty cube
|
||||
if ( pCube->nLits == 0 )
|
||||
return Abc_NodeCreateConst1(pNtkNew);
|
||||
// get the literals of this cube
|
||||
vLits = Vec_IntAlloc( 10 );
|
||||
Min_CubeGetLits( pCube, vLits );
|
||||
assert( pCube->nLits == (unsigned)vLits->nSize );
|
||||
// create special case when there is only one literal
|
||||
if ( pCube->nLits == 1 )
|
||||
{
|
||||
iFanin = Vec_IntEntry(vLits,0);
|
||||
pFanin = Abc_NtkObj( pObj->pNtk, Vec_IntEntry(vSupp, iFanin) );
|
||||
Lit = Min_CubeGetVar(pCube, iFanin);
|
||||
assert( Lit == 1 || Lit == 2 );
|
||||
Vec_IntFree( vLits );
|
||||
if ( Lit == 1 )// negative
|
||||
return Abc_NodeCreateInv( pNtkNew, pFanin->pCopy );
|
||||
return pFanin->pCopy;
|
||||
}
|
||||
assert( pCube->nLits > 1 );
|
||||
// create the AND cube
|
||||
pNodeNew = Abc_NtkCreateNode( pNtkNew );
|
||||
for ( i = 0; i < vLits->nSize; i++ )
|
||||
{
|
||||
iFanin = Vec_IntEntry(vLits,i);
|
||||
pFanin = Abc_NtkObj( pObj->pNtk, Vec_IntEntry(vSupp, iFanin) );
|
||||
Lit = Min_CubeGetVar(pCube, iFanin);
|
||||
assert( Lit == 1 || Lit == 2 );
|
||||
Vec_IntWriteEntry( vLits, i, Lit==1 );
|
||||
Abc_ObjAddFanin( pNodeNew, pFanin->pCopy );
|
||||
}
|
||||
pNodeNew->pData = Abc_SopCreateAnd( pNtkNew->pManFunc, vLits->nSize, vLits->pArray );
|
||||
Vec_IntFree( vLits );
|
||||
return pNodeNew;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Derives the decomposed network.]
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
Abc_Obj_t * Abc_NtkXyzDeriveNode_rec( Xyz_Man_t * p, Abc_Ntk_t * pNtkNew, Abc_Obj_t * pObj, int Level )
|
||||
{
|
||||
Min_Cube_t * pCover, * pCube;
|
||||
Abc_Obj_t * pFaninNew, * pNodeNew, * pFanin;
|
||||
Vec_Int_t * vSupp;
|
||||
int Entry, nCubes, i;
|
||||
|
||||
if ( Abc_ObjIsCi(pObj) )
|
||||
return pObj->pCopy;
|
||||
assert( Abc_ObjIsNode(pObj) );
|
||||
// skip if already computed
|
||||
if ( pObj->pCopy )
|
||||
return pObj->pCopy;
|
||||
|
||||
// get the support and the cover
|
||||
vSupp = Abc_ObjGetSupp( pObj );
|
||||
pCover = Abc_ObjGetCover2( pObj );
|
||||
assert( vSupp );
|
||||
/*
|
||||
if ( pCover && pCover->nVars - Min_CoverSuppVarNum(p->pManMin, pCover) > 0 )
|
||||
{
|
||||
printf( "%d\n ", pCover->nVars - Min_CoverSuppVarNum(p->pManMin, pCover) );
|
||||
Min_CoverWrite( stdout, pCover );
|
||||
}
|
||||
*/
|
||||
/*
|
||||
// print the support of this node
|
||||
printf( "{ " );
|
||||
Vec_IntForEachEntry( vSupp, Entry, i )
|
||||
printf( "%d ", Entry );
|
||||
printf( "} cubes = %d\n", Min_CoverCountCubes( pCover ) );
|
||||
*/
|
||||
// process the fanins
|
||||
Vec_IntForEachEntry( vSupp, Entry, i )
|
||||
{
|
||||
pFanin = Abc_NtkObj(pObj->pNtk, Entry);
|
||||
Abc_NtkXyzDeriveNode_rec( p, pNtkNew, pFanin, Level+1 );
|
||||
}
|
||||
|
||||
// for each cube, construct the node
|
||||
nCubes = Min_CoverCountCubes( pCover );
|
||||
if ( nCubes == 0 )
|
||||
pNodeNew = Abc_NodeCreateConst0(pNtkNew);
|
||||
else if ( nCubes == 1 )
|
||||
pNodeNew = Abc_NtkXyzDeriveCube( pNtkNew, pObj, pCover, vSupp );
|
||||
else
|
||||
{
|
||||
pNodeNew = Abc_NtkCreateNode( pNtkNew );
|
||||
Min_CoverForEachCube( pCover, pCube )
|
||||
{
|
||||
pFaninNew = Abc_NtkXyzDeriveCube( pNtkNew, pObj, pCube, vSupp );
|
||||
Abc_ObjAddFanin( pNodeNew, pFaninNew );
|
||||
}
|
||||
pNodeNew->pData = Abc_SopCreateXorSpecial( pNtkNew->pManFunc, nCubes );
|
||||
}
|
||||
/*
|
||||
printf( "Created node %d(%d) at level %d: ", pNodeNew->Id, pObj->Id, Level );
|
||||
Vec_IntForEachEntry( vSupp, Entry, i )
|
||||
{
|
||||
pFanin = Abc_NtkObj(pObj->pNtk, Entry);
|
||||
printf( "%d(%d) ", pFanin->pCopy->Id, pFanin->Id );
|
||||
}
|
||||
printf( "\n" );
|
||||
Min_CoverWrite( stdout, pCover );
|
||||
*/
|
||||
pObj->pCopy = pNodeNew;
|
||||
return pNodeNew;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Derives the decomposed network.]
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
Abc_Ntk_t * Abc_NtkXyzDerive( Xyz_Man_t * p, Abc_Ntk_t * pNtk )
|
||||
{
|
||||
Abc_Ntk_t * pNtkNew;
|
||||
Abc_Obj_t * pObj;
|
||||
int i;
|
||||
assert( Abc_NtkIsStrash(pNtk) );
|
||||
// perform strashing
|
||||
pNtkNew = Abc_NtkStartFrom( pNtk, ABC_NTK_LOGIC, ABC_FUNC_SOP );
|
||||
// reconstruct the network
|
||||
Abc_NtkForEachCo( pNtk, pObj, i )
|
||||
{
|
||||
Abc_NtkXyzDeriveNode_rec( p, pNtkNew, Abc_ObjFanin0(pObj), 0 );
|
||||
// printf( "*** CO %s : %d -> %d \n", Abc_ObjName(pObj), pObj->pCopy->Id, Abc_ObjFanin0(pObj)->pCopy->Id );
|
||||
}
|
||||
// add the COs
|
||||
Abc_NtkFinalize( pNtk, pNtkNew );
|
||||
Abc_NtkLogicMakeSimpleCos( pNtkNew, 1 );
|
||||
// make sure everything is okay
|
||||
if ( !Abc_NtkCheck( pNtkNew ) )
|
||||
{
|
||||
printf( "Abc_NtkXyzDerive: The network check has failed.\n" );
|
||||
Abc_NtkDelete( pNtkNew );
|
||||
return NULL;
|
||||
}
|
||||
return pNtkNew;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Derives the decomposed network.]
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
Abc_Obj_t * Abc_NtkXyzDeriveInv( Abc_Ntk_t * pNtkNew, Abc_Obj_t * pObj, int fCompl )
|
||||
{
|
||||
assert( pObj->pCopy );
|
||||
if ( !fCompl )
|
||||
return pObj->pCopy;
|
||||
if ( pObj->pCopy->pCopy == NULL )
|
||||
pObj->pCopy->pCopy = Abc_NodeCreateInv( pNtkNew, pObj->pCopy );
|
||||
return pObj->pCopy->pCopy;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Derives the decomposed network.]
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
Abc_Obj_t * Abc_NtkXyzDeriveCubeInv( Abc_Ntk_t * pNtkNew, Abc_Obj_t * pObj, Min_Cube_t * pCube, Vec_Int_t * vSupp )
|
||||
{
|
||||
Vec_Int_t * vLits;
|
||||
Abc_Obj_t * pNodeNew, * pFanin;
|
||||
int i, iFanin, Lit;
|
||||
// create empty cube
|
||||
if ( pCube->nLits == 0 )
|
||||
return Abc_NodeCreateConst1(pNtkNew);
|
||||
// get the literals of this cube
|
||||
vLits = Vec_IntAlloc( 10 );
|
||||
Min_CubeGetLits( pCube, vLits );
|
||||
assert( pCube->nLits == (unsigned)vLits->nSize );
|
||||
// create special case when there is only one literal
|
||||
if ( pCube->nLits == 1 )
|
||||
{
|
||||
iFanin = Vec_IntEntry(vLits,0);
|
||||
pFanin = Abc_NtkObj( pObj->pNtk, Vec_IntEntry(vSupp, iFanin) );
|
||||
Lit = Min_CubeGetVar(pCube, iFanin);
|
||||
assert( Lit == 1 || Lit == 2 );
|
||||
Vec_IntFree( vLits );
|
||||
// if ( Lit == 1 )// negative
|
||||
// return Abc_NodeCreateInv( pNtkNew, pFanin->pCopy );
|
||||
// return pFanin->pCopy;
|
||||
return Abc_NtkXyzDeriveInv( pNtkNew, pFanin, Lit==1 );
|
||||
}
|
||||
assert( pCube->nLits > 1 );
|
||||
// create the AND cube
|
||||
pNodeNew = Abc_NtkCreateNode( pNtkNew );
|
||||
for ( i = 0; i < vLits->nSize; i++ )
|
||||
{
|
||||
iFanin = Vec_IntEntry(vLits,i);
|
||||
pFanin = Abc_NtkObj( pObj->pNtk, Vec_IntEntry(vSupp, iFanin) );
|
||||
Lit = Min_CubeGetVar(pCube, iFanin);
|
||||
assert( Lit == 1 || Lit == 2 );
|
||||
Vec_IntWriteEntry( vLits, i, Lit==1 );
|
||||
// Abc_ObjAddFanin( pNodeNew, pFanin->pCopy );
|
||||
Abc_ObjAddFanin( pNodeNew, Abc_NtkXyzDeriveInv( pNtkNew, pFanin, Lit==1 ) );
|
||||
}
|
||||
// pNodeNew->pData = Abc_SopCreateAnd( pNtkNew->pManFunc, vLits->nSize, vLits->pArray );
|
||||
pNodeNew->pData = Abc_SopCreateAnd( pNtkNew->pManFunc, vLits->nSize, NULL );
|
||||
Vec_IntFree( vLits );
|
||||
return pNodeNew;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Derives the decomposed network.]
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
Abc_Obj_t * Abc_NtkXyzDeriveNodeInv_rec( Xyz_Man_t * p, Abc_Ntk_t * pNtkNew, Abc_Obj_t * pObj, int fCompl )
|
||||
{
|
||||
Min_Cube_t * pCover, * pCube;
|
||||
Abc_Obj_t * pFaninNew, * pNodeNew, * pFanin;
|
||||
Vec_Int_t * vSupp;
|
||||
int Entry, nCubes, i;
|
||||
|
||||
// skip if already computed
|
||||
if ( pObj->pCopy )
|
||||
return Abc_NtkXyzDeriveInv( pNtkNew, pObj, fCompl );
|
||||
assert( Abc_ObjIsNode(pObj) );
|
||||
|
||||
// get the support and the cover
|
||||
vSupp = Abc_ObjGetSupp( pObj );
|
||||
pCover = Abc_ObjGetCover2( pObj );
|
||||
assert( vSupp );
|
||||
|
||||
// process the fanins
|
||||
Vec_IntForEachEntry( vSupp, Entry, i )
|
||||
{
|
||||
pFanin = Abc_NtkObj(pObj->pNtk, Entry);
|
||||
Abc_NtkXyzDeriveNodeInv_rec( p, pNtkNew, pFanin, 0 );
|
||||
}
|
||||
|
||||
// for each cube, construct the node
|
||||
nCubes = Min_CoverCountCubes( pCover );
|
||||
if ( nCubes == 0 )
|
||||
pNodeNew = Abc_NodeCreateConst0(pNtkNew);
|
||||
else if ( nCubes == 1 )
|
||||
pNodeNew = Abc_NtkXyzDeriveCubeInv( pNtkNew, pObj, pCover, vSupp );
|
||||
else
|
||||
{
|
||||
pNodeNew = Abc_NtkCreateNode( pNtkNew );
|
||||
Min_CoverForEachCube( pCover, pCube )
|
||||
{
|
||||
pFaninNew = Abc_NtkXyzDeriveCubeInv( pNtkNew, pObj, pCube, vSupp );
|
||||
Abc_ObjAddFanin( pNodeNew, pFaninNew );
|
||||
}
|
||||
pNodeNew->pData = Abc_SopCreateXorSpecial( pNtkNew->pManFunc, nCubes );
|
||||
}
|
||||
|
||||
pObj->pCopy = pNodeNew;
|
||||
return Abc_NtkXyzDeriveInv( pNtkNew, pObj, fCompl );
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Derives the decomposed network.]
|
||||
|
||||
Description [The resulting network contains only pure AND/OR/EXOR gates
|
||||
and inverters. This procedure is usedful to generate Verilog.]
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
Abc_Ntk_t * Abc_NtkXyzDeriveClean( Xyz_Man_t * p, Abc_Ntk_t * pNtk )
|
||||
{
|
||||
Abc_Ntk_t * pNtkNew;
|
||||
Abc_Obj_t * pObj, * pNodeNew;
|
||||
int i;
|
||||
assert( Abc_NtkIsStrash(pNtk) );
|
||||
// perform strashing
|
||||
pNtkNew = Abc_NtkStartFrom( pNtk, ABC_NTK_LOGIC, ABC_FUNC_SOP );
|
||||
// reconstruct the network
|
||||
Abc_NtkForEachCo( pNtk, pObj, i )
|
||||
{
|
||||
pNodeNew = Abc_NtkXyzDeriveNodeInv_rec( p, pNtkNew, Abc_ObjFanin0(pObj), Abc_ObjFaninC0(pObj) );
|
||||
Abc_ObjAddFanin( pObj->pCopy, pNodeNew );
|
||||
}
|
||||
// add the COs
|
||||
Abc_NtkLogicMakeSimpleCos( pNtkNew, 0 );
|
||||
// make sure everything is okay
|
||||
if ( !Abc_NtkCheck( pNtkNew ) )
|
||||
{
|
||||
printf( "Abc_NtkXyzDeriveInv: The network check has failed.\n" );
|
||||
Abc_NtkDelete( pNtkNew );
|
||||
return NULL;
|
||||
}
|
||||
return pNtkNew;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
/// END OF FILE ///
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,144 +0,0 @@
|
|||
/**CFile****************************************************************
|
||||
|
||||
FileName [xyzMan.c]
|
||||
|
||||
SystemName [ABC: Logic synthesis and verification system.]
|
||||
|
||||
PackageName [Cover manipulation package.]
|
||||
|
||||
Synopsis [Decomposition manager.]
|
||||
|
||||
Author [Alan Mishchenko]
|
||||
|
||||
Affiliation [UC Berkeley]
|
||||
|
||||
Date [Ver. 1.0. Started - June 20, 2005.]
|
||||
|
||||
Revision [$Id: xyzMan.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
|
||||
|
||||
***********************************************************************/
|
||||
|
||||
#include "xyz.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
/// DECLARATIONS ///
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
/// FUNCTION DEFINITIONS ///
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis []
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
Xyz_Man_t * Xyz_ManAlloc( Abc_Ntk_t * pNtk, int nFaninMax )
|
||||
{
|
||||
Xyz_Man_t * pMan;
|
||||
Xyz_Obj_t * pMem;
|
||||
Abc_Obj_t * pObj;
|
||||
int i;
|
||||
assert( pNtk->pManCut == NULL );
|
||||
|
||||
// start the manager
|
||||
pMan = ALLOC( Xyz_Man_t, 1 );
|
||||
memset( pMan, 0, sizeof(Xyz_Man_t) );
|
||||
pMan->nFaninMax = nFaninMax;
|
||||
pMan->nCubesMax = 2 * pMan->nFaninMax;
|
||||
pMan->nWords = Abc_BitWordNum( nFaninMax * 2 );
|
||||
|
||||
// get the cubes
|
||||
pMan->vComTo0 = Vec_IntAlloc( 2*nFaninMax );
|
||||
pMan->vComTo1 = Vec_IntAlloc( 2*nFaninMax );
|
||||
pMan->vPairs0 = Vec_IntAlloc( nFaninMax );
|
||||
pMan->vPairs1 = Vec_IntAlloc( nFaninMax );
|
||||
pMan->vTriv0 = Vec_IntAlloc( 1 ); Vec_IntPush( pMan->vTriv0, -1 );
|
||||
pMan->vTriv1 = Vec_IntAlloc( 1 ); Vec_IntPush( pMan->vTriv1, -1 );
|
||||
|
||||
// allocate memory for object structures
|
||||
pMan->pMemory = pMem = ALLOC( Xyz_Obj_t, sizeof(Xyz_Obj_t) * Abc_NtkObjNumMax(pNtk) );
|
||||
memset( pMem, 0, sizeof(Xyz_Obj_t) * Abc_NtkObjNumMax(pNtk) );
|
||||
// allocate storage for the pointers to the memory
|
||||
pMan->vObjStrs = Vec_PtrAlloc( Abc_NtkObjNumMax(pNtk) );
|
||||
Vec_PtrFill( pMan->vObjStrs, Abc_NtkObjNumMax(pNtk), NULL );
|
||||
Abc_NtkForEachObj( pNtk, pObj, i )
|
||||
Vec_PtrWriteEntry( pMan->vObjStrs, i, pMem + i );
|
||||
// create the cube manager
|
||||
pMan->pManMin = Min_ManAlloc( nFaninMax );
|
||||
return pMan;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis []
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void Xyz_ManFree( Xyz_Man_t * p )
|
||||
{
|
||||
Vec_Int_t * vSupp;
|
||||
int i;
|
||||
for ( i = 0; i < p->vObjStrs->nSize; i++ )
|
||||
{
|
||||
vSupp = ((Xyz_Obj_t *)p->vObjStrs->pArray[i])->vSupp;
|
||||
if ( vSupp ) Vec_IntFree( vSupp );
|
||||
}
|
||||
|
||||
Min_ManFree( p->pManMin );
|
||||
Vec_PtrFree( p->vObjStrs );
|
||||
Vec_IntFree( p->vFanCounts );
|
||||
Vec_IntFree( p->vTriv0 );
|
||||
Vec_IntFree( p->vTriv1 );
|
||||
Vec_IntFree( p->vComTo0 );
|
||||
Vec_IntFree( p->vComTo1 );
|
||||
Vec_IntFree( p->vPairs0 );
|
||||
Vec_IntFree( p->vPairs1 );
|
||||
free( p->pMemory );
|
||||
free( p );
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Drop the covers at the node.]
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void Abc_NodeXyzDropData( Xyz_Man_t * p, Abc_Obj_t * pObj )
|
||||
{
|
||||
int nFanouts;
|
||||
assert( p->vFanCounts );
|
||||
nFanouts = Vec_IntEntry( p->vFanCounts, pObj->Id );
|
||||
assert( nFanouts > 0 );
|
||||
if ( --nFanouts == 0 )
|
||||
{
|
||||
Vec_IntFree( Abc_ObjGetSupp(pObj) );
|
||||
Abc_ObjSetSupp( pObj, NULL );
|
||||
Min_CoverRecycle( p->pManMin, Abc_ObjGetCover2(pObj) );
|
||||
Abc_ObjSetCover2( pObj, NULL );
|
||||
p->nSupps--;
|
||||
}
|
||||
Vec_IntWriteEntry( p->vFanCounts, pObj->Id, nFanouts );
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
/// END OF FILE ///
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
|
@ -1,615 +0,0 @@
|
|||
/**CFile****************************************************************
|
||||
|
||||
FileName [xyzMinSop.c]
|
||||
|
||||
SystemName [ABC: Logic synthesis and verification system.]
|
||||
|
||||
PackageName [Cover manipulation package.]
|
||||
|
||||
Synopsis [SOP manipulation.]
|
||||
|
||||
Author [Alan Mishchenko]
|
||||
|
||||
Affiliation [UC Berkeley]
|
||||
|
||||
Date [Ver. 1.0. Started - June 20, 2005.]
|
||||
|
||||
Revision [$Id: xyzMinSop.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
|
||||
|
||||
***********************************************************************/
|
||||
|
||||
#include "xyzInt.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
/// DECLARATIONS ///
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static void Min_SopRewrite( Min_Man_t * p );
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
/// FUNCTION DEFINITIONS ///
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis []
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void Min_SopMinimize( Min_Man_t * p )
|
||||
{
|
||||
int nCubesInit, nCubesOld, nIter;
|
||||
if ( p->nCubes < 3 )
|
||||
return;
|
||||
nIter = 0;
|
||||
nCubesInit = p->nCubes;
|
||||
do {
|
||||
nCubesOld = p->nCubes;
|
||||
Min_SopRewrite( p );
|
||||
nIter++;
|
||||
// printf( "%d:%d->%d ", nIter, nCubesInit, p->nCubes );
|
||||
}
|
||||
while ( 100.0*(nCubesOld - p->nCubes)/nCubesOld > 3.0 );
|
||||
// printf( "\n" );
|
||||
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis []
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void Min_SopRewrite( Min_Man_t * p )
|
||||
{
|
||||
Min_Cube_t * pCube, ** ppPrev;
|
||||
Min_Cube_t * pThis, ** ppPrevT;
|
||||
Min_Cube_t * pTemp;
|
||||
int v00, v01, v10, v11, Var0, Var1, Index, fCont0, fCont1, nCubesOld;
|
||||
int nPairs = 0;
|
||||
/*
|
||||
{
|
||||
Min_Cube_t * pCover;
|
||||
pCover = Min_CoverCollect( p, p->nVars );
|
||||
printf( "\n\n" );
|
||||
Min_CoverWrite( stdout, pCover );
|
||||
Min_CoverExpand( p, pCover );
|
||||
}
|
||||
*/
|
||||
|
||||
// insert the bubble before the first cube
|
||||
p->pBubble->pNext = p->ppStore[0];
|
||||
p->ppStore[0] = p->pBubble;
|
||||
p->pBubble->nLits = 0;
|
||||
|
||||
// go through the cubes
|
||||
while ( 1 )
|
||||
{
|
||||
// get the index of the bubble
|
||||
Index = p->pBubble->nLits;
|
||||
|
||||
// find the bubble
|
||||
Min_CoverForEachCubePrev( p->ppStore[Index], pCube, ppPrev )
|
||||
if ( pCube == p->pBubble )
|
||||
break;
|
||||
assert( pCube == p->pBubble );
|
||||
|
||||
// remove the bubble, get the next cube after the bubble
|
||||
*ppPrev = p->pBubble->pNext;
|
||||
pCube = p->pBubble->pNext;
|
||||
if ( pCube == NULL )
|
||||
for ( Index++; Index <= p->nVars; Index++ )
|
||||
if ( p->ppStore[Index] )
|
||||
{
|
||||
ppPrev = &(p->ppStore[Index]);
|
||||
pCube = p->ppStore[Index];
|
||||
break;
|
||||
}
|
||||
// stop if there is no more cubes
|
||||
if ( pCube == NULL )
|
||||
break;
|
||||
|
||||
// find the first dist2 cube
|
||||
Min_CoverForEachCubePrev( pCube->pNext, pThis, ppPrevT )
|
||||
if ( Min_CubesDistTwo( pCube, pThis, &Var0, &Var1 ) )
|
||||
break;
|
||||
if ( pThis == NULL && Index < p->nVars )
|
||||
Min_CoverForEachCubePrev( p->ppStore[Index+1], pThis, ppPrevT )
|
||||
if ( Min_CubesDistTwo( pCube, pThis, &Var0, &Var1 ) )
|
||||
break;
|
||||
// continue if there is no dist2 cube
|
||||
if ( pThis == NULL )
|
||||
{
|
||||
// insert the bubble after the cube
|
||||
p->pBubble->pNext = pCube->pNext;
|
||||
pCube->pNext = p->pBubble;
|
||||
p->pBubble->nLits = pCube->nLits;
|
||||
continue;
|
||||
}
|
||||
nPairs++;
|
||||
/*
|
||||
printf( "\n" );
|
||||
Min_CubeWrite( stdout, pCube );
|
||||
Min_CubeWrite( stdout, pThis );
|
||||
*/
|
||||
// remove the cubes, insert the bubble instead of pCube
|
||||
*ppPrevT = pThis->pNext;
|
||||
*ppPrev = p->pBubble;
|
||||
p->pBubble->pNext = pCube->pNext;
|
||||
p->pBubble->nLits = pCube->nLits;
|
||||
p->nCubes -= 2;
|
||||
|
||||
assert( pCube != p->pBubble && pThis != p->pBubble );
|
||||
|
||||
|
||||
// save the dist2 parameters
|
||||
v00 = Min_CubeGetVar( pCube, Var0 );
|
||||
v01 = Min_CubeGetVar( pCube, Var1 );
|
||||
v10 = Min_CubeGetVar( pThis, Var0 );
|
||||
v11 = Min_CubeGetVar( pThis, Var1 );
|
||||
assert( v00 != v10 && v01 != v11 );
|
||||
assert( v00 != 3 || v01 != 3 );
|
||||
assert( v10 != 3 || v11 != 3 );
|
||||
|
||||
//printf( "\n" );
|
||||
//Min_CubeWrite( stdout, pCube );
|
||||
//Min_CubeWrite( stdout, pThis );
|
||||
|
||||
//printf( "\n" );
|
||||
//Min_CubeWrite( stdout, pCube );
|
||||
//Min_CubeWrite( stdout, pThis );
|
||||
|
||||
// consider the case when both cubes have non-empty literals
|
||||
if ( v00 != 3 && v01 != 3 && v10 != 3 && v11 != 3 )
|
||||
{
|
||||
assert( v00 == (v10 ^ 3) );
|
||||
assert( v01 == (v11 ^ 3) );
|
||||
// create the temporary cube equal to the first corner
|
||||
Min_CubeXorVar( pCube, Var0, 3 );
|
||||
// check if this cube is contained
|
||||
fCont0 = Min_CoverContainsCube( p, pCube );
|
||||
// create the temporary cube equal to the first corner
|
||||
Min_CubeXorVar( pCube, Var0, 3 );
|
||||
Min_CubeXorVar( pCube, Var1, 3 );
|
||||
//printf( "\n" );
|
||||
//Min_CubeWrite( stdout, pCube );
|
||||
//Min_CubeWrite( stdout, pThis );
|
||||
// check if this cube is contained
|
||||
fCont1 = Min_CoverContainsCube( p, pCube );
|
||||
// undo the change
|
||||
Min_CubeXorVar( pCube, Var1, 3 );
|
||||
|
||||
// check if the cubes can be overwritten
|
||||
if ( fCont0 && fCont1 )
|
||||
{
|
||||
// one of the cubes can be recycled, the other expanded and added
|
||||
Min_CubeRecycle( p, pThis );
|
||||
// remove the literals
|
||||
Min_CubeXorVar( pCube, Var0, v00 ^ 3 );
|
||||
Min_CubeXorVar( pCube, Var1, v01 ^ 3 );
|
||||
pCube->nLits -= 2;
|
||||
Min_SopAddCube( p, pCube );
|
||||
}
|
||||
else if ( fCont0 )
|
||||
{
|
||||
// expand both cubes and add them
|
||||
Min_CubeXorVar( pCube, Var0, v00 ^ 3 );
|
||||
pCube->nLits--;
|
||||
Min_SopAddCube( p, pCube );
|
||||
Min_CubeXorVar( pThis, Var1, v11 ^ 3 );
|
||||
pThis->nLits--;
|
||||
Min_SopAddCube( p, pThis );
|
||||
}
|
||||
else if ( fCont1 )
|
||||
{
|
||||
// expand both cubes and add them
|
||||
Min_CubeXorVar( pCube, Var1, v01 ^ 3 );
|
||||
pCube->nLits--;
|
||||
Min_SopAddCube( p, pCube );
|
||||
Min_CubeXorVar( pThis, Var0, v10 ^ 3 );
|
||||
pThis->nLits--;
|
||||
Min_SopAddCube( p, pThis );
|
||||
}
|
||||
else
|
||||
{
|
||||
Min_SopAddCube( p, pCube );
|
||||
Min_SopAddCube( p, pThis );
|
||||
}
|
||||
// otherwise, no change is possible
|
||||
continue;
|
||||
}
|
||||
|
||||
// if one of them does not have DC lit, move it
|
||||
if ( v00 != 3 && v01 != 3 )
|
||||
{
|
||||
assert( v10 == 3 || v11 == 3 );
|
||||
pTemp = pCube; pCube = pThis; pThis = pTemp;
|
||||
Index = v00; v00 = v10; v10 = Index;
|
||||
Index = v01; v01 = v11; v11 = Index;
|
||||
}
|
||||
|
||||
// make sure the first cube has first var DC
|
||||
if ( v00 != 3 )
|
||||
{
|
||||
assert( v01 == 3 );
|
||||
Index = Var0; Var0 = Var1; Var1 = Index;
|
||||
Index = v00; v00 = v01; v01 = Index;
|
||||
Index = v10; v10 = v11; v11 = Index;
|
||||
}
|
||||
|
||||
// consider both cases: both have DC lit
|
||||
if ( v00 == 3 && v11 == 3 )
|
||||
{
|
||||
assert( v01 != 3 && v10 != 3 );
|
||||
// try the remaining minterm
|
||||
// create the temporary cube equal to the first corner
|
||||
Min_CubeXorVar( pCube, Var0, v10 );
|
||||
Min_CubeXorVar( pCube, Var1, 3 );
|
||||
pCube->nLits++;
|
||||
// check if this cube is contained
|
||||
fCont0 = Min_CoverContainsCube( p, pCube );
|
||||
// undo the cube transformations
|
||||
Min_CubeXorVar( pCube, Var0, v10 );
|
||||
Min_CubeXorVar( pCube, Var1, 3 );
|
||||
pCube->nLits--;
|
||||
// check the case when both are covered
|
||||
if ( fCont0 )
|
||||
{
|
||||
// one of the cubes can be recycled, the other expanded and added
|
||||
Min_CubeRecycle( p, pThis );
|
||||
// remove the literals
|
||||
Min_CubeXorVar( pCube, Var1, v01 ^ 3 );
|
||||
pCube->nLits--;
|
||||
Min_SopAddCube( p, pCube );
|
||||
}
|
||||
else
|
||||
{
|
||||
// try two reduced cubes
|
||||
Min_CubeXorVar( pCube, Var0, v10 );
|
||||
pCube->nLits++;
|
||||
// remember the cubes
|
||||
nCubesOld = p->nCubes;
|
||||
Min_SopAddCube( p, pCube );
|
||||
// check if the cube is absorbed
|
||||
if ( p->nCubes < nCubesOld + 1 )
|
||||
{ // absorbed - add the second cube
|
||||
Min_SopAddCube( p, pThis );
|
||||
}
|
||||
else
|
||||
{ // remove this cube, and try another one
|
||||
assert( pCube == p->ppStore[pCube->nLits] );
|
||||
p->ppStore[pCube->nLits] = pCube->pNext;
|
||||
p->nCubes--;
|
||||
|
||||
// return the cube to the previous state
|
||||
Min_CubeXorVar( pCube, Var0, v10 );
|
||||
pCube->nLits--;
|
||||
|
||||
// generate another reduced cube
|
||||
Min_CubeXorVar( pThis, Var1, v01 );
|
||||
pThis->nLits++;
|
||||
|
||||
// add both cubes
|
||||
Min_SopAddCube( p, pCube );
|
||||
Min_SopAddCube( p, pThis );
|
||||
}
|
||||
}
|
||||
}
|
||||
else // the first cube has DC lit
|
||||
{
|
||||
assert( v01 != 3 && v10 != 3 && v11 != 3 );
|
||||
// try the remaining minterm
|
||||
// create the temporary cube equal to the minterm
|
||||
Min_CubeXorVar( pThis, Var0, 3 );
|
||||
// check if this cube is contained
|
||||
fCont0 = Min_CoverContainsCube( p, pThis );
|
||||
// undo the cube transformations
|
||||
Min_CubeXorVar( pThis, Var0, 3 );
|
||||
// check the case when both are covered
|
||||
if ( fCont0 )
|
||||
{
|
||||
// one of the cubes can be recycled, the other expanded and added
|
||||
Min_CubeRecycle( p, pThis );
|
||||
// remove the literals
|
||||
Min_CubeXorVar( pCube, Var1, v01 ^ 3 );
|
||||
pCube->nLits--;
|
||||
Min_SopAddCube( p, pCube );
|
||||
}
|
||||
else
|
||||
{
|
||||
// try reshaping the cubes
|
||||
// reduce the first cube
|
||||
Min_CubeXorVar( pCube, Var0, v10 );
|
||||
pCube->nLits++;
|
||||
// expand the second cube
|
||||
Min_CubeXorVar( pThis, Var1, v11 ^ 3 );
|
||||
pThis->nLits--;
|
||||
// add both cubes
|
||||
Min_SopAddCube( p, pCube );
|
||||
Min_SopAddCube( p, pThis );
|
||||
}
|
||||
}
|
||||
}
|
||||
// printf( "Pairs = %d ", nPairs );
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Adds cube to the SOP cover stored in the manager.]
|
||||
|
||||
Description [Returns 0 if the cube is added or removed. Returns 1
|
||||
if the cube is glued with some other cube and has to be added again.]
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
int Min_SopAddCubeInt( Min_Man_t * p, Min_Cube_t * pCube )
|
||||
{
|
||||
Min_Cube_t * pThis, * pThis2, ** ppPrev;
|
||||
int i;
|
||||
// try to find the identical cube
|
||||
Min_CoverForEachCube( p->ppStore[pCube->nLits], pThis )
|
||||
{
|
||||
if ( Min_CubesAreEqual( pCube, pThis ) )
|
||||
{
|
||||
Min_CubeRecycle( p, pCube );
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
// try to find a containing cube
|
||||
for ( i = 0; i < (int)pCube->nLits; i++ )
|
||||
Min_CoverForEachCube( p->ppStore[i], pThis )
|
||||
{
|
||||
if ( pThis != p->pBubble && Min_CubeIsContained( pThis, pCube ) )
|
||||
{
|
||||
Min_CubeRecycle( p, pCube );
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
// try to find distance one in the same bin
|
||||
Min_CoverForEachCubePrev( p->ppStore[pCube->nLits], pThis, ppPrev )
|
||||
{
|
||||
if ( Min_CubesDistOne( pCube, pThis, NULL ) )
|
||||
{
|
||||
*ppPrev = pThis->pNext;
|
||||
Min_CubesTransformOr( pCube, pThis );
|
||||
pCube->nLits--;
|
||||
Min_CubeRecycle( p, pThis );
|
||||
p->nCubes--;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
// clean the other cubes using this one
|
||||
for ( i = pCube->nLits + 1; i <= (int)pCube->nVars; i++ )
|
||||
{
|
||||
ppPrev = &p->ppStore[i];
|
||||
Min_CoverForEachCubeSafe( p->ppStore[i], pThis, pThis2 )
|
||||
{
|
||||
if ( pThis != p->pBubble && Min_CubeIsContained( pCube, pThis ) )
|
||||
{
|
||||
*ppPrev = pThis->pNext;
|
||||
Min_CubeRecycle( p, pThis );
|
||||
p->nCubes--;
|
||||
}
|
||||
else
|
||||
ppPrev = &pThis->pNext;
|
||||
}
|
||||
}
|
||||
|
||||
// add the cube
|
||||
pCube->pNext = p->ppStore[pCube->nLits];
|
||||
p->ppStore[pCube->nLits] = pCube;
|
||||
p->nCubes++;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Adds the cube to storage.]
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void Min_SopAddCube( Min_Man_t * p, Min_Cube_t * pCube )
|
||||
{
|
||||
assert( Min_CubeCheck( pCube ) );
|
||||
assert( pCube != p->pBubble );
|
||||
assert( (int)pCube->nLits == Min_CubeCountLits(pCube) );
|
||||
while ( Min_SopAddCubeInt( p, pCube ) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis []
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void Min_SopContain( Min_Man_t * p )
|
||||
{
|
||||
Min_Cube_t * pCube, * pCube2, ** ppPrev;
|
||||
int i, k;
|
||||
for ( i = 0; i <= p->nVars; i++ )
|
||||
{
|
||||
Min_CoverForEachCube( p->ppStore[i], pCube )
|
||||
Min_CoverForEachCubePrev( pCube->pNext, pCube2, ppPrev )
|
||||
{
|
||||
if ( !Min_CubesAreEqual( pCube, pCube2 ) )
|
||||
continue;
|
||||
*ppPrev = pCube2->pNext;
|
||||
Min_CubeRecycle( p, pCube2 );
|
||||
p->nCubes--;
|
||||
}
|
||||
for ( k = i + 1; k <= p->nVars; k++ )
|
||||
Min_CoverForEachCubePrev( p->ppStore[k], pCube2, ppPrev )
|
||||
{
|
||||
if ( !Min_CubeIsContained( pCube, pCube2 ) )
|
||||
continue;
|
||||
*ppPrev = pCube2->pNext;
|
||||
Min_CubeRecycle( p, pCube2 );
|
||||
p->nCubes--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis []
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void Min_SopDist1Merge( Min_Man_t * p )
|
||||
{
|
||||
Min_Cube_t * pCube, * pCube2, * pCubeNew;
|
||||
int i;
|
||||
for ( i = p->nVars; i >= 0; i-- )
|
||||
{
|
||||
Min_CoverForEachCube( p->ppStore[i], pCube )
|
||||
Min_CoverForEachCube( pCube->pNext, pCube2 )
|
||||
{
|
||||
assert( pCube->nLits == pCube2->nLits );
|
||||
if ( !Min_CubesDistOne( pCube, pCube2, NULL ) )
|
||||
continue;
|
||||
pCubeNew = Min_CubesXor( p, pCube, pCube2 );
|
||||
assert( pCubeNew->nLits == pCube->nLits - 1 );
|
||||
pCubeNew->pNext = p->ppStore[pCubeNew->nLits];
|
||||
p->ppStore[pCubeNew->nLits] = pCubeNew;
|
||||
p->nCubes++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis []
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
Min_Cube_t * Min_SopComplement( Min_Man_t * p, Min_Cube_t * pSharp )
|
||||
{
|
||||
Vec_Int_t * vVars;
|
||||
Min_Cube_t * pCover, * pCube, * pNext, * pReady, * pThis, ** ppPrev;
|
||||
int Num, Value, i;
|
||||
|
||||
// get the variables
|
||||
vVars = Vec_IntAlloc( 100 );
|
||||
// create the tautology cube
|
||||
pCover = Min_CubeAlloc( p );
|
||||
// sharp it with all cubes
|
||||
Min_CoverForEachCube( pSharp, pCube )
|
||||
Min_CoverForEachCubePrev( pCover, pThis, ppPrev )
|
||||
{
|
||||
if ( Min_CubesDisjoint( pThis, pCube ) )
|
||||
continue;
|
||||
// remember the next pointer
|
||||
pNext = pThis->pNext;
|
||||
// get the variables, in which pThis is '-' while pCube is fixed
|
||||
Min_CoverGetDisjVars( pThis, pCube, vVars );
|
||||
// generate the disjoint cubes
|
||||
pReady = pThis;
|
||||
Vec_IntForEachEntryReverse( vVars, Num, i )
|
||||
{
|
||||
// correct the literal
|
||||
Min_CubeXorVar( pReady, vVars->pArray[i], 3 );
|
||||
if ( i == 0 )
|
||||
break;
|
||||
// create the new cube and clean this value
|
||||
Value = Min_CubeGetVar( pReady, vVars->pArray[i] );
|
||||
pReady = Min_CubeDup( p, pReady );
|
||||
Min_CubeXorVar( pReady, vVars->pArray[i], 3 ^ Value );
|
||||
// add to the cover
|
||||
*ppPrev = pReady;
|
||||
ppPrev = &pReady->pNext;
|
||||
}
|
||||
pThis = pReady;
|
||||
pThis->pNext = pNext;
|
||||
}
|
||||
Vec_IntFree( vVars );
|
||||
|
||||
// perform dist-1 merge and contain
|
||||
Min_CoverExpandRemoveEqual( p, pCover );
|
||||
Min_SopDist1Merge( p );
|
||||
Min_SopContain( p );
|
||||
return Min_CoverCollect( p, p->nVars );
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis []
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
int Min_SopCheck( Min_Man_t * p )
|
||||
{
|
||||
Min_Cube_t * pCube, * pThis;
|
||||
int i;
|
||||
|
||||
pCube = Min_CubeAlloc( p );
|
||||
Min_CubeXorBit( pCube, 2*0+1 );
|
||||
Min_CubeXorBit( pCube, 2*1+1 );
|
||||
Min_CubeXorBit( pCube, 2*2+0 );
|
||||
Min_CubeXorBit( pCube, 2*3+0 );
|
||||
Min_CubeXorBit( pCube, 2*4+0 );
|
||||
Min_CubeXorBit( pCube, 2*5+1 );
|
||||
Min_CubeXorBit( pCube, 2*6+1 );
|
||||
pCube->nLits = 7;
|
||||
|
||||
// Min_CubeWrite( stdout, pCube );
|
||||
|
||||
// check that the cubes contain it
|
||||
for ( i = 0; i <= p->nVars; i++ )
|
||||
Min_CoverForEachCube( p->ppStore[i], pThis )
|
||||
if ( pThis != p->pBubble && Min_CubeIsContained( pThis, pCube ) )
|
||||
{
|
||||
Min_CubeRecycle( p, pCube );
|
||||
return 1;
|
||||
}
|
||||
Min_CubeRecycle( p, pCube );
|
||||
return 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
/// END OF FILE ///
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
|
@ -1,417 +0,0 @@
|
|||
/**CFile****************************************************************
|
||||
|
||||
FileName [xyzTest.c]
|
||||
|
||||
SystemName [ABC: Logic synthesis and verification system.]
|
||||
|
||||
PackageName [Cover manipulation package.]
|
||||
|
||||
Synopsis [Testing procedures.]
|
||||
|
||||
Author [Alan Mishchenko]
|
||||
|
||||
Affiliation [UC Berkeley]
|
||||
|
||||
Date [Ver. 1.0. Started - June 20, 2005.]
|
||||
|
||||
Revision [$Id: xyzTest.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
|
||||
|
||||
***********************************************************************/
|
||||
|
||||
#include "xyz.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
/// DECLARATIONS ///
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
/// FUNCTION DEFINITIONS ///
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis []
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
Min_Cube_t * Abc_NodeDeriveCoverPro( Min_Man_t * p, Min_Cube_t * pCover0, Min_Cube_t * pCover1 )
|
||||
{
|
||||
Min_Cube_t * pCover;
|
||||
Min_Cube_t * pCube0, * pCube1, * pCube;
|
||||
if ( pCover0 == NULL || pCover1 == NULL )
|
||||
return NULL;
|
||||
// clean storage
|
||||
Min_ManClean( p, p->nVars );
|
||||
// go through the cube pairs
|
||||
Min_CoverForEachCube( pCover0, pCube0 )
|
||||
Min_CoverForEachCube( pCover1, pCube1 )
|
||||
{
|
||||
if ( Min_CubesDisjoint( pCube0, pCube1 ) )
|
||||
continue;
|
||||
pCube = Min_CubesProduct( p, pCube0, pCube1 );
|
||||
// add the cube to storage
|
||||
Min_SopAddCube( p, pCube );
|
||||
}
|
||||
Min_SopMinimize( p );
|
||||
pCover = Min_CoverCollect( p, p->nVars );
|
||||
assert( p->nCubes == Min_CoverCountCubes(pCover) );
|
||||
return pCover;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis []
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
Min_Cube_t * Abc_NodeDeriveCoverSum( Min_Man_t * p, Min_Cube_t * pCover0, Min_Cube_t * pCover1 )
|
||||
{
|
||||
Min_Cube_t * pCover;
|
||||
Min_Cube_t * pThis, * pCube;
|
||||
if ( pCover0 == NULL || pCover1 == NULL )
|
||||
return NULL;
|
||||
// clean storage
|
||||
Min_ManClean( p, p->nVars );
|
||||
// add the cubes to storage
|
||||
Min_CoverForEachCube( pCover0, pThis )
|
||||
{
|
||||
pCube = Min_CubeDup( p, pThis );
|
||||
Min_SopAddCube( p, pCube );
|
||||
}
|
||||
Min_CoverForEachCube( pCover1, pThis )
|
||||
{
|
||||
pCube = Min_CubeDup( p, pThis );
|
||||
Min_SopAddCube( p, pCube );
|
||||
}
|
||||
Min_SopMinimize( p );
|
||||
pCover = Min_CoverCollect( p, p->nVars );
|
||||
assert( p->nCubes == Min_CoverCountCubes(pCover) );
|
||||
return pCover;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis []
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
int Abc_NodeDeriveSops( Min_Man_t * p, Abc_Obj_t * pRoot, Vec_Ptr_t * vSupp, Vec_Ptr_t * vNodes )
|
||||
{
|
||||
Min_Cube_t * pCov0[2], * pCov1[2];
|
||||
Min_Cube_t * pCoverP, * pCoverN;
|
||||
Abc_Obj_t * pObj;
|
||||
int i, nCubes, fCompl0, fCompl1;
|
||||
|
||||
// set elementary vars
|
||||
Vec_PtrForEachEntry( vSupp, pObj, i )
|
||||
{
|
||||
pObj->pCopy = (Abc_Obj_t *)Min_CubeAllocVar( p, i, 0 );
|
||||
pObj->pNext = (Abc_Obj_t *)Min_CubeAllocVar( p, i, 1 );
|
||||
}
|
||||
|
||||
// get the cover for each node in the array
|
||||
Vec_PtrForEachEntry( vNodes, pObj, i )
|
||||
{
|
||||
// get the complements
|
||||
fCompl0 = Abc_ObjFaninC0(pObj);
|
||||
fCompl1 = Abc_ObjFaninC1(pObj);
|
||||
// get the covers
|
||||
pCov0[0] = (Min_Cube_t *)Abc_ObjFanin0(pObj)->pCopy;
|
||||
pCov0[1] = (Min_Cube_t *)Abc_ObjFanin0(pObj)->pNext;
|
||||
pCov1[0] = (Min_Cube_t *)Abc_ObjFanin1(pObj)->pCopy;
|
||||
pCov1[1] = (Min_Cube_t *)Abc_ObjFanin1(pObj)->pNext;
|
||||
// compute the covers
|
||||
pCoverP = Abc_NodeDeriveCoverPro( p, pCov0[ fCompl0], pCov1[ fCompl1] );
|
||||
pCoverN = Abc_NodeDeriveCoverSum( p, pCov0[!fCompl0], pCov1[!fCompl1] );
|
||||
// set the covers
|
||||
pObj->pCopy = (Abc_Obj_t *)pCoverP;
|
||||
pObj->pNext = (Abc_Obj_t *)pCoverN;
|
||||
}
|
||||
|
||||
nCubes = ABC_MIN( Min_CoverCountCubes(pCoverN), Min_CoverCountCubes(pCoverP) );
|
||||
|
||||
/*
|
||||
printf( "\n\n" );
|
||||
Min_CoverWrite( stdout, pCoverP );
|
||||
printf( "\n\n" );
|
||||
Min_CoverWrite( stdout, pCoverN );
|
||||
*/
|
||||
|
||||
// printf( "\n" );
|
||||
// Min_CoverWrite( stdout, pCoverP );
|
||||
|
||||
// Min_CoverExpand( p, pCoverP );
|
||||
// Min_SopMinimize( p );
|
||||
// pCoverP = Min_CoverCollect( p, p->nVars );
|
||||
|
||||
// printf( "\n" );
|
||||
// Min_CoverWrite( stdout, pCoverP );
|
||||
|
||||
// nCubes = Min_CoverCountCubes(pCoverP);
|
||||
|
||||
// clean the copy fields
|
||||
Vec_PtrForEachEntry( vNodes, pObj, i )
|
||||
pObj->pCopy = pObj->pNext = NULL;
|
||||
Vec_PtrForEachEntry( vSupp, pObj, i )
|
||||
pObj->pCopy = pObj->pNext = NULL;
|
||||
|
||||
// Min_CoverWriteFile( pCoverP, Abc_ObjName(pRoot), 0 );
|
||||
// printf( "\n" );
|
||||
// Min_CoverWrite( stdout, pCoverP );
|
||||
|
||||
// printf( "\n" );
|
||||
// Min_CoverWrite( stdout, pCoverP );
|
||||
// printf( "\n" );
|
||||
// Min_CoverWrite( stdout, pCoverN );
|
||||
return nCubes;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis []
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void Abc_NtkTestSop( Abc_Ntk_t * pNtk )
|
||||
{
|
||||
Min_Man_t * p;
|
||||
Vec_Ptr_t * vSupp, * vNodes;
|
||||
Abc_Obj_t * pObj;
|
||||
int i, nCubes;
|
||||
assert( Abc_NtkIsStrash(pNtk) );
|
||||
|
||||
Abc_NtkCleanCopy(pNtk);
|
||||
Abc_NtkCleanNext(pNtk);
|
||||
Abc_NtkForEachCo( pNtk, pObj, i )
|
||||
{
|
||||
if ( !Abc_NodeIsAigAnd(Abc_ObjFanin0(pObj)) )
|
||||
{
|
||||
printf( "%-20s : Trivial.\n", Abc_ObjName(pObj) );
|
||||
continue;
|
||||
}
|
||||
|
||||
vSupp = Abc_NtkNodeSupport( pNtk, &pObj, 1 );
|
||||
vNodes = Abc_NtkDfsNodes( pNtk, &pObj, 1 );
|
||||
|
||||
printf( "%20s : Cone = %5d. Supp = %5d. ",
|
||||
Abc_ObjName(pObj), vNodes->nSize, vSupp->nSize );
|
||||
// if ( vSupp->nSize <= 128 )
|
||||
{
|
||||
p = Min_ManAlloc( vSupp->nSize );
|
||||
nCubes = Abc_NodeDeriveSops( p, pObj, vSupp, vNodes );
|
||||
printf( "Cubes = %5d. ", nCubes );
|
||||
Min_ManFree( p );
|
||||
}
|
||||
printf( "\n" );
|
||||
|
||||
|
||||
Vec_PtrFree( vNodes );
|
||||
Vec_PtrFree( vSupp );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis []
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
Min_Cube_t * Abc_NodeDeriveCover( Min_Man_t * p, Min_Cube_t * pCov0, Min_Cube_t * pCov1, int fComp0, int fComp1 )
|
||||
{
|
||||
Min_Cube_t * pCover0, * pCover1, * pCover;
|
||||
Min_Cube_t * pCube0, * pCube1, * pCube;
|
||||
|
||||
// complement the first if needed
|
||||
if ( !fComp0 )
|
||||
pCover0 = pCov0;
|
||||
else if ( pCov0 && pCov0->nLits == 0 ) // topmost one is the tautology cube
|
||||
pCover0 = pCov0->pNext;
|
||||
else
|
||||
pCover0 = p->pOne0, p->pOne0->pNext = pCov0;
|
||||
|
||||
// complement the second if needed
|
||||
if ( !fComp1 )
|
||||
pCover1 = pCov1;
|
||||
else if ( pCov1 && pCov1->nLits == 0 ) // topmost one is the tautology cube
|
||||
pCover1 = pCov1->pNext;
|
||||
else
|
||||
pCover1 = p->pOne1, p->pOne1->pNext = pCov1;
|
||||
|
||||
if ( pCover0 == NULL || pCover1 == NULL )
|
||||
return NULL;
|
||||
|
||||
// clean storage
|
||||
Min_ManClean( p, p->nVars );
|
||||
// go through the cube pairs
|
||||
Min_CoverForEachCube( pCover0, pCube0 )
|
||||
Min_CoverForEachCube( pCover1, pCube1 )
|
||||
{
|
||||
if ( Min_CubesDisjoint( pCube0, pCube1 ) )
|
||||
continue;
|
||||
pCube = Min_CubesProduct( p, pCube0, pCube1 );
|
||||
// add the cube to storage
|
||||
Min_EsopAddCube( p, pCube );
|
||||
}
|
||||
|
||||
if ( p->nCubes > 10 )
|
||||
{
|
||||
// printf( "(%d,", p->nCubes );
|
||||
Min_EsopMinimize( p );
|
||||
// printf( "%d) ", p->nCubes );
|
||||
}
|
||||
|
||||
pCover = Min_CoverCollect( p, p->nVars );
|
||||
assert( p->nCubes == Min_CoverCountCubes(pCover) );
|
||||
|
||||
// if ( p->nCubes > 1000 )
|
||||
// printf( "%d ", p->nCubes );
|
||||
return pCover;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis []
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
int Abc_NodeDeriveEsops( Min_Man_t * p, Abc_Obj_t * pRoot, Vec_Ptr_t * vSupp, Vec_Ptr_t * vNodes )
|
||||
{
|
||||
Min_Cube_t * pCover, * pCube;
|
||||
Abc_Obj_t * pObj;
|
||||
int i;
|
||||
|
||||
// set elementary vars
|
||||
Vec_PtrForEachEntry( vSupp, pObj, i )
|
||||
pObj->pCopy = (Abc_Obj_t *)Min_CubeAllocVar( p, i, 0 );
|
||||
|
||||
// get the cover for each node in the array
|
||||
Vec_PtrForEachEntry( vNodes, pObj, i )
|
||||
{
|
||||
pCover = Abc_NodeDeriveCover( p,
|
||||
(Min_Cube_t *)Abc_ObjFanin0(pObj)->pCopy,
|
||||
(Min_Cube_t *)Abc_ObjFanin1(pObj)->pCopy,
|
||||
Abc_ObjFaninC0(pObj), Abc_ObjFaninC1(pObj) );
|
||||
pObj->pCopy = (Abc_Obj_t *)pCover;
|
||||
if ( p->nCubes > 3000 )
|
||||
return -1;
|
||||
}
|
||||
|
||||
// add complement if needed
|
||||
if ( Abc_ObjFaninC0(pRoot) )
|
||||
{
|
||||
if ( pCover && pCover->nLits == 0 ) // topmost one is the tautology cube
|
||||
{
|
||||
pCube = pCover;
|
||||
pCover = pCover->pNext;
|
||||
Min_CubeRecycle( p, pCube );
|
||||
p->nCubes--;
|
||||
}
|
||||
else
|
||||
{
|
||||
pCube = Min_CubeAlloc( p );
|
||||
pCube->pNext = pCover;
|
||||
p->nCubes++;
|
||||
}
|
||||
}
|
||||
/*
|
||||
Min_CoverExpand( p, pCover );
|
||||
Min_EsopMinimize( p );
|
||||
pCover = Min_CoverCollect( p, p->nVars );
|
||||
*/
|
||||
// clean the copy fields
|
||||
Vec_PtrForEachEntry( vNodes, pObj, i )
|
||||
pObj->pCopy = NULL;
|
||||
Vec_PtrForEachEntry( vSupp, pObj, i )
|
||||
pObj->pCopy = NULL;
|
||||
|
||||
// Min_CoverWriteFile( pCover, Abc_ObjName(pRoot), 1 );
|
||||
// Min_CoverWrite( stdout, pCover );
|
||||
return p->nCubes;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis []
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void Abc_NtkTestEsop( Abc_Ntk_t * pNtk )
|
||||
{
|
||||
Min_Man_t * p;
|
||||
Vec_Ptr_t * vSupp, * vNodes;
|
||||
Abc_Obj_t * pObj;
|
||||
int i, nCubes;
|
||||
assert( Abc_NtkIsStrash(pNtk) );
|
||||
|
||||
Abc_NtkCleanCopy(pNtk);
|
||||
Abc_NtkForEachCo( pNtk, pObj, i )
|
||||
{
|
||||
if ( !Abc_NodeIsAigAnd(Abc_ObjFanin0(pObj)) )
|
||||
{
|
||||
printf( "%-20s : Trivial.\n", Abc_ObjName(pObj) );
|
||||
continue;
|
||||
}
|
||||
|
||||
vSupp = Abc_NtkNodeSupport( pNtk, &pObj, 1 );
|
||||
vNodes = Abc_NtkDfsNodes( pNtk, &pObj, 1 );
|
||||
|
||||
printf( "%20s : Cone = %5d. Supp = %5d. ",
|
||||
Abc_ObjName(pObj), vNodes->nSize, vSupp->nSize );
|
||||
// if ( vSupp->nSize <= 128 )
|
||||
{
|
||||
p = Min_ManAlloc( vSupp->nSize );
|
||||
nCubes = Abc_NodeDeriveEsops( p, pObj, vSupp, vNodes );
|
||||
printf( "Cubes = %5d. ", nCubes );
|
||||
Min_ManFree( p );
|
||||
}
|
||||
printf( "\n" );
|
||||
|
||||
|
||||
Vec_PtrFree( vNodes );
|
||||
Vec_PtrFree( vSupp );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
/// END OF FILE ///
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
|
@ -64,9 +64,11 @@ extern "C" {
|
|||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//typedef int bool;
|
||||
#ifndef __cplusplus
|
||||
#ifndef bool
|
||||
#define bool int
|
||||
#endif
|
||||
#endif
|
||||
|
||||
typedef struct Aig_Param_t_ Aig_Param_t;
|
||||
typedef struct Aig_Man_t_ Aig_Man_t;
|
||||
|
|
@ -215,7 +217,7 @@ struct Aig_SimInfo_t_
|
|||
/// MACRO DEFINITIONS ///
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static inline int Aig_BitWordNum( int nBits ) { return nBits/32 + ((nBits%32) > 0); }
|
||||
static inline int Aig_BitWordNum( int nBits ) { return (nBits>>5) + ((nBits&31) > 0); }
|
||||
static inline int Aig_InfoHasBit( unsigned * p, int i ) { return (p[(i)>>5] & (1<<((i) & 31))) > 0; }
|
||||
static inline void Aig_InfoSetBit( unsigned * p, int i ) { p[(i)>>5] |= (1<<((i) & 31)); }
|
||||
static inline void Aig_InfoXorBit( unsigned * p, int i ) { p[(i)>>5] ^= (1<<((i) & 31)); }
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ Aig_ProofType_t Aig_FraigProveOutput( Aig_Man_t * pMan )
|
|||
// solve the miter
|
||||
clk = clock();
|
||||
pMan->pSat->verbosity = pMan->pParam->fSatVerbose;
|
||||
status = solver_solve( pMan->pSat, NULL, NULL, 0, 0 );//pMan->pParam->nConfLimit, pMan->pParam->nImpLimit );
|
||||
status = solver_solve( pMan->pSat, NULL, NULL, 0, 0 );//pMan->pParam->nConfLimit, pMan->pParam->nInsLimit );
|
||||
if ( status == l_Undef )
|
||||
{
|
||||
// printf( "The problem timed out.\n" );
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ void Aig_TruthCount( Aig_Truth_t * p )
|
|||
***********************************************************************/
|
||||
static inline unsigned Aig_WordGetPart( unsigned * p, int Start, int Size )
|
||||
{
|
||||
return (p[Start/5] >> (Start%32)) & (~0u >> (32-Size));
|
||||
return (p[Start/5] >> (Start&31)) & (~0u >> (32-Size));
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
|
@ -183,7 +183,7 @@ static inline unsigned Aig_WordGetPart( unsigned * p, int Start, int Size )
|
|||
***********************************************************************/
|
||||
static inline void Aig_WordSetPart( unsigned * p, int Start, unsigned Part )
|
||||
{
|
||||
p[Start/5] |= (Part << (Start%32));
|
||||
p[Start/5] |= (Part << (Start&31));
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
|
@ -254,7 +254,7 @@ DdNode * Aig_TruthToBdd_rec( DdManager * dd, unsigned * pTruth, int Shift, int n
|
|||
}
|
||||
if ( nVars == 5 )
|
||||
{
|
||||
unsigned * pWord = pTruth + Shift/32;
|
||||
unsigned * pWord = pTruth + (Shift>>5);
|
||||
assert( Shift % 32 == 0 );
|
||||
if ( *pWord == 0 )
|
||||
return Cudd_ReadLogicZero(dd);
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ int * solver_get_model( solver * p, int * pVars, int nVars )
|
|||
for ( i = 0; i < nVars; i++ )
|
||||
{
|
||||
assert( pVars[i] >= 0 && pVars[i] < p->size );
|
||||
pModel[i] = (int)(p->model.ptr[pVars[i]] == (void *)l_True);
|
||||
pModel[i] = (int)(p->model.ptr[pVars[i]] == l_True);
|
||||
}
|
||||
return pModel;
|
||||
}
|
||||
|
|
@ -188,6 +188,28 @@ void Asat_SatPrintStats( FILE * pFile, solver * p )
|
|||
(float)(p->timeUpdate)/(float)(CLOCKS_PER_SEC) );
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Sets the preferred variables.]
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void Asat_SolverSetPrefVars(solver * s, int * pPrefVars, int nPrefVars)
|
||||
{
|
||||
int i;
|
||||
assert( s->pPrefVars == NULL );
|
||||
for ( i = 0; i < nPrefVars; i++ )
|
||||
assert( pPrefVars[i] < s->size );
|
||||
s->pPrefVars = pPrefVars;
|
||||
s->nPrefVars = nPrefVars;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
/// END OF FILE ///
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue