cjdrake / pyeda

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

Is there a way to access terms of an expression? #148

Open Cerebus opened 6 years ago

Cerebus commented 6 years ago

I don't see anything in the docs, but I could be missing something.

jason-s commented 5 years ago

I'm interested too; if there's an AND or an OR or an XOR, I'd like to be able to access its operands.

jason-s commented 5 years ago

oh wait -- it's .xs:

>>> import pyeda.inter
>>> a,b = map(pyeda.inter.exprvar,'ab')
>>> c = a&~b | b&~a
>>> c
Or(And(a, ~b), And(b, ~a))
>>> c.xs
(And(a, ~b), And(b, ~a))