Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decoding the irreversible function. #120

Merged
merged 7 commits into from
Dec 6, 2022
Merged

Conversation

SmaranTum
Copy link
Contributor

@SmaranTum SmaranTum commented Dec 4, 2022

Description

In this PR, the decoder functionality is included. With the help of this decoder, the irreversible function which was in an encoded form is obtained back. The signatures of certain functions are changed accordingly. Minor changes have been made to the tests.

Checklist:

  • The pull request only contains commits that are related to it.
  • I have added appropriate tests and documentation.
  • I have made sure that all CI jobs on GitHub pass.
  • The pull request introduces no new warnings and follows the project's style guidelines.

@codecov
Copy link

codecov bot commented Dec 4, 2022

Codecov Report

Merging #120 (5629005) into main (8cc2c3a) will increase coverage by 0.2%.
The diff coverage is 98.9%.

@@           Coverage Diff           @@
##            main    #120     +/-   ##
=======================================
+ Coverage   92.1%   92.3%   +0.2%     
=======================================
  Files         33      33             
  Lines       2330    2400     +70     
=======================================
+ Hits        2147    2217     +70     
  Misses       183     183             
Impacted Files Coverage Δ
include/algorithms/synthesis/encoding.hpp 100.0% <ø> (ø)
include/core/truthTable/truth_table.hpp 94.5% <ø> (-0.1%) ⬇️
src/algorithms/synthesis/dd_synthesis.cpp 99.0% <98.5%> (+0.1%) ⬆️
include/algorithms/synthesis/dd_synthesis.hpp 100.0% <100.0%> (ø)
src/algorithms/synthesis/encoding.cpp 100.0% <100.0%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@SmaranTum
Copy link
Contributor Author

SmaranTum commented Dec 4, 2022

So again let me explain you the changes using an example.

Consider the truth table

0 0 -> 0 0
0 1 -> 1 1
1 0 -> 1 1
1 1 -> 1 1

The primary inputs (n) = 2, the primary outputs (n) = 2, the minimum no. of additional lines (k1) needed to realize the irreversible function is = 2.

encoded output pattern is:
0 0 -> 0 - -
1 1 -> 0 - -

after encoding, we get:

0 0 -> 0 - -
0 1 -> 1 - -
1 0 -> 1 - -
1 1 -> 1 - -

the total number bits = 4

So after the encoding we need to add r = 1 additional bit for decoding purposes.

based on this we augment zeros to the inputs and outputs.

0 0 0 0 -> 0 0 - -
0 0 0 1 -> 0 1 - -
0 0 1 0 -> 0 1 - -
0 0 1 1 -> 0 1 - -

we first synthesis above encoded truthtable (the augmented zeros are passed on since they are considered as identity in our synthesis algorithm)

once the encoded function is synthesized, the decoder is realized (please go through the decoder algorithm mentioned in https://www.cda.cit.tum.de/files/eda/2018_aspdac_coding_techniques_in_synthesis.pdf).

once the decoder is synthesized, we get

0 0 0 0 -> 0 0 - -
0 0 0 1 -> 1 1 - -
0 0 1 0 -> 1 1 - -
0 0 1 1 -> 1 1 - -

Also, as a new addition the don't cares/garbage bits in the decoders are not processed towards identity since it is not required.

@SmaranTum SmaranTum requested a review from burgholzer December 4, 2022 11:41
Copy link
Member

@burgholzer burgholzer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the explanation again. This PR still needs a bit more work before it can be merged.
You can find detailed comments down below.

include/algorithms/synthesis/encoding.hpp Outdated Show resolved Hide resolved
src/algorithms/synthesis/dd_synthesis.cpp Outdated Show resolved Hide resolved
src/algorithms/synthesis/dd_synthesis.cpp Outdated Show resolved Hide resolved
src/algorithms/synthesis/dd_synthesis.cpp Outdated Show resolved Hide resolved
src/algorithms/synthesis/dd_synthesis.cpp Outdated Show resolved Hide resolved
src/algorithms/synthesis/encoding.cpp Outdated Show resolved Hide resolved
test/unittests/test_dd_synthesis.cpp Outdated Show resolved Hide resolved
test/unittests/test_dd_synthesis_dc.cpp Show resolved Hide resolved
test/unittests/test_dd_synthesis_dc.cpp Outdated Show resolved Hide resolved
test/unittests/test_dd_synthesis_dc.cpp Outdated Show resolved Hide resolved
@SmaranTum SmaranTum requested a review from burgholzer December 5, 2022 16:29
Copy link
Member

@burgholzer burgholzer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although an improvement, there are still some issues to be tackled here. See the comments below.

include/algorithms/simulation/circuit_to_truthtable.hpp Outdated Show resolved Hide resolved
include/algorithms/synthesis/dd_synthesis.hpp Outdated Show resolved Hide resolved
include/algorithms/synthesis/dd_synthesis.hpp Outdated Show resolved Hide resolved
include/algorithms/synthesis/dd_synthesis.hpp Outdated Show resolved Hide resolved
include/core/truthTable/truth_table.hpp Outdated Show resolved Hide resolved
test/unittests/test_dd_synthesis_dc.cpp Outdated Show resolved Hide resolved
test/unittests/test_dd_synthesis_dc.cpp Outdated Show resolved Hide resolved
src/algorithms/synthesis/dd_synthesis.cpp Outdated Show resolved Hide resolved
src/algorithms/synthesis/encoding.cpp Outdated Show resolved Hide resolved
test/unittests/test_dd_synthesis_dc.cpp Outdated Show resolved Hide resolved
@SmaranTum SmaranTum requested a review from burgholzer December 5, 2022 23:26
Copy link
Member

@burgholzer burgholzer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few final change requests.

include/algorithms/synthesis/dd_synthesis.hpp Show resolved Hide resolved
include/algorithms/synthesis/dd_synthesis.hpp Outdated Show resolved Hide resolved
src/algorithms/synthesis/dd_synthesis.cpp Show resolved Hide resolved
@SmaranTum SmaranTum requested a review from burgholzer December 6, 2022 18:56
@burgholzer burgholzer enabled auto-merge (squash) December 6, 2022 18:58
@burgholzer burgholzer merged commit ff2ca63 into cda-tum:main Dec 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants