Skip to content

A fast circuit compiler that can seamlessly integrate with existing Julia code and can incrementally build up expressions and regenerate optimized circuits after substitutions and manipulations using standard Julia functions.

Notifications You must be signed in to change notification settings

wi11dey/Gates.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gates.jl

A fast circuit compiler that can seamlessly integrate with existing Julia code and can incrementally build up logic gate expressions and regenerate optimized circuits after substitutions and manipulations using standard Julia functions. A number of common logical transformations are also supported. To test, see SHA256.jl for SHA-2 implementation which can be compiled to a circuit and functionally encrypted or transformed to conjunctive normal form for obfuscation for simplification.

Additionally, interoperable with circuits in the widely-used Bristol format (see bristol.jl).

Transformations supported

  • Tseytin transformation to Conjunctive Normal Form
  • Intra-clause variable de-duplication
  • Dead variable removal
  • Circuit randomization

Example

using Gates
using CNFs

import SHA256: sha256

a = SymbolicInteger{64}(:a)
circuit = sha256([a])

@show cnfs = CNF.(circuit.bits)

@show simplify!.(cnfs)

@show substitue(circuit, a=0x010101)

About

A fast circuit compiler that can seamlessly integrate with existing Julia code and can incrementally build up expressions and regenerate optimized circuits after substitutions and manipulations using standard Julia functions.

Topics

Resources

Stars

Watchers

Forks

Languages