-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DD synthesis of irreversible functions (Encoded to reversible without…
… additional line) (#115) ## Description This PR addresses the dd synthesis of irreversible functions which are encoded to reversible without any need of an additional line. For the synthesis, don't care conditions must be taken into consideration. This PR introduces the DC node condition based on which the synthesis can be carried forward. Appropriate tests and benchmarks are included as well. ## Checklist: <!--- This checklist serves as a reminder of a couple of things that ensure your pull request will be merged swiftly. --> - [x] The pull request only contains commits that are related to it. - [x] I have added appropriate tests and documentation. - [x] I have made sure that all CI jobs on GitHub pass. - [x] The pull request introduces no new warnings and follows the project's style guidelines.
- Loading branch information
Showing
18 changed files
with
306 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#pragma once | ||
|
||
#include "QuantumComputation.hpp" | ||
#include "core/truthTable/truth_table.hpp" | ||
|
||
namespace syrec { | ||
|
||
auto buildTruthTable(const qc::QuantumComputation& qc, TruthTable& tt) -> void; | ||
|
||
} // namespace syrec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#include "algorithms/simulation/circuit_to_truthtable.hpp" | ||
|
||
#include "dd/Simulation.hpp" | ||
|
||
namespace syrec { | ||
|
||
auto buildTruthTable(const qc::QuantumComputation& qc, TruthTable& tt) -> void { | ||
const auto nBits = qc.getNqubits(); | ||
assert(nBits < 65U); | ||
|
||
auto dd = std::make_unique<dd::Package<>>(nBits); | ||
|
||
const auto totalInputs = 1U << nBits; | ||
|
||
std::uint64_t n = 0U; | ||
|
||
while (n < totalInputs) { | ||
const auto inCube = TruthTable::Cube::fromInteger(n, nBits); | ||
|
||
auto const inEdge = dd->makeBasisState(nBits, inCube.toBoolVec()); | ||
const auto out = dd::simulate(&qc, inEdge, dd, 1); | ||
const auto outString = out.begin()->first; | ||
|
||
tt.try_emplace(inCube, TruthTable::Cube::fromString(outString)); | ||
++n; | ||
} | ||
} | ||
|
||
} // namespace syrec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,5 +59,4 @@ namespace syrec { | |
t.stop(); | ||
} | ||
} | ||
|
||
} // namespace syrec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.i 3 | ||
.o 3 | ||
00- 0-- | ||
01- 10- | ||
100 111 | ||
101 0-- | ||
110 0-- | ||
111 110 | ||
.e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.i 3 | ||
.o 3 | ||
000 0-- | ||
001 10- | ||
010 0-- | ||
011 110 | ||
100 10- | ||
101 111 | ||
110 0-- | ||
111 0-- | ||
.e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.i 2 | ||
.o 2 | ||
0- 1- | ||
1- 0- | ||
.e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.i 4 | ||
.o 4 | ||
00-- 11-- | ||
01-- 10-- | ||
10-- 01-- | ||
11-- 00-- | ||
.e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Function: sym6_32 | ||
# This file has been taken from RevLib (www.revlib.org). | ||
.i 6 | ||
.o 1 | ||
000011 1 | ||
000101 1 | ||
000110 1 | ||
000111 1 | ||
001001 1 | ||
001010 1 | ||
001011 1 | ||
001100 1 | ||
001101 1 | ||
001110 1 | ||
001111 1 | ||
010001 1 | ||
010010 1 | ||
010011 1 | ||
010100 1 | ||
010101 1 | ||
010110 1 | ||
010111 1 | ||
011000 1 | ||
011001 1 | ||
011010 1 | ||
011011 1 | ||
011100 1 | ||
011101 1 | ||
011110 1 | ||
100001 1 | ||
100010 1 | ||
100011 1 | ||
100100 1 | ||
100101 1 | ||
100110 1 | ||
100111 1 |
Oops, something went wrong.