A lot of projects ported from the old metanohi site.
This commit is contained in:
BIN
site/projects/electruth/electruth-0.1.0.tar.gz
Normal file
BIN
site/projects/electruth/electruth-0.1.0.tar.gz
Normal file
Binary file not shown.
BIN
site/projects/electruth/electruth-0.1.1.tar.gz
Normal file
BIN
site/projects/electruth/electruth-0.1.1.tar.gz
Normal file
Binary file not shown.
BIN
site/projects/electruth/electruth-0.2.0.tar.gz
Executable file
BIN
site/projects/electruth/electruth-0.2.0.tar.gz
Executable file
Binary file not shown.
BIN
site/projects/electruth/electruth-logo-400.png
Normal file
BIN
site/projects/electruth/electruth-logo-400.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.6 KiB |
40
site/projects/electruth/index.org
Normal file
40
site/projects/electruth/index.org
Normal file
@@ -0,0 +1,40 @@
|
||||
#+title: Electruth
|
||||
#&summary
|
||||
A collection of boolean logic tools. Understands gEDA netlists.
|
||||
#&
|
||||
#+license: bysa, text
|
||||
#+license: cc0, logo
|
||||
#+license: gpl 3+, program
|
||||
|
||||
* Electruth
|
||||
|
||||
See the Truth via ELECTRUTH&color=blue&huge.
|
||||
|
||||
#&img;url=electruth-logo-400.png, alt=electruth logo
|
||||
|
||||
#&pre
|
||||
"Sometimes it's false, sometimes it's true. But it's always
|
||||
boolean."
|
||||
-- Someone
|
||||
#&
|
||||
|
||||
electruth (or "ELECTRUTH") is a collection of boolean logic tools. It can be
|
||||
used as both a command-line tool and a Python library. It understands boolean
|
||||
algebra (to some extent) and can be used to simplify boolean expressions using
|
||||
the Quine-McClusky method. This can be useful if you have a truth table in need
|
||||
of basic shortening. electruth can also be used to compare boolean expressions,
|
||||
which can be very useful if you need to compare a truth table with a schematic
|
||||
you created based on that truth table. electruth can also be used to "destroy"
|
||||
complex boolean expressions into simpler ones consisting only of ANDS, ORS and
|
||||
NOTS.
|
||||
|
||||
You can download the newest electruth, v0.2.0, (released under the GPLv3+)
|
||||
[[electruth-0.2.0.tar.gz][here]].
|
||||
|
||||
Old versions: [[electruth-0.1.0.tar.gz][0.1.1]] (final one for Python 2.x), [[electruth-0.1.0.tar.gz][0.1.0]].
|
||||
|
||||
electruth can also be found in the [[http://pypi.python.org/pypi/electruth][Python Package Index]].
|
||||
|
||||
electruth has its code at Gitorious; see [[http://gitorious.org/electruth][http://gitorious.org/electruth]].
|
||||
|
||||
NEW: Truth table generation howto up [[truthtables][here]].
|
||||
63
site/projects/electruth/truthtables.org
Normal file
63
site/projects/electruth/truthtables.org
Normal file
@@ -0,0 +1,63 @@
|
||||
#+title: Electruth :: Truth tables
|
||||
#&summary
|
||||
A guide to using truth tables with electruth
|
||||
#&
|
||||
#+license: bysa, page
|
||||
|
||||
* HOWTO: Truth tables in electruth
|
||||
|
||||
The truth table syntax used in electruth is simple: columns are separated by
|
||||
commas (but can be separated by tabs instead), and rows are separated by
|
||||
newlines. The first row must contain at least one input column and at least one
|
||||
output column. To specify that something is input, prefix the input variable
|
||||
with a '<' character. To specify an output, use the '>' character. This is best
|
||||
illustrated with an example:
|
||||
#&pre
|
||||
<A,<B,>out
|
||||
0,0,1
|
||||
0,1,0
|
||||
1,0,0
|
||||
1,1,1
|
||||
#&
|
||||
|
||||
If you save this file as something.csv (.csv means it consists of
|
||||
comma-separated values) and run `electruth something.csv', you should get an
|
||||
output like this:
|
||||
|
||||
#&pre
|
||||
out = or(and(not(A), not(B)), and(A, B))
|
||||
#&
|
||||
|
||||
This makes sense, considering that the output variable `out' is only true (a
|
||||
"1" in the truth table) when `out' is either not A and not B or A and B.
|
||||
|
||||
So, that's how you make a truth table understandable by electruth. I want to
|
||||
stress that electruth's output can almost always be shortened. In the example
|
||||
above, we can see that `out' is false ("0") when A or B is true -- it is false
|
||||
only when A is false and B is true, and when A is true and B is false. This
|
||||
construct can be shortened to fit the XOR operator, and we can say that `out'
|
||||
is false when out = A XOR B. This means that `out' is true when out = NOT (A
|
||||
XOR B) (in the internals of electruth, this would be written as "out =
|
||||
not(xor(A, B))"). This is much shorter than "out = or(and(not(A), not(B)),
|
||||
and(A, B))". To test if the two expressions really match, electruth can be used
|
||||
(and this is really electruth's best part) by running this:
|
||||
|
||||
#&pre
|
||||
electruth truthtable.csv 'out=not A xor B'
|
||||
#&
|
||||
|
||||
which should return this:
|
||||
|
||||
#&pre
|
||||
out_0 = or(and(not(A), not(B)), and(A, B))
|
||||
out_1 = or(and(not(A), not(B)), and(A, B))
|
||||
'- out_0 matches out_1? True
|
||||
#&
|
||||
|
||||
which just confirms that it is true.
|
||||
|
||||
|
||||
I created electruth to help me design electronic digital circuits. I don't know
|
||||
what you use it for, but if you stumbled upon it because of that, I can
|
||||
recommend you take a look at the programs called Ktechlab and Qucs. They can be
|
||||
used for boolean logic as well.
|
||||
Reference in New Issue
Block a user