Skip to content

alpavlenko/aig-repeat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AIG Repeat

Installation

git clone [email protected]:alpavlenko/aig-repeat.git --recurse-submodules

To use simplify(...) method, compile ABC:

cd abc
make

If you have problems with the compilation, then visit the original repository.

Usage

Read AIG from file in binary (.aig) and ascii (.aag) format:

from enc import AIG

enc_from_ascii = AIG(from_file='file.aag')
enc_from_binary = AIG(from_file='file.aig')

Write AIG to file in binary, ascii format, or convert it to CNF:

from enc import AIG

enc = AIG(from_file='input.aig')
enc.to_file('file_in_ascii.aag')
enc.to_file('file_in_binary.aig')
# 
enc.to_file('file_in_dimacs.cnf')

Repeat AIG around subset of input variables:

from enc import AIG

enc = AIG(from_file='file.aig')
repeat_literals = enc.inputs[80:]
# repeat enc 10 times around first 80 input bits
new_enc, _ = enc.repeat(repeat_literals, count=10)
# check length of outputs for new enc 
assert 10 * len(enc.outputs) == len(new_enc.outputs)

Simplify AIG using ABC tool:

from enc import AIG

enc = AIG(from_file='input.aig')
simp_enc = enc.simplify()
simp_enc.to_file('simplified.aig')

Substitute values to AIG variables:

from enc import AIG

enc = AIG(from_file='file.aig')
substitution = [
    var if val else var + 1 for var, val
    in zip(enc.inputs[80:], [0] * 80)
]
# substitute 80 zeros into enc input
sub_enc, _ = enc.substitute(substitution)
sub_enc.simplify().to_file('simplified.aig')

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages