cjdrake / pyeda

Python EDA
BSD 2-Clause "Simplified" License
301 stars 55 forks source link

Fix https://github.com/cjdrake/pyeda/issues/125 #178

Closed danjujan closed 1 year ago

danjujan commented 1 year ago

Don't assume the inputs in a truthtable are sorted.

cjdrake commented 1 year ago

Thanks, @danjujan for this contribution. It might take me a minute to try it, b/c my Windows desktop doesn't have the C/C++ build tools installed yet.

Something that would be helpful is a unit test. A test that fails without this change, but passes with it.

danjujan commented 1 year ago

Thank you for this great library!

I saw that you have already added a unittest. If you are interested in mine:

Code ```python a, b, c = map(exprvar, 'abc') f_tt = truthtable((a, b, c), '10110101') f_ex = truthtable2expr(f_tt) g_ex = espresso_tts(f_tt)[0] self.assertTrue(f_ex.equivalent(g_ex)) f_tt = truthtable((c, b, a), '10110101') f_ex = truthtable2expr(f_tt) g_ex = espresso_tts(f_tt)[0] self.assertTrue(f_ex.equivalent(g_ex)) f_tt = truthtable((b, a, c), '10110101') f_ex = truthtable2expr(f_tt) g_ex = espresso_tts(f_tt)[0] self.assertTrue(f_ex.equivalent(g_ex)) ```
cjdrake commented 1 year ago

Excellent :).

Create another pull request, and I'll merge it.