Template-based Circuit Understanding on 1 Pramod Subramanyan 2 Bruno - - PowerPoint PPT Presentation

template based circuit understanding
SMART_READER_LITE
LIVE PREVIEW

Template-based Circuit Understanding on 1 Pramod Subramanyan 2 Bruno - - PowerPoint PPT Presentation

Template-based Circuit Understanding on 1 Pramod Subramanyan 2 Bruno Dutertre 1 Adri` a Gasc Ashish Tiwari 1 c 1 Sharad Malik 2 Dejan Jovanovi 1 SRI International 2 Princeton University Motivation Verify/reverse-engineer a digital circuit


slide-1
SLIDE 1

Template-based Circuit Understanding

Adri` a Gasc´

  • n1

Pramod Subramanyan2 Bruno Dutertre1 Ashish Tiwari1 Dejan Jovanovi´ c1 Sharad Malik2

1SRI International 2Princeton University

slide-2
SLIDE 2

Motivation

Verify/reverse-engineer a digital circuit ⇒ EXTRACT and UNDERSTAND subcomponents

slide-3
SLIDE 3

Verify/reverse-engineer a digital circuit ⇒ EXTRACT and UNDERSTAND subcomponents

◮ FSM extraction [Shi et. al.] ◮ Functional aggregation and matching [Subramanyan et. al.] ◮ Word identification and propagation [Li et. al.] ◮ Identification of repeated structures [Hansen et. al.]

slide-4
SLIDE 4

Verify/reverse-engineer a digital circuit ⇒ EXTRACT and UNDERSTAND subcomponents

◮ FSM extraction [Shi et. al.] ◮ Functional aggregation and matching [Subramanyan et. al.] ◮ Word identification and propagation [Li et. al.] ◮ Identification of repeated structures [Hansen et. al.]

Most of these techniques do not the find the right permutations in word components

slide-5
SLIDE 5

Verify/reverse-engineer a digital circuit ⇒ EXTRACT and UNDERSTAND subcomponents

slide-6
SLIDE 6

What does it mean to understand a combinational circuit C?

◮ Find an equivalent higher-level definition

◮ Flatten verilog netlist → High-level Verilog ◮ Basic Boolean logic →

Boolean Logic + Words and operations on Words

slide-7
SLIDE 7

What does it mean to understand a combinational circuit C?

◮ Find an equivalent higher-level definition

◮ Flatten verilog netlist → High-level Verilog ◮ Basic Boolean logic →

Boolean Logic + Words and operations on Words

Goal

Given purely Boolean Formula C, produce “equivalent” Formula F

  • ver the theory of bitvectors.
slide-8
SLIDE 8

A Combinational Boolean circuit C(I, O) is (a) a list of input Boolean variables I = x1, ..., xn and (b) a list O = f1, . . . , fm of single-output Boolean formulas with inputs I. For x ∈ {0, 1}n, y ∈ {0, 1}m, by C( x, y) we denote that C produces

  • utput

y on input x

slide-9
SLIDE 9

The library aproach

Check functional equivalence against a library of known components.

◮ C(x1, . . . , xn, f1, . . . , fm) ◮ Clib(x1, . . . , xn, g1, . . . , gm) ◮ Fixed permutations σ, θ

∀ i ∈{1, ..., m}, x ∈ {0, 1}m : fθ(i)(σ( x)) = gi( x)

slide-10
SLIDE 10

The library aproach

Check functional equivalence against a library of known components.

◮ C(x1, . . . , xn, f1, . . . , fm) ◮ Clib(x1, . . . , xn, g1, . . . , gm) ◮ Fixed permutations σ, θ

∀ i ∈{1, ..., m}, x ∈ {0, 1}m : fθ(i)(σ( x)) = gi( x) Limitation: Permutations σ, θ must be known.

slide-11
SLIDE 11

Permutation-independent equivalence checking

◮ C(x1, . . . , xn, f1, . . . , fm) ◮ Clib(x1, . . . , xn, g1, . . . , gm) ◮ To be determined permutations σ, θ

∃σ, θ : ∀i ∈ {1, ..., m}, x ∈ {0, 1}m : fθ(i)(σ( x)) = gi( x)

slide-12
SLIDE 12

Permutation-independent equivalence checking

◮ C(x1, . . . , xn, f1, . . . , fm) ◮ Clib(x1, . . . , xn, g1, . . . , gm) ◮ To be determined permutations σ, θ

∃σ, θ : ∀i ∈ {1, ..., m}, x ∈ {0, 1}m : fθ(i)(σ( x)) = gi( x) Limitation: Still too restrictive.

  • 1. C usually does not have a “standard” functionality.
  • 2. C’s functionality must be fully matched.
slide-13
SLIDE 13

Template-based synthesis

Instead of a reference circuit, our approach requires a template of a specific form.

slide-14
SLIDE 14

How do our templates look like?

A template T of a combinational circuit C(I, O) is:

◮ A subset OT ⊆ O, ◮ a partition I = (IC ∪ n i=1(Wi)), and ◮ a conjuntion of guarded assignments of the form

ai : ψi(IC) ⇒

  • θ(OT) := φi(σ(Wi1), τ(Wi2))
  • where

◮ ψi is a to be determined assignment on IC, ◮ θ, σ, τ are to be determined permutations, and ◮ φi is a binary function over words. ◮ i1, i2 ∈ {1, . . . , n}.

slide-15
SLIDE 15
  • 1. Circuit C(I, O)
  • 2. Subset outputs := O
  • 3. Partition I := control ∪ inputsA ∪ inputsB
  • 4. Template with

(a) To be determined assignments v1, v2 (b) To be determined permutations p, q

(and (=> (value v1 control) (=

  • utputs

(bv-add (permute p inputsA) (permute q inputsB) ) ) ) (=> (value v2 control) (= outputs (ite (bv-slt (permute p inputsA) (permute q inputsB) ) (mk-bv 32 1) (mk-bv 32 0) ) ) ) )

slide-16
SLIDE 16
  • 1. Circuit C(I, O)
  • 2. Subset outputs := O
  • 3. Partition I := control ∪ inputsA ∪ inputsB
  • 4. Template with

(a) To be determined assignments v1, v2 (b) To be determined permutations p, q

∃p, q, v1, v2 : ∀ x ∈ {0, 1}n, y ∈ {0, 1}m : C( x, y) ⇒ T(p, q, v1, v2, x, y)

(and (=> (value v1 control) (=

  • utputs

(bv-add (permute p inputsA) (permute q inputsB) ) ) ) (=> (value v2 control) (= outputs (ite (bv-slt (permute p inputsA) (permute q inputsB) ) (mk-bv 32 1) (mk-bv 32 0) ) ) ) )

slide-17
SLIDE 17

Check validity of Boolean formulas over the theory of bit-vectors with two levels of quantification (∃∀ QF BV):

∃ x : C( x) ∧ ∀ y : A( x, y)

  • 1. High-level preprocessing and simplifications [Wintersteiger et. al.]
  • 2. Counterexample-refinement loop, similar to the approach used in

2QBF solvers [Ranjan et. al., Janota et. al.]

  • 3. Functional signatures [Mohnke et. al.]
slide-18
SLIDE 18

(1) Miniscoping: ∃ x : A ∨ B → ∃ x : A ∨ ∃ x : B ∀ x : A ∧ B → ∀ x : A ∧ ∀ x : B (2) Equality resolution: ∃ x : C( x) ∧ ∀ y : (

  • i

(yi = xi) ⇒ B( y)) → ∃ x : E( x) ∧ ∀ y :

  • i

({yi → xi})(B( y)) (3) Distinguishing signatures.

slide-19
SLIDE 19

Distinguishing Signatures

An output signature sout is a function sout : Bn → D such that, for every function f and permutation τ: sout(f (x1, . . . , xn)) = sout(f (τ(x1), . . . , τ(xn))))

slide-20
SLIDE 20

Distinguishing Signatures

An output signature sout is a function sout : Bn → D such that, for every function f and permutation τ: sout(f (x1, . . . , xn)) = sout(f (τ(x1), . . . , τ(xn))))

∃σ, θ : ∀i ∈ {1, ..., m}, x ∈ {0, 1}m : fθ(i)(σ( x)) = gi( x)

slide-21
SLIDE 21

Distinguishing Signatures

An output signature sout is a function sout : Bn → D such that, for every function f and permutation τ: sout(f (x1, . . . , xn)) = sout(f (τ(x1), . . . , τ(xn))))

∃σ, θ : ∀i ∈ {1, ..., m}, x ∈ {0, 1}m : fθ(i)(σ( x)) = gi( x) ∃x, y : sout(fx) = sout(gy) ⇒ θ(y) = x

slide-22
SLIDE 22

Distinguishing Signatures

An output signature sout is a function sout : Bn → D such that, for every function f and permutation τ: sout(f (x1, . . . , xn)) = sout(f (τ(x1), . . . , τ(xn))))

∃σ, θ : ∀i ∈ {1, ..., m}, x ∈ {0, 1}m : fθ(i)(σ( x)) = gi( x) ∧ θ(y) = x ∃x, y : sout(fx) = sout(gy) ⇒ θ(y) = x

slide-23
SLIDE 23

◮ We consider one input signature and one output signature.

◮ Input dependency ◮ Output dependency

◮ Signatures can be computed independently in the circuit and

the template.

slide-24
SLIDE 24

Experiments

Benchmarks (40 Sat/40 Unsat):

◮ Reverse engineering benchmarks generated from high-level

(behavioral) Verilog using the Synopsys Compiler.

◮ From ISCAS, an academic processor implementation, and synthetic

examples.

◮ ALUs, multipliers, shifters, counters...

Tools:

◮ Yices

(Yices format)

◮ Z3

(SMT2 format)

◮ Bloqqer + DepQBF

(QDimacs)

◮ Bloqqer + RareQs

(QDimacs)

◮ Bloqqer + sKizzo

(QDimacs)

◮ Cir-CEGAR (Mini-SAT)

(QDimacs + top titeral) Variants:

◮ Considered two simple encodings for permutations ◮ Studied effect of preprocessing, encodings, and signatures

slide-25
SLIDE 25

Conclusion and further work

◮ Yices and Z3 are sensitive to the encoding of permutations ◮ Preprocessing and signatures are harmless and crucial in many

cases

◮ Benchmarks are available in SMT2, YICES, QBF and (soon)

QCIR

◮ Just putting together two SAT/SMT solvers is not enough ◮ QDIMACS encoding is not suitable for this kind of synthesis ◮ Integrate signature computation in the Exist-Forall loop ◮ Compare to other synthesis algorithms

slide-26
SLIDE 26

Questions? Comments? Suggestions?

slide-27
SLIDE 27
slide-28
SLIDE 28
slide-29
SLIDE 29