reversible computing theory i: reversible logic models

101
Reversible Computing Reversible Computing Theory I: Theory I: Reversible Logic Reversible Logic Models Models

Upload: geoffrey-kelley

Post on 30-Dec-2015

249 views

Category:

Documents


8 download

TRANSCRIPT

Page 1: Reversible Computing Theory I: Reversible Logic Models

Reversible Computing Theory I:Reversible Computing Theory I:Reversible Logic ModelsReversible Logic Models

Page 2: Reversible Computing Theory I: Reversible Logic Models

Reversible Logic ModelsReversible Logic Models• It is useful to have a logic-level (Boolean) model It is useful to have a logic-level (Boolean) model

of adiabatic circuits.of adiabatic circuits.• Can model all logic using Can model all logic using maximallymaximally pipelinedpipelined

logic elements, which consume their inputs.logic elements, which consume their inputs.– A.k.a., “input consuming” gates.A.k.a., “input consuming” gates.– Warning:Warning: In such models Memory requires In such models Memory requires

recirculation! Thus, this is not necessarily more recirculation! Thus, this is not necessarily more energy-efficient in practice for all problems than energy-efficient in practice for all problems than retractileretractile (non-input consuming) approaches! (non-input consuming) approaches!

• There is a need for more flexible logic models.There is a need for more flexible logic models.

• If inputs are consumed, then the inputIf inputs are consumed, then the inputoutput output logic function must be logic function must be invertibleinvertible..

Page 3: Reversible Computing Theory I: Reversible Logic Models

Input-consuming inverter:Input-consuming inverter:Before:Before: After:After:inin outout inin outout00 -- -- 1111 -- -- 00

E.g.E.g. SCRL implementation: SCRL implementation:

in out

Input arrow indicates inputdata is consumed by element.

Invertible!

Alternate symbol:

in out(Symmetric)

Page 4: Reversible Computing Theory I: Reversible Logic Models

• Input-consuming NAND gate:Input-consuming NAND gate:Before:Before: After:After:AA BB outout AA BB outout0 00 0 -- - - 1- - 10 10 1 --1 01 0 -- - - 0- - 01 11 1 --

• Because it’s irreversible, it has Because it’s irreversible, it has no implementationno implementation in in SCRL (or any fully adiabatic style) as a SCRL (or any fully adiabatic style) as a stand-alonestand-alone, , pipelined logic element!pipelined logic element!

An Irreversible Consuming GateAn Irreversible Consuming Gate

A

B

out

4 possible inputs, 2possible outputs.

At least 2 of the 4 possibleinput cases must lead to

dissipation!

Page 5: Reversible Computing Theory I: Reversible Logic Models

NAND w. 1 input copied?NAND w. 1 input copied?• Still not invertible:Still not invertible: BeforeBefore AfterAfter

AA BB A’A’ outout AA BB A’A’ outout 0 0 - - - - 0 1 0 0 - - - - 0 1 0 1 - - - - 1 1 0 1 - - - - 1 1

1 0 - - - - 1 0 1 0 - - - - 1 0 1 1 - - 1 1 - -

• At least 1 of the 2 transitions to the A’=0, out=1 At least 1 of the 2 transitions to the A’=0, out=1 final state must involve energy dissipation of final state must involve energy dissipation of order order kkBBT. T. How much, exactly? See exercise.How much, exactly? See exercise.

A

B out

A’

Delay buffer

Page 6: Reversible Computing Theory I: Reversible Logic Models

NAND w. 2 inputs copied?NAND w. 2 inputs copied?• Finally, invertible!Finally, invertible! Before:Before: After:After:

AA BB A’A’ B’B’ outout AA BB A’A’ B’B’ outout 0 0 - - - - - 0 0 1 0 0 - - - - - 0 0 1

0 1 - - - - - 0 1 1 0 1 - - - - - 0 1 1 1 0 - - - - - 1 0 1 1 0 - - - - - 1 0 1

1 1 - - - - - 1 1 0 1 1 - - - - - 1 1 0• Any function can be made invertible by simply Any function can be made invertible by simply

preserving copies of all inputs in extra outputs.preserving copies of all inputs in extra outputs.– Note:Note: Not all output combinations here are legal! Not all output combinations here are legal!

• Note there are more outputs than inputs. Note there are more outputs than inputs. – We call this an We call this an expandingexpanding operation. operation.– But, copied inputs can be shared by many gates.But, copied inputs can be shared by many gates.

A

B out

A’

B’

Page 7: Reversible Computing Theory I: Reversible Logic Models

SCRL Pipelined NANDSCRL Pipelined NAND

A

B

A

B

out = AB

Inverters only neededto restore A, B— Can be shared withother gates that takeA, B as inputs.

5T

• Including inverters: 23 transistors• Not including inverters: 7 transistors

Page 8: Reversible Computing Theory I: Reversible Logic Models

Non-Expanding GatesNon-Expanding Gates• Controlled-NOTControlled-NOT (CNOT) or (CNOT) or input-consuming XOR:input-consuming XOR:

AA BB AA’’ CC0 0 0 00 0 0 00 1 0 10 1 0 11 0 1 11 0 1 11 1 1 01 1 1 0

• Not universalNot universal for classical reversible computing. for classical reversible computing. (Even (Even together w. all other 1 & 2 output rev. gates.)together w. all other 1 & 2 output rev. gates.)

• However, if we add 1-input, 1-output However, if we add 1-input, 1-output quantumquantumgates, the resulting gate set is universal! gates, the resulting gate set is universal!

• More on quantum computing in a couple of weeks.More on quantum computing in a couple of weeks.

A A’

B C = AB

Can implement w. a diadic gate in SCRL

A A’

BC = AB

Page 9: Reversible Computing Theory I: Reversible Logic Models

• Subsumes AND, NAND, XOR, Subsumes AND, NAND, XOR, NOT, FAN-OUT, …NOT, FAN-OUT, …

• Note that this gate is its own inverse.Note that this gate is its own inverse.• Our first universal reversible gate!Our first universal reversible gate!

Toffoli Gate (CCNOT) Toffoli Gate (CCNOT) A B C A’ B’ C’0 0 0 0 0 00 0 1 0 0 10 1 0 0 1 00 1 1 0 1 11 0 0 1 0 01 0 1 1 0 11 1 0 1 1 01 1 1 1 1 1

(XOR)

AB

C

A’=AB’=B

C’ = CAB

A

B’B

C

A’

C’

Page 10: Reversible Computing Theory I: Reversible Logic Models

Fredkin GateFredkin Gate• The first universal reversible logic gate to be discovered. The first universal reversible logic gate to be discovered.

(Ed Fredkin, mid 70’s)(Ed Fredkin, mid 70’s)

• B and C are swapped ifB and C are swapped ifA=1, else passed unchanged.A=1, else passed unchanged.

• Is also Is also conservativeconservative, conserves , conserves 11s and s and 00s.s.– Thus in theory requires no separate power input, even if 1 and Thus in theory requires no separate power input, even if 1 and

0 have different energy levels!0 have different energy levels!

A B C A’ B’ C’0 0 0 0 0 00 0 1 0 0 10 1 0 0 1 00 1 1 0 1 11 0 0 1 0 01 0 1 1 0 11 1 0 1 1 01 1 1 1 1 1

A

B

C

A’

B’

C’

Page 11: Reversible Computing Theory I: Reversible Logic Models

Reversible Computing Theory II:Reversible Computing Theory II:Emulating Irreversible MachinesEmulating Irreversible Machines

Page 12: Reversible Computing Theory I: Reversible Logic Models

Motivation for this studyMotivation for this study• We want to know how to carry out any We want to know how to carry out any arbitraryarbitrary

computation in a way that is reversible to an computation in a way that is reversible to an arbitrarily high degreearbitrarily high degree..– Up to limits set by leakage, power supply, Up to limits set by leakage, power supply, etc.etc.

• We want to do this as We want to do this as efficientlyefficiently as possible: as possible:– Using as few “device ticks” as possible (spacetime)Using as few “device ticks” as possible (spacetime)

• Minimizes HW cost, & leakage lossesMinimizes HW cost, & leakage losses– Using as few adiabatic transitions as possible (ops)Using as few adiabatic transitions as possible (ops)

• Minimizes frictional lossesMinimizes frictional losses

• But, a desired computation may be originally But, a desired computation may be originally specified in terms of specified in terms of irreversibleirreversible primitives. primitives.

Page 13: Reversible Computing Theory I: Reversible Logic Models

General-Case vs. Special-CaseGeneral-Case vs. Special-Case• We’d like to know two kinds of things:We’d like to know two kinds of things:

– For arbitrary general-purpose computations,For arbitrary general-purpose computations,• How to How to automaticallyautomatically emulate them in a fairly efficient emulate them in a fairly efficient

reversible way, reversible way, – w/o needing new intelligent/creative design work in each case?w/o needing new intelligent/creative design work in each case?

• Topic of today’s lectureTopic of today’s lecture– For various specific computations of interest,For various specific computations of interest,

• What are the most efficient reversible algorithms?What are the most efficient reversible algorithms?– Or at least, the most efficient that we can find?Or at least, the most efficient that we can find?

• Note: These may not necessarily look anything like the Note: These may not necessarily look anything like the most efficient most efficient irreversibleirreversible algorithms! algorithms!

– More on this point laterMore on this point later

Page 14: Reversible Computing Theory I: Reversible Logic Models

The Landauer embeddingThe Landauer embedding• The obvious embedding of irreversible ops into The obvious embedding of irreversible ops into

“expanding” reversible ones leads to a linear “expanding” reversible ones leads to a linear increase in space through time. (Landauer ‘61)increase in space through time. (Landauer ‘61)– Or, increase in width of an input-consuming circuitOr, increase in width of an input-consuming circuit

“Garbage”bits

input

Circuit depth, or time

“Expanding”operations

(e.g., AND)

Desiredoutput

Page 15: Reversible Computing Theory I: Reversible Logic Models

Lecerf ReversalLecerf Reversal• Lecerf (‘63) was interested in the group-theory Lecerf (‘63) was interested in the group-theory

question of whether an iterated permutation of question of whether an iterated permutation of items would eventually return to initial item.items would eventually return to initial item.– Proved Proved undecidableundecidable by reducing Turing’s by reducing Turing’s halting halting

problemproblem to this question, w. a reversible TM. to this question, w. a reversible TM.• Reversible TM Reversible TM reverses directionreverses direction instead of halting. instead of halting.• Returns to initial state iff irreversible TM would halt.Returns to initial state iff irreversible TM would halt.

• Only problem with this:Only problem with this:No useful output data!No useful output data!

f f 1

Desiredoutput

Garbage

Input Copy ofInput

Page 16: Reversible Computing Theory I: Reversible Logic Models

The Bennett TrickThe Bennett Trick• Bennett (‘73) pointed out that you could simply Bennett (‘73) pointed out that you could simply

fan-out (reversibly copy) the desired output fan-out (reversibly copy) the desired output before reversing.before reversing.– Note: O(Note: O(TT)) storage is still storage is still temporarilytemporarily needed! needed!

f f 1

Garbage

Input Copy ofInput

Desired output

Page 17: Reversible Computing Theory I: Reversible Logic Models

Improving Spacetime EfficiencyImproving Spacetime Efficiency• Bennett ‘73 transforms a computation taking Bennett ‘73 transforms a computation taking

spacetime spacetime SS··TT to one taking to one taking ((SS··TT22) spacetime in the ) spacetime in the worst case. worst case. – Can we do better?Can we do better?

• Bennett ‘89: Described a technique that takes Bennett ‘89: Described a technique that takes spacetimespacetime– Actually, can generalize slightly and arrange for exponent Actually, can generalize slightly and arrange for exponent

on on TT to be 1+ to be 1+, where , where 0 (very slowly)0 (very slowly)

• Lange, McKenzie, Tapp ‘97: Space Lange, McKenzie, Tapp ‘97: Space ((SS) is even ) is even possible, if you use time possible, if you use time (exp((exp(((SS))))))– Not any more spacetime-efficient than Bennett.Not any more spacetime-efficient than Bennett.

)log()log( 59.13log2 TTSTTS

Page 18: Reversible Computing Theory I: Reversible Logic Models

Reversible “Climbing Game”Reversible “Climbing Game”• Suppose a guy armed with a hammer, Suppose a guy armed with a hammer,

NN spikes, & a rope is trying to climb a spikes, & a rope is trying to climb acliff, while obeying the following rules.cliff, while obeying the following rules.– Question: How high can he climb?Question: How high can he climb?

• Rules:Rules:– Standing on the ground or on a spike, he canStanding on the ground or on a spike, he can

insert & remove a spike 1 meter higher up.insert & remove a spike 1 meter higher up.– He can raise & lower himself betweenHe can raise & lower himself between

spikes & the ground using his rope.spikes & the ground using his rope.• He He can’tcan’t insert or remove a spike while insert or remove a spike while

dangling from a higher spike!dangling from a higher spike!– Maybe not enough leverage/stability?Maybe not enough leverage/stability?

Page 19: Reversible Computing Theory I: Reversible Logic Models

Analogy w. Emulation ProblemAnalogy w. Emulation Problem• Height on cliff represents:Height on cliff represents:

– How many steps of progress haveHow many steps of progress havewe made through the irreversiblewe made through the irreversiblecomputation?computation?

• Number of spikes represents:Number of spikes represents:– Available memory of reversible machine.Available memory of reversible machine.

• Spike in cliff at height Spike in cliff at height HH represents: represents:– Using a unit of memory to record the Using a unit of memory to record the

state of the irreversible machine after state of the irreversible machine after HH steps. steps.• Adding/removing a spike at height Adding/removing a spike at height HH+1+1

if there is a spike is at height if there is a spike is at height HH represents: represents:– Computing/uncomputing Computing/uncomputing

state at state at HH+1 steps given state at +1 steps given state at HH..

Page 20: Reversible Computing Theory I: Reversible Logic Models

1. Insert spike @ 1.

Let’s Climb!Let’s Climb!0. Standing on ground.

2. Insert spike @ 2.3. Remove spike @ 1.4. Insert spike @ 3.5. Insert spike @ 4.6. Remove spike @ 3.7. Insert spike @ 1.8. Remove spike @ 2.9. Remove spike @ 1.10. Can use remaining 3 spikes to climb up another 4 if desired!

Page 21: Reversible Computing Theory I: Reversible Logic Models

How high can we climb?How high can we climb?• Using only Using only NN spikes, and the strategy spikes, and the strategy

illustrated, we can climb to height 2illustrated, we can climb to height 2NN11 (wow!) (wow!)• Li & Vitanyi: (Theorem) Li & Vitanyi: (Theorem) This is the optimal This is the optimal

strategy for this game.strategy for this game.• Open question: Open question:

– Are there more efficient general reversiblization Are there more efficient general reversiblization techniques that are techniques that are notnot based on this game model? based on this game model?

Page 22: Reversible Computing Theory I: Reversible Logic Models

““Pebble Game” RepresentationPebble Game” Representation

Page 23: Reversible Computing Theory I: Reversible Logic Models

Triangle representationTriangle representation

k = 2n = 3

k = 3n = 2

Page 24: Reversible Computing Theory I: Reversible Logic Models

Analysis of Bennett AlgorithmAnalysis of Bennett Algorithm• nn = # of recursive levels of algorithm = # of recursive levels of algorithm• kk = # of lower-level iterations to go forward 1 higher- = # of lower-level iterations to go forward 1 higher-

level steplevel step• TTrr = # of reversible lowest-level steps executed = # of reversible lowest-level steps executed

= 2(2= 2(2kk1)1)nn

• TTii = # of irreversible steps emulated = # of irreversible steps emulated

= = kknn

• So, So, nn = log = logkk TTii, and so , and so

TTrr = 2(2 = 2(2kk1)1)log log TTi/log ki/log k = 2 = 2eelog(2log(2kk1)log(1)log(TTi)/log i)/log kk

= = 22TTiilog(2log(2k k 1)/log 1)/log kk

(n+1 spikes)

Page 25: Reversible Computing Theory I: Reversible Logic Models

Linear-Space EmulationLinear-Space Emulation(Lange, McKenzie, Tapp ‘97)

Unfortunately, the tree may have 2S nodes!

Page 26: Reversible Computing Theory I: Reversible Logic Models

Can we do better?Can we do better?• Bennett ‘73 takes order-Bennett ‘73 takes order-TT time, LMT ‘97 takes time, LMT ‘97 takes

order-order-SS space. space.– Can some technique achieve both, simultaneously?Can some technique achieve both, simultaneously?

• Theorem:Theorem: (Frank & Ammer ‘97) The problem (Frank & Ammer ‘97) The problem of iterating a black-box function of iterating a black-box function cannotcannot be be done in time done in time TT & space & space SS on a reversible on a reversible machine.machine.– Proof really does cover Proof really does cover allall possible algorithms! possible algorithms!– The paper also proves loose lower bounds on the The paper also proves loose lower bounds on the

extra space required by a linear-time simulation.extra space required by a linear-time simulation.• Results Results mightmight also be extended to the problem also be extended to the problem

of iterating a cryptographic of iterating a cryptographic one-wayone-way function. function.– It’s not yet clear if this can be made to work.It’s not yet clear if this can be made to work.

Page 27: Reversible Computing Theory I: Reversible Logic Models

One-Way FunctionsOne-Way Functions• ……are invertible functions are invertible functions ff such that such that ff is easy to is easy to

compute (compute (e.g.e.g., takes polynomial time) but , takes polynomial time) but f f 11 is is hard to compute (hard to compute (e.g.e.g., takes exponential time)., takes exponential time).

• A simple example:A simple example:– Consider: Consider: ff((pp,,qq) = ) = pq pq with with pp,,qq prime. prime.

• Multiplication of integers is easy.Multiplication of integers is easy.• Factoring is hard (except using quantum computers).Factoring is hard (except using quantum computers).

– The “one-way-ness” of this function is essential to The “one-way-ness” of this function is essential to the security of the RSA public-key cryptosystem.the security of the RSA public-key cryptosystem.

• No function has yet been No function has yet been provenproven to be one-way. to be one-way.– However, certain kinds of one-way functions are However, certain kinds of one-way functions are

known to exist if known to exist if PP NPNP..

Page 28: Reversible Computing Theory I: Reversible Logic Models

Elements of Frank-Ammer ProofElements of Frank-Ammer Proof• Consider a chain of bit-strings (size Consider a chain of bit-strings (size SS each) that each) that

is is incompressibleincompressible by a certain compressor. by a certain compressor.– This is easily proven to exist. (See next slide.)This is easily proven to exist. (See next slide.)

• Machine’s job is to follow this chain from one node to the Machine’s job is to follow this chain from one node to the next by using a black-box function.next by using a black-box function.

• The compressor can run a reversible machine The compressor can run a reversible machine backwards, to reconstruct earlier nodes in the backwards, to reconstruct earlier nodes in the chain from later machine configurations.chain from later machine configurations.– If the reversible machine only uses order-If the reversible machine only uses order-SS space in space in

its configurations, then the chain is compressible!its configurations, then the chain is compressible!• Contradicts choice of incompressible chain; QED.Contradicts choice of incompressible chain; QED.

Page 29: Reversible Computing Theory I: Reversible Logic Models

Existence of IncompressiblesExistence of Incompressibles• A A decompressordecompressor or or description systemdescription system ss:{:{00,,11}* }*

maps any bit-string maps any bit-string descriptiondescription dd to the to the described described string string xx..– Notation Notation ff::DD means a unary operator on means a unary operator on DD, , ff::DDDD

• xx is is compressiblecompressible is is ss iff iff dd: : ss((dd)=)=xx, |, |dd|<||<|xx||– Notation |Notation |bb| means the length of bit-string | means the length of bit-string bb in bits. in bits.

• Theorem:Theorem: EveryEvery decompressor has an decompressor has an incompressible input of any given length incompressible input of any given length ..– Proof:Proof: There are 2 There are 2 length- length- bit-strings, but only bit-strings, but only

shorter descriptions. shorter descriptions. ■ ■ 1221

0

i

i

Page 30: Reversible Computing Theory I: Reversible Logic Models

Cost-Efficiency AnalysisCost-Efficiency Analysis

Cost EfficiencyCost EfficiencyCost Measures in ComputingCost Measures in ComputingGeneralized Amdahl’s LawGeneralized Amdahl’s Law

Page 31: Reversible Computing Theory I: Reversible Logic Models

Cost-EfficiencyCost-Efficiency• Cost-efficiencyCost-efficiency of anything is of anything is %%$$ = = $$minmin//$$, ,

– The fraction of actual cost The fraction of actual cost $$ that really needed to be that really needed to be

spent to get the thing, using the best poss. method.spent to get the thing, using the best poss. method.– Measures the relative number of instances of the thing Measures the relative number of instances of the thing

that can be accomplished per unit cost,that can be accomplished per unit cost,• compared to the maximum number possiblecompared to the maximum number possible

– Inversely proportional to cost Inversely proportional to cost $$..– Maximizing Maximizing %%$$ means minimizing means minimizing $$..

• Regardless of what Regardless of what $$minmin actually is. actually is.

• In computing, the “thing” is a computational task In computing, the “thing” is a computational task that we wish to carry out.that we wish to carry out.

Page 32: Reversible Computing Theory I: Reversible Logic Models

Components of CostComponents of Cost• The cost The cost $$ of a computation may generally be a of a computation may generally be a

sum of terms for many different components:sum of terms for many different components:– Time-proportional (or related) costs:Time-proportional (or related) costs:

• Cost to user of having to wait for resultsCost to user of having to wait for results– E.g.E.g., missing deadlines, incurring penalties., missing deadlines, incurring penalties.– May increase May increase nonlinearlynonlinearly with time for long times. with time for long times.

– Spacetime-proportional (or related) costs:Spacetime-proportional (or related) costs:• Cost of raw physical spacetime occupied by computation.Cost of raw physical spacetime occupied by computation.

– Cost to rent the space.Cost to rent the space.• Cost of hardware (amortized over its lifetime)Cost of hardware (amortized over its lifetime)

– Cost of raw mass-energy, particles, atoms.Cost of raw mass-energy, particles, atoms.– Cost of materials, parts.Cost of materials, parts.– Cost of assembly.Cost of assembly.

• Cost of parts/labor for operation & maintenance.Cost of parts/labor for operation & maintenance.

• Cost of SW licenses

Page 33: Reversible Computing Theory I: Reversible Logic Models

More cost componentsMore cost components• Continued...Continued...

– Area-time proportional (or related) costs:Area-time proportional (or related) costs:• Cost to rent a portion of an enclosing convex hull for getting Cost to rent a portion of an enclosing convex hull for getting

things in & out of the systemthings in & out of the system– Energy, heat, information, people, materials, entropy.Energy, heat, information, people, materials, entropy.

• Some examples incurring area-time proportional costs:Some examples incurring area-time proportional costs:– Chip area, power level, cooling capacity, I/O bandwidth, desktop Chip area, power level, cooling capacity, I/O bandwidth, desktop

footprint, floor space, real estate, planetary surfacefootprint, floor space, real estate, planetary surface• Note that area-time costs also scale with the maximum Note that area-time costs also scale with the maximum

numbernumber of items that can be sent/received. of items that can be sent/received.– Energy expenditure proportional (or related) costs:Energy expenditure proportional (or related) costs:

• Cost of raw free energy expenditure (entropy generation).Cost of raw free energy expenditure (entropy generation).• Cost of energy-delivery system. (Amortized.)Cost of energy-delivery system. (Amortized.)• Cost of cooling system. (Amortized.)Cost of cooling system. (Amortized.)

Page 34: Reversible Computing Theory I: Reversible Logic Models

General Cost MeasuresGeneral Cost Measures• The most comprehensive cost measure includes terms for The most comprehensive cost measure includes terms for

allall of these potential kinds of costs. of these potential kinds of costs.$$comprehensivecomprehensive = = $$TimeTime + + $$SpaceTimeSpaceTime + + $$AreaTimeAreaTime + + $$FreeEnergyFreeEnergy

• $$TimeTime is an non-decreasing function is an non-decreasing function ff((ttstartstartendend))– Simple model: Simple model: $$TimeTime ttstartstartendend

• $$FreeEnergyFreeEnergy is most generally is most generally– Simple model: Simple model: $$FreeEnergyFreeEnergy SSgeneratedgenerated

• $$SpaceTimeSpaceTime and and $$AreaTimeAreaTime are most generally: are most generally:– Simple model: Simple model:

• $$SpaceTimeSpaceTime SpaceSpace TimeTime• $$AreaTime AreaTime AreaArea TimeTime

tttS S

t

t

FreeEnergy d)($)($end

start

tt$

tt$

t

t

t

t

d)($

d)($

end

start

end

start

AreaAreaTime

SpaceSpaceTime

Max # ops thatcould be done

Max # items thatcould be I/O’d

Page 35: Reversible Computing Theory I: Reversible Logic Models

Generalized Amdahl’s LawGeneralized Amdahl’s Law• Given any cost that is a sum of components,Given any cost that is a sum of components,

$$tottot = = $$11 + … + + … + $$nn,,– There are diminishing proportional returns to be There are diminishing proportional returns to be

gained from reducing any single cost component (or gained from reducing any single cost component (or subset of components) to much less than the sum of subset of components) to much less than the sum of the remaining components.the remaining components.

• ∴ ∴ Design-optimization effort should concentrate Design-optimization effort should concentrate on those cost components that dominate total on those cost components that dominate total cost for the application of interest.cost for the application of interest.– At a “design equilibrium,” all cost components will At a “design equilibrium,” all cost components will

be be roughlyroughly equal (unless externally driven) equal (unless externally driven)

Page 36: Reversible Computing Theory I: Reversible Logic Models

Reversible Reversible vs.vs. Irreversible Irreversible• Want to compare their cost-efficiency under Want to compare their cost-efficiency under

various cost measures:various cost measures:– TimeTime– EntropyEntropy– Area-timeArea-time– SpacetimeSpacetime

• Note that Note that spacespace (volume, mass, (volume, mass, etc.etc.) by itself as ) by itself as a cost measure is only significant if either:a cost measure is only significant if either:– (a) The computer isn’t reusable, & so the cost to (a) The computer isn’t reusable, & so the cost to

build it dominates operating costs, orbuild it dominates operating costs, or– (b) I/O latency (b) I/O latency VV1/31/3 affects other costs. affects other costs.

Or, for some applications,one quantity might be minimized

while another one (space, time, area)is constrained by some hard limit.

Page 37: Reversible Computing Theory I: Reversible Logic Models

Time Cost ComparisonTime Cost Comparison• For computations with For computations with unlimitedunlimited power/cooling power/cooling

capacity, and capacity, and no no communication requirements: communication requirements: – Reversible is worse than irreversible by a factor of Reversible is worse than irreversible by a factor of

~~s>s>11 (adiabatic slowdown factor), times maybe a (adiabatic slowdown factor), times maybe a small constant depending on the logic style used.small constant depending on the logic style used.

$$r,Timer,Time $$i,Timei,Time · · ss

Page 38: Reversible Computing Theory I: Reversible Logic Models

Time Cost Comparison, cont.Time Cost Comparison, cont.• For parallelizable, power-limited applications:For parallelizable, power-limited applications:

– With nonzero leakage:With nonzero leakage: $$r,Timer,Time $$i,Timei,Time / / RRon/offon/off

gg

• Worst-case computations: Worst-case computations: gg 0.4 0.4• Best-case computations: Best-case computations: gg = 0.5. = 0.5.

• For parallelizable, area-limited, entropy-flux-For parallelizable, area-limited, entropy-flux-limited, best-case applications:limited, best-case applications:– with leakage with leakage 0: 0:

$$r,Timer,Time $$i,Timei,Time / / d d 1/21/2

– where where dd is system’s physical is system’s physical diameter.diameter.• (see transparency)(see transparency)

Page 39: Reversible Computing Theory I: Reversible Logic Models

Time cost comparison, cont.Time cost comparison, cont.• For entropy-flux limited, parallel, heavily For entropy-flux limited, parallel, heavily

communication-limited, best case applications:communication-limited, best case applications:– with leakage approaching 0:with leakage approaching 0:

$$r,Timer,Time $$i,Timei,Time3/43/4

– where where $$i,Timei,Time scales up with the space requirement scales up with the space requirement V V

as as $$i,Time i,Time VV2/92/9

– so the reversible speedup scales with the 1/18 so the reversible speedup scales with the 1/18 power of system size.power of system size.

• not super-impressive!not super-impressive!

(details later)

Page 40: Reversible Computing Theory I: Reversible Logic Models

Bennett 89Bennett 89 alg. is alg. is notnot optimal optimal

k = 2n = 3

k = 3n = 2

Just look at all the spacetime it wastes!!!

Page 41: Reversible Computing Theory I: Reversible Logic Models

Parallel “Parallel “Frank02”Frank02” algorithm algorithm• We can simply scrunch the triangles closer We can simply scrunch the triangles closer

together to eliminate the wasted spacetime!together to eliminate the wasted spacetime!• Resulting algorithm is Resulting algorithm is linear timelinear time for all for all nn and and

kk and dominates and dominates Ben89Ben89 for time, spacetime, & for time, spacetime, & energy!energy!

Real time

Em

ulat

ed ti

me k=2

n=3k=3n=2

k=4n=1

Page 42: Reversible Computing Theory I: Reversible Logic Models

Setup for AnalysisSetup for Analysis• For energy-dominated limit, For energy-dominated limit,

– let cost “let cost “$$” equal energy.” equal energy.• cc$$ = energy coefficient, = energy coefficient, rr$$ = = rr$(min)$(min) = leakage power = leakage power• $$ii = energy dissipation per irreversible state-change = energy dissipation per irreversible state-change

• Let the on/off ratio Let the on/off ratio RRon/offon/off = = rr$(max)$(max)//rr$(min)$(min) = = PPmaxmax//PPminmin..

• Note thatNote thatcc$$ $$ii··ttminmin = = $$i i ·(·($$i i / / rr$(max)$(max))), so, so

rr$(max) $(max) $$ii22//cc$$

• SoSoRRon/offon/off $$ii

22 / / cc$$rr$(min)$(min) = = $$ii22 / / cc$$rr$$

Page 43: Reversible Computing Theory I: Reversible Logic Models

Time TakenTime Taken• There are There are nn levels of recursion. levels of recursion.• Each multiplies the width of the base of the Each multiplies the width of the base of the

triangle by triangle by kk..• Lowest-level triangles take time Lowest-level triangles take time c·tc·topop..

• Total time is thus Total time is thus c·tc·topop·k·knn..

k=4n=1

Width 4 sub-units

Page 44: Reversible Computing Theory I: Reversible Logic Models

Number of Adiabatic OpsNumber of Adiabatic Ops• Each triangle contains Each triangle contains kk + ( + (kk 1) = 2 1) = 2k k 1 1

immediate sub-triangles.immediate sub-triangles.• There are There are nn levels of recursion. levels of recursion.• Thus number of adiabatic ops is Thus number of adiabatic ops is cc·(2·(2k k 1) 1)nn

k=3n=2

52 = 25little triangles

(adiabaticoperations)

Page 45: Reversible Computing Theory I: Reversible Logic Models

Spacetime UsageSpacetime Usage• Each triangle includes the spacetime usage of Each triangle includes the spacetime usage of

all all k k 1 of its subtriangles, 1 of its subtriangles,• Plus,Plus,

additional spacetime units, each consisting of additional spacetime units, each consisting of 1 storage unit, for time 1 storage unit, for time ttopop·k·knn11 k=5

n=1

2

23

2

)1)(2( 22

1

kkkki

k

i

Time top kn-1

1 state of irrev. mach. Being stored123

1+2+3 unitsResulting recurrence relation:ST(k,0) = 1 (or c)ST(k,n) = (2k1)·ST(k,n1) + (k23k+2)·kn1/2

Page 46: Reversible Computing Theory I: Reversible Logic Models

Reversible CostReversible Cost• Adiabatic cost plus spacetime cost:Adiabatic cost plus spacetime cost:

$$rr = = $$aa + + $$rr = (2 = (2kk-1)-1)nn··cc$$//tt + + STST((kk,,nn)·)·rr$$tt

• Minimizing over Minimizing over tt gives: gives:$$rr = 2[(2 = 2[(2kk-1)-1)n n ·· STST((kk,,nn) ·) ·cc$ $ rr$$]]1/21/2

• But, in energy-dominated limit, But, in energy-dominated limit, cc$ $ rr$$ $$ii

22 / / RRon/offon/off,,

• So:So:$$rr = 2 = 2$$i i ·[(2·[(2kk-1)-1)n n ·· STST((kk,,nn) / ) / RRon/offon/off]]1/21/2

Page 47: Reversible Computing Theory I: Reversible Logic Models

Tot. Cost, Orig. Cost, AdvantageTot. Cost, Orig. Cost, Advantage• Total cost Total cost $$ii for irreversible operation for irreversible operation

performed at end of algorithm, plus reversible performed at end of algorithm, plus reversible cost, gives:cost, gives:

$$tottot = = $$i i ·· {1 + 2[(2{1 + 2[(2kk-1)-1)n n ·· STST((kk,,nn) / ) / RRon/offon/off]]1/21/2}}

• Original irreversible machine performing Original irreversible machine performing kknn ops ops would use cost would use cost $$origorig = = $$ii··kknn, so,, so,

• Advantage ratioAdvantage ratio between reversible & between reversible & irreversible cost, irreversible cost,

on/off

tot

orig)i/r$(

),()12(21

),(

RnkSTk

k

$

$nkR

n

n

Page 48: Reversible Computing Theory I: Reversible Logic Models

Optimization AlgorithmOptimization Algorithm• For any given value on For any given value on RRon/offon/off,,

• Scan the possible values of Scan the possible values of nn (up to some (up to some limit),limit),

• For each of those, scan the possible values of For each of those, scan the possible values of kk,,• Until the maximum Until the maximum RR$(i/r)$(i/r) for that for that nn is found is found

– (the function only has a single local maximum)(the function only has a single local maximum)

• And return the max And return the max RR$(i/r)$(i/r) over all over all nn tried. tried.

Page 49: Reversible Computing Theory I: Reversible Logic Models

Cost-Efficiency Gains, Modified Ben89

y = 0.3905x0.3896

y = 1.741x0.6198

0.1

1

10

100

1000

10000

100000

1000000

10000000

100000000

1 100 10000 1000000 100000000

1E+10 1E+12

On/Off Ratio of Individual Devices

Ad

va

nta

ge

in A

rbit

rary

Co

mp

uta

tio

n

0

10

20

30

40

50

60

70

out

hw

n

kSpacetime blowup

Energy saved

kn

Page 50: Reversible Computing Theory I: Reversible Logic Models

Asymptotic ScalingAsymptotic Scaling• The potential energy savings factor scales as The potential energy savings factor scales as RR$$

(i/r)(i/r) R Ron/offon/off~0.4~0.4, ,

• while the spacetime overhead goes only as while the spacetime overhead goes only as RR$(i/r)$(i/r) RR$(i/r)$(i/r)

~0.45~0.45, or , or RRon/offon/off~0.18~0.18..

• E.g., E.g., with an with an RRon/offon/off of 10 of 1099, you can do , you can do worst-worst-

case case computation in an adiabatic circuit with:computation in an adiabatic circuit with:– An energy savings of up to a factor of 1,200× !An energy savings of up to a factor of 1,200× !– But, this point is 700,000× less hardware-efficient, But, this point is 700,000× less hardware-efficient,

if Frank02 algorithm is used for the emulation.if Frank02 algorithm is used for the emulation.

Page 51: Reversible Computing Theory I: Reversible Logic Models

Various Cost MeasuresVarious Cost Measures• Entropy - advantage as per previous analysisEntropy - advantage as per previous analysis• Area times time - scales w. entropy generatedArea times time - scales w. entropy generated• Performance, given area constraint -Performance, given area constraint -

– In leakage-free limit, advantage proportional to In leakage-free limit, advantage proportional to dd1/21/2

– With leakage, what’s the max advantage? (See hw)With leakage, what’s the max advantage? (See hw)

• NOW:NOW:– Are there any performance/cost advantages from Are there any performance/cost advantages from

adiabatics adiabatics eveneven when there is no cost or constraint when there is no cost or constraint for entropy or for area?for entropy or for area?

– YES, for flux-limited computations that require YES, for flux-limited computations that require communications. Let’s see why…communications. Let’s see why…

Page 52: Reversible Computing Theory I: Reversible Logic Models

Perf. scaling w. # of devicesPerf. scaling w. # of devices• If alg. is If alg. is not not limited by communications needs,limited by communications needs,

– Use irreversible processors spread in a 2-D layer.Use irreversible processors spread in a 2-D layer.– Remove entropy along perpendicular dimension.Remove entropy along perpendicular dimension.– No entropy removal rate limits,No entropy removal rate limits,

• so no speed advantage from reversibility.so no speed advantage from reversibility.

• If alg. requires only If alg. requires only locallocal communication, communication,latency latency cyc. time, in an cyc. time, in an NNDD××NNDD××NNDD mesh, mesh,– Leak-free reversible machine perf. scales better!Leak-free reversible machine perf. scales better!– Irreversible Irreversible ttcyccyc = = ((NNDD

1/31/3))– Reversible Reversible ttcyccyc = = ((NNDD

1/41/4))… … ((NNDD1/121/12) ×) × faster! faster!

• To boost reversibility speedup by 10×, one must consider To boost reversibility speedup by 10×, one must consider ~10~103636-CPU machines (1.7 trillion moles of CPUs!)-CPU machines (1.7 trillion moles of CPUs!)

– 1.7 trillion moles of H atoms weighs 1.7 million metric tons!1.7 trillion moles of H atoms weighs 1.7 million metric tons!» A ~100-m tall hill of H-atom sized CPUs!A ~100-m tall hill of H-atom sized CPUs!

Page 53: Reversible Computing Theory I: Reversible Logic Models

Lower bound on irreversible timeLower bound on irreversible time• Simulate Simulate NNprocproc = = NNDD

33 cells for cells for NNstepssteps » » NNDD steps. steps.

• Consider a sequence of Consider a sequence of NNDD update steps. update steps.

• Final cell value depends on Final cell value depends on NNDD44 ops in time ops in time TT..

• All ops must occur within radius All ops must occur within radius rr = = cTcT of cell.of cell.• Surface area Surface area AA TT22, rate , rate RRopop TT22 sustainable. sustainable.

• NNopsops RRop op T T TT33 needs to be at least needs to be at least NNDD44..

TT must be must be ((NNDD4/34/3)) to do all to do all NNDD steps. steps.

• Average time per step must be Average time per step must be ((NNDD1/31/3))..

• AnyAny irreversible machine (of irreversible machine (of anyany technology or technology or architecture) must obey this bound!architecture) must obey this bound!

Page 54: Reversible Computing Theory I: Reversible Logic Models

Irreversible 3-D MeshIrreversible 3-D Mesh

Page 55: Reversible Computing Theory I: Reversible Logic Models

Reversible 3-D MeshReversible 3-D Mesh

Page 56: Reversible Computing Theory I: Reversible Logic Models

Non-local CommunicationNon-local Communication• Best computational task for reversibility:Best computational task for reversibility:

– Each processor must exchange messages with Each processor must exchange messages with another that is another that is NNDD

1/21/2 nodes away on each cycle nodes away on each cycle• Unsure what real-world problem demands this pattern!Unsure what real-world problem demands this pattern!

– In this case, reversible speedup scales with number of In this case, reversible speedup scales with number of CPUs to “only” the 1/18CPUs to “only” the 1/18thth power. power.

• To boost reversibility speedup by 10×, “only” need 10To boost reversibility speedup by 10×, “only” need 101818 (or (or 1.7 micromoles) of CPUs1.7 micromoles) of CPUs

• If each was a 1-nm cluster of 100 C atoms, this is only 2 If each was a 1-nm cluster of 100 C atoms, this is only 2 mg mass, volume 1 mmmg mass, volume 1 mm33..

• Current VLSI: Current VLSI: Need cost level of ~$25B before you see a speedup.Need cost level of ~$25B before you see a speedup.

Page 57: Reversible Computing Theory I: Reversible Logic Models

Ballistic MachinesBallistic Machines• In the limit if In the limit if ccSS 0 0, the asymptotic benefit for , the asymptotic benefit for

3-D meshes goes as 3-D meshes goes as NNDD1/31/3 or or NNprocproc

1/91/9..– Only need a billion devices to multiply reversible Only need a billion devices to multiply reversible

speedup by 10×.speedup by 10×.• With 1 nmWith 1 nm33 devices, a cube 1 devices, a cube 1 m on a side (bacteria size) m on a side (bacteria size)

would do it!would do it!

• Does Drexler’s rod logic have low enough Does Drexler’s rod logic have low enough ccSS

and small enough size to attain this and small enough size to attain this prediction…?prediction…?– (Need to check.)(Need to check.)

Page 58: Reversible Computing Theory I: Reversible Logic Models

Minimizing volume via foldingMinimizing volume via folding• Allows previousAllows previous

solutions to besolutions to bepacked in min.packed in min.volume.volume.

• Volume scalesVolume scalesproportionallyproportionallyto mass.to mass.

• No change inNo change inspeed or speed or entropy flux.entropy flux.

Page 59: Reversible Computing Theory I: Reversible Logic Models

Cooling TechnologiesCooling Technologies

Page 60: Reversible Computing Theory I: Reversible Logic Models

Irreversible Max Perf. Per AreaIrreversible Max Perf. Per Area

Page 61: Reversible Computing Theory I: Reversible Logic Models

Reversible Entropy Coeffs.Reversible Entropy Coeffs.

Page 62: Reversible Computing Theory I: Reversible Logic Models

Rev. vs. Irrev. ComparisonsRev. vs. Irrev. Comparisons

Page 63: Reversible Computing Theory I: Reversible Logic Models

Sizes of Winning Rev. MachinesSizes of Winning Rev. Machines

Page 64: Reversible Computing Theory I: Reversible Logic Models

Some Analytical ChallengesSome Analytical Challenges• Combine Frank ‘02 emulation algorithm,Combine Frank ‘02 emulation algorithm,• Analysis of its energy and space efficiency as a Analysis of its energy and space efficiency as a

function of function of nn and and kk,,• And plug it into the analysis for the 3-D And plug it into the analysis for the 3-D

meshes, to see…meshes, to see…• What are the optimal speedups for arbitrary What are the optimal speedups for arbitrary

mesh computations on rev. machines, as a mesh computations on rev. machines, as a function of:function of:– RRon/offon/off, device volume, entropy flux limit, machine , device volume, entropy flux limit, machine

size.size.– And, does perf./hw improve, and if so, how much?And, does perf./hw improve, and if so, how much?

Page 65: Reversible Computing Theory I: Reversible Logic Models

Reversible Processor Reversible Processor ArchitectureArchitecture

Page 66: Reversible Computing Theory I: Reversible Logic Models

Why reversible architectures?Why reversible architectures?• What about automatic emulation algorithms?What about automatic emulation algorithms?

– E.g.: Ben73, Ben89, LMT, Frank02.E.g.: Ben73, Ben89, LMT, Frank02.• Transform an irreversible alg. to an equiv. rev’ble one.Transform an irreversible alg. to an equiv. rev’ble one.

– But, these do not yield the most cost-efficient reversible But, these do not yield the most cost-efficient reversible algorithms for all problems!algorithms for all problems!

• E.g.E.g., log(, log(RRE(i./r)E(i./r)//RRon/offon/off) may be only 0.4 rather than 0.5.) may be only 0.4 rather than 0.5.• Finding the best reversible algorithm requires a creative Finding the best reversible algorithm requires a creative

algorithm discovery process!algorithm discovery process!

• An optimally cost-efficient general-purpose An optimally cost-efficient general-purpose architecture must allow the architecture must allow the programmerprogrammer to specify a to specify a custom reversible algorithm that is specific to his custom reversible algorithm that is specific to his problem.problem.

Page 67: Reversible Computing Theory I: Reversible Logic Models

Reversibility Affects All LevelsReversibility Affects All Levels• As As RRon/offon/off increases & cost of device manuf. declines increases & cost of device manuf. declines

(while the cost of energy stays high),(while the cost of energy stays high),– Maximizing overall cost-efficiency requires an Maximizing overall cost-efficiency requires an increasingly increasingly

largelarge fraction of all bit-ops be done adiabatically. fraction of all bit-ops be done adiabatically.

• Maximizing the efficiency of the resulting algorithms, Maximizing the efficiency of the resulting algorithms, in turn, requires reversibility in:in turn, requires reversibility in:– Logic designLogic design– Functional unitsFunctional units– Instruction set architecturesInstruction set architectures– Programming languagesProgramming languages– High-level algorithmsHigh-level algorithms

Increasing requirementfor degree of reversibility

Pro-gram-mingmodel

(unless a perfect emulator is found)

Page 68: Reversible Computing Theory I: Reversible Logic Models

All Known Reversible ArchitecturesAll Known Reversible Architectures• Ed BartonEd Barton (MIT class project, 1978) (MIT class project, 1978)

– Conservative logic, w. garbage stackConservative logic, w. garbage stack• Andrew ResslerAndrew Ressler (MIT bachelor’s thesis, 1979; MIT master’s thesis, 1981) (MIT bachelor’s thesis, 1979; MIT master’s thesis, 1981)

– Like Barton’s, but more detailed. Paired branches.Like Barton’s, but more detailed. Paired branches.• Henry BakerHenry Baker (1992) (1992)

– Reversible pointer automaton machine instructions.Reversible pointer automaton machine instructions.• J. Storrs “JoSH” HallJ. Storrs “JoSH” Hall (1994) (1994)

– Retractile-cascade-based PDP-10-like architecture.Retractile-cascade-based PDP-10-like architecture.• Carlin VieriCarlin Vieri (MIT master’s thesis, 1995) (MIT master’s thesis, 1995)

– Early Pendulum ISA, irrev. impl., full VHDL detail.Early Pendulum ISA, irrev. impl., full VHDL detail.• Frank & RixnerFrank & Rixner (MIT class project, 1996) (MIT class project, 1996)

– Tick: VLSI schematics & layout of Pendulum subset, w. paired branchesTick: VLSI schematics & layout of Pendulum subset, w. paired branches• Frank & LoveFrank & Love (MIT class project, 1996) (MIT class project, 1996)

– FlatTop: Adiabatic VLSI impl. of programmable reversible gate arrayFlatTop: Adiabatic VLSI impl. of programmable reversible gate array• VieriVieri (MIT Ph.D. thesis, 1999) (MIT Ph.D. thesis, 1999)

– Fully adiabatic VLSI implementation of Pendulum w. paired branchesFully adiabatic VLSI implementation of Pendulum w. paired branches

Page 69: Reversible Computing Theory I: Reversible Logic Models

Reversible Programmable Gate-Reversible Programmable Gate-Array ArchitecturesArray Architectures

Page 70: Reversible Computing Theory I: Reversible Logic Models

(as of May ‘99)

Page 71: Reversible Computing Theory I: Reversible Logic Models

Photo of packaged FlatTop chipPhoto of packaged FlatTop chip

Page 72: Reversible Computing Theory I: Reversible Logic Models
Page 73: Reversible Computing Theory I: Reversible Logic Models
Page 74: Reversible Computing Theory I: Reversible Logic Models

A Bouncing BBMCA “Ball”A Bouncing BBMCA “Ball”

Page 75: Reversible Computing Theory I: Reversible Logic Models

A BBMCA Fredkin GateA BBMCA Fredkin Gate

Page 76: Reversible Computing Theory I: Reversible Logic Models
Page 77: Reversible Computing Theory I: Reversible Logic Models
Page 78: Reversible Computing Theory I: Reversible Logic Models
Page 79: Reversible Computing Theory I: Reversible Logic Models
Page 80: Reversible Computing Theory I: Reversible Logic Models
Page 81: Reversible Computing Theory I: Reversible Logic Models
Page 82: Reversible Computing Theory I: Reversible Logic Models
Page 83: Reversible Computing Theory I: Reversible Logic Models
Page 84: Reversible Computing Theory I: Reversible Logic Models
Page 85: Reversible Computing Theory I: Reversible Logic Models
Page 86: Reversible Computing Theory I: Reversible Logic Models

Reversible von Neumann Reversible von Neumann ArchitecturesArchitectures

Page 87: Reversible Computing Theory I: Reversible Logic Models

Reversible Architecture IssuesReversible Architecture Issues• Instruction-Set Architecture (ISA) Issues:Instruction-Set Architecture (ISA) Issues:

– How to define irrev. ops (AND, etc.) reversibly?How to define irrev. ops (AND, etc.) reversibly?– How to do jumps/branches reversibly?How to do jumps/branches reversibly?– What kind of memory interface to have?What kind of memory interface to have?– What about I/O?What about I/O?– How to permit How to permit efficientefficient reversible algorithms? reversible algorithms?– Should the hardware guarantee reversibility?Should the hardware guarantee reversibility?

• Microarchitectural issues:Microarchitectural issues:– Register file interfaceRegister file interface– Reversible ALU operationsReversible ALU operations– Shared busesShared buses– Program counter controlProgram counter control

Page 88: Reversible Computing Theory I: Reversible Logic Models

The Trivial CasesThe Trivial Cases• Many typical instructions Many typical instructions alreadyalready reversible: reversible:

– NOT NOT aa• Set register Set register aa to its bitwise logical complement, to its bitwise logical complement, a a := ~:= ~aa

– NEG NEG aa• Set Set aa to its two’s complement negation to its two’s complement negation

aa := - := -a or a a or a := ~:= ~a + a + 11

– INC INC aa• Increment Increment aa by 1 (modulo 2 by 1 (modulo 2).).

– ADD ADD aa bb• Add register Add register bb into register into register aa ( (aa := ( := (aa + + bb) mod 2) mod 2))

– XOR XOR aa bb• Exclusive-or Exclusive-or bb into into aa ( (aa := := aa bb))

– ROL ROL aa bb• Rotate bits in register Rotate bits in register aa left by # positions given by left by # positions given by bb..

Page 89: Reversible Computing Theory I: Reversible Logic Models

The Nontrivial CasesThe Nontrivial Cases• Other common instructions are not reversible…Other common instructions are not reversible…

– CLR CLR aa• Clear register Clear register aa to 0. to 0.

– LD LD aa bb• Load register Load register aa from addr. pointed to by from addr. pointed to by bb..

– LDI LDI aa 3 3• Load immediate value 3 into register Load immediate value 3 into register aa..

– AND AND aa bb• Set Set aa to the bitwise AND of to the bitwise AND of a a and and bb

– JMP JMP aa• Jump to the instruction pointed to by Jump to the instruction pointed to by aa..

– SLL SLL aa bb• Shift the bits in Shift the bits in aa left by left by bb bits, filling with 0’s on right. bits, filling with 0’s on right.

Page 90: Reversible Computing Theory I: Reversible Logic Models

Irreversible Data OperationsIrreversible Data Operations• How to do expanding ops reversibly?How to do expanding ops reversibly?

– E.g.E.g., AND , AND aa bb - Prior value of - Prior value of aa is lost. is lost.

• Approach #1: “Garbage Stack” approach.Approach #1: “Garbage Stack” approach.– Based on Landauer’s embedding.Based on Landauer’s embedding.– Push all data that would otherwise be destroyed onto a Push all data that would otherwise be destroyed onto a

special “garbage” stack hidden from pgmr.special “garbage” stack hidden from pgmr.– Can unwind computation when finished to recover stack Can unwind computation when finished to recover stack

space. (Lecerf ‘63/Bennett ‘73 approach)space. (Lecerf ‘63/Bennett ‘73 approach)

• Problems: Large garbage stack memory needed.Problems: Large garbage stack memory needed.– Limits computation length.Limits computation length.– Leaves programmer no opportunity to choose a more Leaves programmer no opportunity to choose a more

efficient reversible algorithm!efficient reversible algorithm!

Page 91: Reversible Computing Theory I: Reversible Logic Models

Illustrating Garbage StackIllustrating Garbage Stack• Let “Let “” mean reversible move, “” mean reversible move, “” mean ” mean

reversible copy, “reversible copy, “” a reversible uncopy.” a reversible uncopy.

AND a b implemented by...

1. t a2. a t & b3. t GSM[GSP++]

230

46

17

0

0...Garbage Stack

Memory (GSM)

Garbage StackPointer (GSP)

0

1

2

3

4

3

Page 92: Reversible Computing Theory I: Reversible Logic Models

Programmer-Controlled GarbageProgrammer-Controlled Garbage• Put extra data in a programmer-manipulable location.Put extra data in a programmer-manipulable location.

– What if destination location isn’t empty?What if destination location isn’t empty?• Signal an error, orSignal an error, or• Use an op that does something reversible anywayUse an op that does something reversible anyway

• Provide Provide undoundo operations to accomplish operations to accomplish “unexpanding” inverses of expanding ops.“unexpanding” inverses of expanding ops.

• 1st method: Errors on non-empty destination:1st method: Errors on non-empty destination:– AND AND A B CA B C -If ( -If (AA=0)=0) A ABB&&CC else else errorerror– UNAND UNAND AA BB CC -If ( -If (AA==BB&&CC)) A ABB&&CC else else errorerror

• 2nd method: Use always-reversible store ops.2nd method: Use always-reversible store ops.– ANDX ANDX A B CA B C - - AA AA ( (BB & & CC) (self-undoing!)) (self-undoing!)

Page 93: Reversible Computing Theory I: Reversible Logic Models
Page 94: Reversible Computing Theory I: Reversible Logic Models

Pendulum - packaged die photoPendulum - packaged die photo

Page 95: Reversible Computing Theory I: Reversible Logic Models
Page 96: Reversible Computing Theory I: Reversible Logic Models
Page 97: Reversible Computing Theory I: Reversible Logic Models
Page 98: Reversible Computing Theory I: Reversible Logic Models
Page 99: Reversible Computing Theory I: Reversible Logic Models
Page 100: Reversible Computing Theory I: Reversible Logic Models
Page 101: Reversible Computing Theory I: Reversible Logic Models