Commit 88f75c00 by Baruch Sterin

script changes for HWMCC13 (finally submitted version)

parent cbc718d7
# reachx
python new_abc_commands.py
python -c "import reachx_cmd"
# global parameters
set check # checks intermediate networks
#set checkfio # prints warnings when fanins/fanouts are duplicated
#set checkread # checks new networks after reading from file
#unset checkread # does not check new networks after reading from file
#set backup # saves backup networks retrived by "undo" and "recall"
#set savesteps 1 # sets the maximum number of backup networks to save
#set progressbar # display the progress bar
......@@ -23,29 +25,39 @@ set capounix MetaPl-Capo10.1
set gnuplotwin wgnuplot.exe
set gnuplotunix gnuplot
# standard aliases
alias srw "b; rw; b"
alias fix "ps; st; ps; srw; ps; plat; cycle -x -F 1; plat; logic; undc; st; zero; ps; scorr; ps"
alias fixp "st; srw; cycle -x -F 1; logic; undc; st; zero "
# Niklas Een's commands
#load_plugin C:\_projects\abc\lib\bip_win.exe "BIP"
#load_plugin /hd/common/pyabc/bip "BIP"
# standard aliases
alias hi history
alias b balance
alias cg clockgate
alias cl cleanup
alias clp collapse
alias cs care_set
alias esd ext_seq_dcs
alias f fraig
alias fs fraig_sweep
alias fsto fraig_store
alias fres fraig_restore
alias fr fretime
alias ft fraig_trust
alias ic indcut
alias lp lutpack
alias pcon print_cone
alias pd print_dsd
alias pex print_exdc -d
alias pf print_factor
alias pfan print_fanio
alias pg print_gates
alias pl print_level
alias plat print_latch
alias pio print_io
alias pk print_kmap
alias pm print_miter
alias ps print_stats
alias psb print_stats -b
alias psu print_supp
alias psy print_symm
alias pun print_unate
......@@ -53,16 +65,15 @@ alias q quit
alias r read
alias ra read_aiger
alias r3 retime -M 3
alias r1 dretime
alias r2 retime -M 2
alias r4 retime -M 4
alias r5 retime -M 5
alias r6 retime -M 6
alias r3f retime -M 3 -f
alias r3b retime -M 3 -b
alias ren renode
alias rh read_hie
alias ri read_init
alias rl read_blif
alias rb read_bench
alias ret retime
alias dret dretime
alias rp read_pla
alias rt read_truth
alias rv read_verilog
......@@ -70,8 +81,10 @@ alias rvl read_verlib
alias rsup read_super mcnc5_old.super
alias rlib read_library
alias rlibc read_library cadence.genlib
alias rw drw
alias rwz drw -z
alias rty read_liberty
alias rlut read_lut
alias rw rewrite
alias rwz rewrite -z
alias rf refactor
alias rfz refactor -z
alias re restructure
......@@ -79,7 +92,6 @@ alias rez restructure -z
alias rs resub
alias rsz resub -z
alias sa set autoexec ps
alias ua set autoexec
alias scl scleanup
alias sif if -s
alias so source -x
......@@ -100,242 +112,36 @@ alias wp write_pla
alias wv write_verilog
# standard scripts
alias share "b; multi; fx; b"
alias resyn "b; drw; rwz; b; rwz; b"
alias resyn2 "b; drw; rf; b; drw; rwz; b; rfz; rwz; b"
alias resyn2a "b; drw; b; drw; rwz; b; rwz; 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; drw -l; rwz -l; b -l; rwz -l; b -l"
alias compress2 "b -l; drw -l; rf -l; b -l; drw -l; rwz -l; b -l; rfz -l; rwz -l; b -l"
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"
alias choice "fraig_store; resyn; fraig_store; resyn2; fraig_store; fraig_restore"
alias choice2 "fraig_store; balance; fraig_store; resyn; fraig_store; resyn2; fraig_store; resyn2; fraig_store; fraig_restore"
alias rwsat "st; drw -l; b -l; drw -l; rf -l"
alias rwsat2 "st; drw -l; b -l; drw -l; rf -l; fraig; drw -l; b -l; drw -l; rf -l"
alias shake "st; ps; sat -C 5000; drw -l; ps; sat -C 5000; b -l; rf -l; ps; sat -C 5000; rfz -l; ps; sat -C 5000; rwz -l; ps; sat -C 5000; rfz -l; ps; sat -C 5000"
alias snap fraig_store
alias unsnap fraig_restore
alias sv "wl temp"
alias usv "rl temp"
alias pli print_latch
alias cy "cycle -F 1"
alias im imfs
alias fx1 "fx -N 1"
alias el4 "eliminate -N 4"
alias if6 "if -K 6"
alias fr fretime -g
alias icb "ic -M 2 -B 10 -s"
alias cs "care_set "
alias rwsat "st; rw -l; b -l; rw -l; rf -l"
alias drwsat2 "st; drw; b -l; drw; drf; ifraig -C 20; drw; b -l; drw; drf"
alias share "st; multi -m; fx; resyn2"
alias addinit "read_init; undc; strash; zero"
alias blif2aig "undc; strash; zero"
alias v2p "&vta_gla; &ps; &gla_derive; &put; w 1.aig; pdr -v"
alias g2p "&ps; &gla_derive; &put; w 2.aig; pdr -v"
# resubstitution scripts for the IWLS paper
alias src_rw "st; drw -l; rwz -l; rwz -l"
alias src_rw "st; rw -l; rwz -l; rwz -l"
alias src_rs "st; rs -K 6 -N 2 -l; rs -K 9 -N 2 -l; rs -K 12 -N 2 -l"
alias src_rws "st; drw -l; rs -K 6 -N 2 -l; rwz -l; rs -K 9 -N 2 -l; rwz -l; rs -K 12 -N 2 -l"
alias resyn2rs "b; rs -K 6; drw; rs -K 6 -N 2; rf; rs -K 8; b; rs -K 8 -N 2; drw; rs -K 10; rwz; rs -K 10 -N 2; b; rs -K 12; rfz; rs -K 12 -N 2; rwz; b"
alias compress2rs "b -l; rs -K 6 -l; drw -l; rs -K 6 -N 2 -l; rf -l; rs -K 8 -l; b -l; rs -K 8 -N 2 -l; drw -l; rs -K 10 -l; rwz -l; rs -K 10 -N 2 -l; b -l; rs -K 12 -l; rfz -l; rs -K 12 -N 2 -l; rwz -l; b -l"
alias c2 "ua; compress2rs; sa"
alias ic "indcut -v"
alias lp "lutpack"
alias c "ua; compress; sa"
alias c1 "ua; compress;b -l; rs -K 6 -l; drw -l; rs -K 6 -N 2 -l; rf -l; rs -K 8 -l; b -l; sa"
alias dr dretime
alias ds dsec -v
alias dp dprove -v
# experimental implementation of don't-cares
alias resyn2rsdc "b; rs -K 6 -F 2; drw; rs -K 6 -N 2 -F 2; rf; rs -K 8 -F 2; b; rs -K 8 -N 2 -F 2; drw; rs -K 10 -F 2; rwz; rs -K 10 -N 2 -F 2; b; rs -K 12 -F 2; rfz; rs -K 12 -N 2 -F 2; rwz; b"
alias compress2rsdc "b -l; rs -K 6 -F 2 -l; drw -l; rs -K 6 -N 2 -F 2 -l; rf -l; rs -K 8 -F 2 -l; b -l; rs -K 8 -N 2 -F 2 -l; drw -l; rs -K 10 -F 2 -l; rwz -l; rs -K 10 -N 2 -F 2 -l; b -l; rs -K 12 -F 2 -l; rfz -l; rs -K 12 -N 2 -F 2 -l; rwz -l; b -l"
# minimizing for FF literals
alias fflitmin "compress2rs; ren; sop; ps -f"
# temporaries
#alias t "rvl th/lib.v; rvv th/t2.v"
#alias t "so c/pure_sat/test.c"
#alias t "r c/14/csat_998.bench; st; ps"
#alias t0 "r res.blif; aig; mfs"
#alias t "r res2.blif; aig; mfs"
#alias tt "r a/quip_opt/nut_001_opt.blif"
#alias ttb "wh a/quip_opt/nut_001_opt.blif 1.blif"
#alias ttv "wh a/quip_opt/nut_001_opt.blif 1.v"
#alias reach "st; ps; compress2; ps; qrel; ps; compress2; ps; qreach -v; ps"
alias qs1 "qvar -I 96 -u; ps; qbf -P 96"
alias qs2 "qvar -I 96 -u; qvar -I 97 -u; ps; qbf -P 96"
alias qs3 "qvar -I 96 -u; qvar -I 97 -u; qvar -I 98 -u; ps; qbf -P 96"
alias qs4 "qvar -I 96 -u; qvar -I 97 -u; qvar -I 98 -u; qvar -I 99 -u; ps; qbf -P 96"
alias qs5 "qvar -I 96 -u; qvar -I 97 -u; qvar -I 98 -u; qvar -I 99 -u; qvar -I 100 -u; ps; qbf -P 96"
alias qs6 "qvar -I 96 -u; qvar -I 97 -u; qvar -I 98 -u; qvar -I 99 -u; qvar -I 100 -u; qvar -I 101 -u; ps; qbf -P 96"
alias qs7 "qvar -I 96 -u; qvar -I 97 -u; qvar -I 98 -u; qvar -I 99 -u; qvar -I 100 -u; qvar -I 101 -u; qvar -I 102 -u; ps; qbf -P 96"
alias qs8 "qvar -I 96 -u; qvar -I 97 -u; qvar -I 98 -u; qvar -I 99 -u; qvar -I 100 -u; qvar -I 101 -u; qvar -I 102 -u; qvar -I 103 -u; ps; qbf -P 96"
alias qs9 "qvar -I 96 -u; qvar -I 97 -u; qvar -I 98 -u; qvar -I 99 -u; qvar -I 100 -u; qvar -I 101 -u; qvar -I 102 -u; qvar -I 103 -u; qvar -I 104 -u; ps; qbf -P 96"
alias qsA "qvar -I 96 -u; qvar -I 97 -u; qvar -I 98 -u; qvar -I 99 -u; qvar -I 100 -u; qvar -I 101 -u; qvar -I 102 -u; qvar -I 103 -u; qvar -I 104 -u; qvar -I 105 -u; ps; qbf -P 96"
alias chnew "st; haig_start; resyn2; haig_use"
alias chnewrs "st; haig_start; resyn2rs; haig_use"
alias stdsd "r test/6in.blif; st; ps; u; bdd; dsd -g; st; ps"
alias trec "rec_start; r c.blif; st; rec_add; rec_use"
alias trec4 "rec_start -K 4; r i10.blif; st; rec_add; rec_use"
alias trec5 "rec_start -K 5; r i10.blif; st; rec_add; rec_use"
alias trec6 "rec_start -K 6; r i10.blif; st; rec_add; rec_use"
alias trec7 "rec_start -K 7; r i10.blif; st; rec_add; rec_use"
alias trec8 "rec_start -K 8; r i10.blif; st; rec_add; rec_use"
alias trec10 "rec_start -K 10; r i10.blif; st; rec_add; rec_use"
alias trec12 "rec_start -K 12; r i10.blif; st; rec_add; rec_use"
#alias tsh "r i10_if.blif; st; ps; u; sw; st; ps; cec"
alias tst4 "r i10_if4.blif; st; ps; r x/rec4_.blif; st; rec_start; r i10_if4.blif; st -r; ps; cec"
alias tst4n "r i10_if4.blif; st; ps; r 5npn/all_functions.aig; st; rec_start; r i10_if4.blif; st -r; ps; cec"
alias tst6 "r i10_if6.blif; st; ps; r x/rec6_16_.blif; st; rec_start; r i10_if6.blif; st -r; ps; cec"
alias sn short_names
alias inth "int -rv -C 25000 -N 10000"
alias inthh "int -rv -C 75000 -N 100"
alias a "alias "
alias indh "ind -v -F 50 -C 10000"
alias indhu "ind -vu -F 25 -C 10000"
#alias reachx "reach -v -B 2000000 -F 20000"
alias dc2rs "ua; compress2rs; ps"
alias ffx "ps;orpos;qua_ffix"
alias bfx "ps;orpos;qua_bfix"
alias era "&get;&era -mv;&put"
#simulations
alias simh "sim -m -F 500 -W 15"
alias simhh "sim -m -F 2500 -W 3"
alias simdeep "sim -m -F 50000 -W 1"
alias simwide "sim -m -F 500 -W 255"
#BMC's:
alias bmc2h "bmc2 -v -C 25000 -G 250000 -F 100"
alias bmc2hh "bmc2 -v -C 75000 -G 750000 -F 100"
#SIMPLIFICATIONS
alias scr "&get; &scorr; &put"
alias lcr "&get; &lcorr; &put"
alias trm "logic;trim;st;ps"
alias smp "ua;ps;scl;ps;drw;dr;lcorr;drw;dr;ps;scorr;ps;fraig;ps;dc2;dr;scorr -F 2;ps;dc2rs;w temp.aig"
alias smp1 "scl;drw;dr;lcorr;drw;dr;scorr;fraig;dc2rs"
alias smp2 "ua;ps;scl;ps;drw;dr;lcorr;drw;dr;ps;scorr;ps;fraig;ps;dc2;dr;ps;dc2rs;w temp.aig"
alias smpf "ua;ps;scl;lcr;ps;drw;dr;ps;scr;ps;dc2;&get;&scorr -F 2;&put;dr;ps;dc2;ps;w temp.aig"
alias &smp "ua;&get;&ps;&scl;&ps;&dc2;&put;dr;&get;&lcorr;&dc2;&put;dr;&get;&ps;&scorr;&ps;&fraig;&ps;&dc2;&put;dr;&get;&scorr -F 2;&ps;&dc2;&put;w temp.aig"
alias smplite '&get;&scl;&dc2;&put;dr;&get;&lcorr;&dc2;&put;dr;&get;&scorr;&dc2;&put;dr;&get;&dc2;&put;ps;w temp.aig'
alias &smp1 "ua;&get;&ps;&scl;&ps;&dc2;&put;dr;&get;&lcorr;&dc2;&put;dr;&get;&ps;&scorr;&ps;&fraig;&ps;&dc2;&put;dr;&get;&ps;&dc2;&put;w temp.aig"
alias &smpf "ua;ps;drw;&get;&ps;&scl;&ps;&put;dr;&get;&ps;&lcorr;&ps;&dc2;&ps;&scorr;&ps;&put;drw;ps;w temp.aig"
#for each output separately
alias simpk "dprove -vrcbkmiu -B 10 -D 1000"
alias simpkh "simpk -D 5000"
alias simpkf "simpk -D 10"
#ABSTRACTIONS
#reparameterization
alias rpm "ps;&get;&reparam;&put;ps"
#register abstraction
alias absh "abs -se -D 200000 -R 2; short_names"
alias abshx "abs -se -D 1000000; short_names"
alias absr "abs -ser -G 2000; short_names"
alias absp "abs -sep -G 2000; short_names"
alias absh1 "abs -se -D 200000 -R 1; short_names"
#ABSTRACTION allowing continuation of register abstraction
alias absgo "&get; &abs_start -C 10000 -R 2; &ps; &w 1.aig; &abs_derive;&put; w gabs.aig"
alias absgof "&get; &abs_start -C 1000 -R 2; &ps; &w 1.aig; &abs_derive;&put; w gabs.aig"
alias absgoh "&get; &abs_start -C 200000 -R 2; &ps; &w 1.aig; &abs_derive;&put;w gabs.aig"
#continuation after a cex is found
alias absc "&r 1.aig; &ps; &abs_refine; &w 1.aig; &ps; &abs_derive; &ps;&put; w gabs.aig"
#PBA - proof based abstraction. continuation with cex is done with absc.
alias pbago "&get; &pba_start -vd -C 25000 -F 10; &ps; &w 1.aig; &abs_derive; &put; w gabs.aig"
#SPECULATION
#initial speculation where equivalences are gathered.
alias spechisysf "ua; &get; &equiv -s -W 512 -F 2000; &semi -v -F 50; &ps; &speci -F 1000 -C 25000; &srm -s; r gsrm.aig; &ps; &w gore.aig"
alias spechisysfx "ua; &get; &equiv -s -W 512 -F 2000; &semi -v -F 50; &ps; &speci -F 10000 -C 200000; &srm -s; r gsrm.aig; &ps; &w gore.aig"
alias spechisysff "ua; &get; &equiv -s -W 512 -F 2000; &semi -v -F 50; &ps; &speci -F 10000 -C 5000; &srm -s; r gsrm.aig; &ps; &w gore.aig"
alias spechisysfq "ua; &get; &equiv -s -W 512 -F 2000; &semi -v -F 50; &ps; &speci -F 10000 -C 10; &srm -s; r gsrm.aig; &ps; &w gore.aig"
# CONTINUATION OF SPECULATION
#BMC based:
alias spec "&r gore.aig;&srm -s;r gsrm.aig; bmc2 -v -F 100 -C 10000 -G 100000; &resim -m; &w gore.aig; &ps "
alias spech "&r gore.aig;&srm -s;r gsrm.aig;smp;ps; bmc2 -v -F 100 -C 25000 -G 250000; &resim -m; &w gore.aig; &ps "
alias spechh "&r gore.aig;&srm ;r gsrm.aig;smp;simpkf;smp;bmc2 -v -F 100 -C 200000; &resim -m; &w gore.aig; &ps "
alias specheavy "&r gore.aig;&srm -s;r gsrm.aig; smp;simpk;smp;bmc2 -v -F 5000 -C 200000 -F 100; &resim -m; &w gore.aig; &ps"
#BDD based:
alias specb "&r gore.aig;&srm ;r gsrm.aig;smp;ps; reach -ov -B 1000000 -F 200000; &resim -m; &w gore.aig; &ps "
alias specbb "&r gore.aig;&srm ;r gsrm.aig;smp;simpk -D 100;smp;ps; reach -ov -B 1000000 -F 200000; &resim -m; &w gore.aig; &ps "
#Interpolation based:
alias specint "&r gore.aig;&srm ;r gsrm.aig;inth;&resim -m; &w gore.aig; &ps"
alias speck "&r gore.aig;&srm ;r gsrm.aig;simpk;&resim -m; &w gore.aig; &ps "
alias speckf "&r gore.aig;&srm ;r gsrm.aig;simpk -D 100;&resim -m; &w gore.aig; &ps "
alias specpk "&r gore.aig;&srm ;r gsrm.aig;simpkf;smp;ps; simpk ; &resim -m; &w gore.aig; &ps "
alias specpkh "&r gore.aig;&srm ;r gsrm.aig;simpkf;smp;ps; simpkh ; &resim -m; &w gore.aig; &ps "
alias specp "&r gore.aig;&srm ;r gsrm.aig;ps; dprove -rmficbu -B 10 -D 10; &resim -m; &w gore.aig; &ps "
alias spece "&r gore.aig; &srm ;r gsrm.aig; smp; ps; &w gore.aig; &get; &era -m; &r gore.aig; &resim -m; &w gore.aig; &ps"
#simulation based:
alias specs "&r gore.aig; &srm ; r gsrm.aig; sim -m -F 500 -W 15; &resim -m; &w gore.aig; &ps "
alias specsh "&r gore.aig; &srm ; r gsrm.aig; sim -m -F 3500 -W 3; &resim -m; &w gore.aig;&ps "
alias speci "&r gore.aig;&srm ;r gsrm.aig;int -tk -C 2000;&resim -m; &w gore.aig; &ps"
alias %sa "set autoexec %ps"
alias %scr "%get;%st;%scorr;%put;st"
alias sc "fold;w tempc.aig;unfold -s"
alias uc "r tempc.aig;unfold -s"
alias smpc "scl;drw;ps;scorr -c;ps;fraig;ps;compress2rs;ps"
alias abseen "&get;,abs -vt=60 -timeout=60 -bob=10 -aig=temp.aig;r temp.aig"
alias pdreen "&get;,pdr -vt=60"
alias inteen "&get;,imc -vt=60"
alias bmceen "&get;,bmc -vt=60"
alias src_rws "st; rw -l; rs -K 6 -N 2 -l; rwz -l; rs -K 9 -N 2 -l; rwz -l; rs -K 12 -N 2 -l"
alias resyn2rs "b; rs -K 6; rw; rs -K 6 -N 2; rf; rs -K 8; b; rs -K 8 -N 2; rw; rs -K 10; rwz; rs -K 10 -N 2; b; rs -K 12; rfz; rs -K 12 -N 2; rwz; b"
alias compress2rs "b -l; rs -K 6 -l; rw -l; rs -K 6 -N 2 -l; rf -l; rs -K 8 -l; b -l; rs -K 8 -N 2 -l; rw -l; rs -K 10 -l; rwz -l; rs -K 10 -N 2 -l; b -l; rs -K 12 -l; rfz -l; rs -K 12 -N 2 -l; rwz -l; b -l"
# use this script to convert 1-valued and DC-valued flops for an AIG
alias fix_aig "logic; undc; strash; zero"
# use this script to convert 1-valued and DC-valued flops for a logic network coming from BLIF
alias fix_blif "undc; strash; zero"
# lazy man's synthesis
alias recadd3 "st; rec_add3; b; rec_add3; dc2; rec_add3; if -K 8; bidec; st; rec_add3; dc2; rec_add3; if -g -K 6; st; rec_add3"
import os
import time
from datetime import *
##import par
##from abc_common import *
import abc_common
......@@ -17,26 +19,6 @@ from pyabc_split import *
#x('source ../../abc.rc')
#abc_common.x('source ../../abc.rc')
#IBM directories
# directories = ['ibmhard']
ibmhard = (33,34,36,37,28,40,42,44,48,5,49,50,52,53,58,59,6,64,66,67,68,\
69,70,71,72,73,74,75,76,78,79,80,81,82,83,84,86,9,87,89,90,0,10,\
11,12,14,15,16,2,19,20,29,31,32)
#directories = ['IBM_converted']
#ibm_convert = (3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,\
# 27,28,29,30,31,32,33,34,35,36,37,38,39,40,41)
#IBM_converted = range(42)[3:]
#the smaller files in ascending order
#IBM_converted = (26,38,21,15,22,23,20,27,16,19,24,28,18,9,8,7,6,25,17,3,4)
#the larger file in order (skipping 39)
#IBM_converted = (39,5,40,41,13,12,10,14,11,31,33,36,29,34,35,37,30)
IBM_converted = (5,40,41,13,12,10,14,11,31,33,36,29,34,35,37,30)
def scorriter():
""" apply scorr with increasing conflicts up to 100"""
x('time')
......@@ -159,6 +141,48 @@ def list_aig(s=''):
result = result + [name]
return result
def list_original():
list_dir = os.listdir('.')
list_dir.sort()
out = []
for i in range(len(list_dir)):
name = '%s/original.aig'%list_dir[i]
if os.access('%s'%name,os.R_OK):
abc('r %s;&ps'%name)
if n_latches() > 0 and n_pos() > 1:
size = str(sizeof())
print list_dir[i],
ps()
out = out + ['%s: %s'%(list_dir[i],size)]
return out
def list_size(s=''):
""" prnts out the sizes of aig files. Leaves .aig as part of name"""
#os.chdir('../ibm-web')
list_all = os.listdir('.')
dir = lst(list_all,'.aig')
dir.sort()
result = []
for j in range(len(dir)):
## name = dir[j][:-4]
name = dir[j] #leaves .aig as part of name
if not s_in_s(s,name):
continue
print '%s '%name,
## abc('r %s.aig'%name)
abc('r %s'%name)
ps()
result = result + [name[:-4]] #takes .aig off of name
return result
def rename(l=[]):
for j in range(len(l)):
name = l[j]
name1 = name +'.aig'
name2 = name[:-4]+'simp.aig' #take off _smp and put on simp
os.rename(name1,name2)
def list_blif(s=''):
""" prnts out the sizes of aig files"""
#os.chdir('../ibm-web')
......@@ -222,11 +246,15 @@ def cleanup():
(s_in_s('_bip', name)) or (s_in_s('sm0', name)) or (s_in_s('gabs', name))
or (s_in_s('temp', name)) or (s_in_s('__', name)) or (s_in_s('greg', name)) or (s_in_s('tf2', name))
or (s_in_s('gsrm', name)) or (s_in_s('_rpm', name )) or (s_in_s('gsyn', name)) or (s_in_s('beforerpm', name))
or (s_in_s('afterrpm', name)) or (s_in_s('initabs', name)) or (s_in_s('.status', name)) or (s_in_s('_init', name))
or (s_in_s('afterrpm', name)) or (s_in_s('initabs', name)) or (s_in_s('_init', name))
or (s_in_s('_osave', name)) or (s_in_s('tt_', name)) or (s_in_s('_before', name)) or (s_in_s('_after', name))
or (s_in_s('_and', name)) or (s_in_s('_final', name)) or (s_in_s('_spec', name)) or (s_in_s('temp.a', name))
or (s_in_s('_and', name)) or (s_in_s('_spec', name)) or (s_in_s('temp.a', name))
or (s_in_s('_sync', name)) or (s_in_s('_old', name)) or (s_in_s('_cone_', name)) or (s_in_s('_abs', name))
or (s_in_s('_vabs', name))
or (s_in_s('_vabs', name)) or (s_in_s('_gla', name)) or (s_in_s('vabs', name)) or (s_in_s('_mp2', name))
or (s_in_s('_sc1', name)) or (s_in_s('_sc2', name)) or (s_in_s('_after', name))
or (s_in_s('_before', name)) or (s_in_s('_aigs_', name)) or (s_in_s('_cex.', name))
or (s_in_s('_bmc1', name)) or (s_in_s('_p0_', name)) or (s_in_s('_p1_', name))
or (s_in_s('_unsolv', name)) or (s_in_s('_iso1', name))
):
os.remove(name)
......@@ -296,6 +324,32 @@ def absn(a,c,s):
write_file('absn')
return "Done"
def time_stamp():
d=datetime.today()
s = d.strftime('%m.%d.%y-%X')
return s
def apply_sp(list):
global m_trace
s = time_stamp()
out_name = "%s-traces.txt"%s
print out_name
if os.access(out_name,os.R_OK):
os.remove(out_name)
f = open(out_name,'w')
print f
for j in range(len(list)):
name = list[j]
print '\n\n**** %s ****\n'%name
f.write('\n\n****%s ****'%name)
read_file_quiet(name)
result = super_prove()
trace = result[1]
s = str(trace)
f.write('\n\n')
f.write(s)
f.flush()
f.close()
def xfiles():
global f_name
......
......@@ -11,4 +11,4 @@ abc_root()
abc_dir=$(abc_root "$0")
bin_dir="${abc_dir}"/bin
exec ${bin_dir}/abc -c "/simple_prove_aiger $*"
exec ${bin_dir}/abc -c "/multi_prove_aiger $*"
......@@ -7,6 +7,8 @@ import shutil
import redirect
import optparse
from contextlib import contextmanager
def read_cmd(args):
if len(args)==2:
par.read_file_quiet(args[1])
......@@ -90,7 +92,50 @@ def print_aiger_result(args):
pyabc.add_abc_command(print_aiger_result, "ZPython", "/print_aiger_result", 0)
def proof_command_wrapper(prooffunc, category_name, command_name, change):
@contextmanager
def replace_report_result(multi):
def report_result(po, result):
print "REPORT RESULT: ", po, result
print >> stdout, "%d"%result
print >> stdout, "b%d"%po
print >> stdout, "."
def report_liveness_result(po, result):
print "REPORT RESULT: ", po, result
print >> stdout, "%d"%result
print >> stdout, "j%d"%po
print >> stdout, "."
def report_bmc_depth(depth):
if not multi:
print "REPORT BMC DEPTH:", depth
print >> stdout, "u%d"%depth
with redirect.save_stdout() as stdout:
old_report_result = par.report_result
par.report_result = report_result
#old_report_liveness_result = par.report_liveness_result
par.report_liveness_result = report_liveness_result
old_report_bmc_depth = par.report_bmc_depth
par.report_bmc_depth = report_bmc_depth
try:
yield
finally:
par.report_result = old_report_result
#~ par.report_liveness_result = report_liveness_result
par.report_bmc_depth = old_report_bmc_depth
def proof_command_wrapper_internal(prooffunc, category_name, command_name, change, multi=False):
def wrapper(argv):
......@@ -104,12 +149,13 @@ def proof_command_wrapper(prooffunc, category_name, command_name, change):
options, args = parser.parse_args(argv)
if len(args) != 2:
print args
parser.print_usage()
return 0
aig_filename = os.path.abspath(args[1])
with replace_report_result(multi):
if not options.noisy:
pyabc.run_command('/pushredirect')
......@@ -127,30 +173,82 @@ def proof_command_wrapper(prooffunc, category_name, command_name, change):
shutil.copyfile(aig_filename, basename)
aig_filename = basename
par.read_file_quiet(aig_filename)
result = prooffunc()
result = prooffunc(aig_filename)
par.cex_list = []
except:
result = None
if not multi:
if result=="SAT":
par.report_result(0,1)
elif result=="UNSAT":
par.report_result(0,0)
elif type(result)==list and len(result)>0 and result[0] == "SAT":
par.report_result(0,1)
elif type(result)==list and len(result)>0 and result[0] == "UNSAT":
par.report_result(0,0)
else:
par.report_result(0,2)
if not options.current_dir:
pyabc.run_command('/popdtemp')
if not options.noisy:
pyabc.run_command('/popredirect')
if result=="SAT":
print 1
elif result=="UNSAT":
print 0
else:
print 2
return 0
pyabc.add_abc_command(wrapper, category_name, command_name, change)
proof_command_wrapper(par.super_prove, 'HWMCC11', '/super_prove_aiger', 0)
proof_command_wrapper(par.simple_prove, 'HWMCC11', '/simple_prove_aiger', 0)
proof_command_wrapper(par.simple_bip, 'HWMCC11', '/simple_bip_aiger', 0)
def proof_command_wrapper(prooffunc, category_name, command_name, change, multi=False):
def pf(aig_filename):
par.read_file_quiet(aig_filename)
return prooffunc()
return proof_command_wrapper_internal(pf, category_name, command_name, change, multi)
proof_command_wrapper(par.sp, 'HWMCC13', '/super_prove_aiger', 0)
proof_command_wrapper(par.simple, 'HWMCC13', '/simple_aiger', 0)
proof_command_wrapper(par.simple_bip, 'HWMCC13', '/simple_bip_aiger', 0)
proof_command_wrapper(par.simple_sat, 'HWMCC13', '/simple_sat_aiger', 0)
proof_command_wrapper(par.mp, 'HWMCC13', '/multi_prove_aiger', 0, multi=True)
from niklas import run_niklas_multi
def simple_liveness_prooffunc(aig_filename):
def simplify(aiger_in, aiger_out):
saved = utils.save_po_info(aiger_in, tmp[0])
par.read_file_quiet(tmp[0])
par.pre_simp()
pyabc.run_command( 'write_aiger %s'%tmp[1] )
#~ pyabc.run_command( 'read_aiger %s'%tmp[0] )
#~ pyabc.run_command( 'dc2 ; dc2 ; dc2 ; dc2' )
#~ pyabc.run_command( 'write_aiger %s'%tmp[1] )
utils.restore_po_info( saved, tmp[1], aiger_out )
def report_result(id, res):
if res and 'result' in res:
result = res['result']
if result=='proved':
par.report_liveness_result(id, 0)
return True
elif result=='failed':
par.report_liveness_result(id, 1)
return True
return False
try:
run_niklas_multi(aig_filename, simplify=simplify, report_result=report_result)
except:
import traceback
traceback.print_exc()
proof_command_wrapper_internal( simple_liveness_prooffunc, "HWMCC13", "/simple_liveness_aiger", 0, multi=True)
import os
import sys
import time
import tempfile
import subprocess
from contextlib import contextmanager
import pyabc
import pyabc_split
@contextmanager
def temp_file_names(N, suffix=""):
files = []
try:
for i in xrange(N):
files.append( tempfile.NamedTemporaryFile(suffix=suffix) )
yield [ f.name for f in files ]
finally:
for f in files:
f.close()
def parse_bip_status(status):
res = {}
for line in open(status, 'r'):
line = line.strip()
colon = line.find(':')
if colon < 0:
continue
field = line[:colon]
data = line[colon+2:]
res[field] = data
return res
def run_bip(args, aiger):
with temp_file_names(1) as tmpnames:
args = [
'bip',
'-abc',
'-input=%s'%aiger,
'-output=%s'%tmpnames[0],
] + args;
rc = subprocess.call(args, preexec_fn=pyabc._set_death_signal)
if rc!=0:
return None
return parse_bip_status(tmpnames[0])
from pyaig import AIG, read_aiger, write_aiger, utils
def run_niklas_single(aiger, simplify, report_result, timeout=None):
orig_args = [
[ ',live', '-k=l2s', '-eng=treb-abs' ],
[ ',live', '-k=inc' ],
[ ',live', '-k=l2s', '-eng=bmc' ],
]
simplified_args = [
[ ',live', '-k=inc' ],
[ ',live', '-k=l2s', '-eng=bmc' ],
[ ',live', '-k=l2s', '-eng=treb' ],
]
with temp_file_names(1, suffix='.aig') as simple_aiger:
orig_funcs = [ pyabc_split.defer(run_bip)(a, aiger) for a in orig_args ]
simplified_funcs = [ pyabc_split.defer(run_bip)(a, simple_aiger[0]) for a in simplified_args ]
with pyabc_split.make_splitter() as splitter:
sleep_id = splitter.fork_one( lambda : time.sleep(timeout ) ) if timeout else None
ids = splitter.fork_all( orig_funcs )
kill_if_simplified = ids[1:]
simplifier_id = splitter.fork_one( pyabc_split.defer(simplify)(aiger, simple_aiger[0]) )
for id, res in splitter:
if id == sleep_id:
return False
if id == simplifier_id:
if not res:
continue
splitter.kill(kill_if_simplified)
splitter.fork_all( simplified_funcs )
continue
if report_result(res):
return True
return False
def run_niklas_multi(aiger, simplify, report_result):
with open(aiger, 'r') as fin:
aig = read_aiger( fin )
n_j_pos = aig.n_justice()
assert n_j_pos > 0
if n_j_pos==1:
return run_niklas_single( aiger, simplify, report_result=lambda res: report_result(0, res) )
with temp_file_names(n_j_pos, suffix='.aig') as single_aiger:
def extract(j_po):
with open(single_aiger[j_po], 'w') as fout:
write_aiger(utils.extract_justice_po(aig, j_po), fout)
for _ in pyabc_split.split_all_full( [pyabc_split.defer(extract)(i) for i in xrange(n_j_pos) ] ):
pass
unsolved = set( xrange(n_j_pos) )
timeout = 1
while unsolved:
for j_po in sorted(unsolved):
if run_niklas_single( single_aiger[j_po], simplify, report_result=lambda res: report_result(j_po, res), timeout=timeout ):
unsolved.remove(j_po)
timeout *= 2
return not unsolved
if __name__ == "__main__":
def simplify(aiger_in, aiger_out):
with temp_file_names(2, suffix='.aig') as tmp:
saved = utils.save_po_info(aiger_in, tmp[0])
pyabc.run_command( 'read_aiger %s'%tmp[0] )
pyabc.run_command( 'dc2 ; dc2 ; dc2 ; dc2' )
pyabc.run_command( 'write_aiger %s'%tmp[1] )
utils.restore_po_info( saved, tmp[1], aiger_out )
return True
def report_result(id, res):
if res and 'result' in res:
result = res['result']
if result=='proved':
print "PROVED: ", id
return True
elif result=='failed':
print "FAILED:", id
return True
return False
aiger = "test.aig"
while True:
try:
run_niklas_multi(aiger, simplify=simplify, report_result=report_result)
except:
import traceback
traceback.print_exc()
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -10,6 +10,5 @@ abc_root()
abc_dir=$(abc_root "$0")
bin_dir="${abc_dir}"/bin
aig_file="$1"
exec ${bin_dir}/abc -c "/rf ${aig_file} ; /pushredirect ; /pushdtemp ; bmc2 ; /popdtemp ; /popredirect ; /print_aiger_result"
exec ${bin_dir}/abc -c "/simple_aiger $*"
......@@ -10,6 +10,5 @@ abc_root()
abc_dir=$(abc_root "$0")
bin_dir="${abc_dir}"/bin
aig_file="$1"
exec "${bin_dir}"/abc -c "/rf ${aig_file} ; /pushredirect ; /pushdtemp ; bmc3 ; /popdtemp ; /popredirect ; /print_aiger_result"
exec ${bin_dir}/abc -c "/simple_liveness_aiger $*"
......@@ -10,6 +10,5 @@ abc_root()
abc_dir=$(abc_root "$0")
bin_dir="${abc_dir}"/bin
aig_file="$1"
exec ${bin_dir}/abc -c "/rf ${aig_file} ; /pushredirect ; /pushdtemp ; dprove ; /popdtemp ; /popredirect ; /print_aiger_result"
exec ${bin_dir}/abc -c "/simple_sat_aiger $*"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment