<_whitenotifier-b>
[nmigen-boards] ktemkin synchronize pull request #95: resources: allow use of ULPI PHYs with active-low RST pins - https://git.io/JJgUB
<_whitenotifier-b>
[nmigen-boards] ktemkin commented on pull request #95: resources: allow use of ULPI PHYs with active-low RST pins - https://git.io/JJoq2
electronic_eel has quit [Ping timeout: 256 seconds]
electronic_eel has joined #nmigen
PyroPeter_ has joined #nmigen
PyroPeter has quit [Ping timeout: 265 seconds]
PyroPeter_ is now known as PyroPeter
emeb has left #nmigen [#nmigen]
d1b2 has quit [Remote host closed the connection]
d1b2 has joined #nmigen
_whitelogger has joined #nmigen
jeanthom has joined #nmigen
hitomi2507 has joined #nmigen
jeanthom has quit [Ping timeout: 246 seconds]
proteus-guy has joined #nmigen
Asu has joined #nmigen
chipmuenk has joined #nmigen
jeanthom has joined #nmigen
jeanthom has quit [Remote host closed the connection]
jeanthom has joined #nmigen
jjeanthom has joined #nmigen
jeanthom has quit [Read error: Connection reset by peer]
noknok has joined #nmigen
jjeanthom has quit [Ping timeout: 240 seconds]
<DaKnig>
in m.If statements, what should I use for logical operators?
<DaKnig>
for things like `if a==1 and b==2:`
<agg>
(a==1) & (b==2)
<DaKnig>
`and` just checks if the expressions are equal to None right?
<DaKnig>
and this check is not delayed or something
<agg>
`and` is python's logical AND operation, but it happens at python-time and does not create an nmigen expression
<agg>
(because a Signal can't override it, iirc, it always converts its arguments to bools)
<DaKnig>
aha, its a bit strange that you cant override this
<agg>
whereas `&` is a bitwise operator in python (but note its different precedence), and Signal gets to define how that's handled, so it can create an nmigen expression
<agg>
be sure to have those brackets otherwise you'll be evaluating a == (1 & b) == 2
<agg>
the problem is that in python, `and`/`or` are guaranteed short-circuiting, so they have to immediately convert their arguments to bools
<DaKnig>
would have been nice to be able to overload all operators like in C++
<DaKnig>
ok thanks
jeanthom has joined #nmigen
noknok has quit [Ping timeout: 256 seconds]
<DaKnig>
one thing I did not find there - would this code: `with m.If(a):` behave as expected when len(a)>1?
<lkcl_>
agg: it does seem particularly odd that int, float and all other objects have overrides __xor__, __ge__, etc. etc. yet bool does not have __and__ __or__ and __not__
<DaKnig>
wdym
<DaKnig>
you can do both `True&True` and `True and True`
<lkcl_>
DaKnig: yes - this is a nmigen workaround, by overloading the bitwise "&" operator
<DaKnig>
lkcl_:
<lkcl_>
overloading the bitwise *python* "&" operator
<lkcl_>
not overloading the *boolean* python operator... because you can't.
<lkcl_>
oink.
<lkcl_>
dir(bool) shows that it does actually have __or__, __and__, __xor__ etc. which is *really* obtuse and plain weird.
<whitequark>
lkcl_: bool is a subclass of int, in python
<whitequark>
(mostly because python always had ints but it didn't always have bools)
<lkcl_>
whitequark: intriguing. last time i read the c code of python extensively it was 2.1 which was... 19 years ago now?
<whitequark>
>Python's Booleans were not added for the sake of strict type-checking. A very strict language such as Pascal would also prevent you performing arithmetic with Booleans, and would require that the expression in an if statement always evaluate to a Boolean result. Python is not this strict and never will be, as PEP 285 explicitly says.
<lkcl_>
in 2006-2007 i was working for NATO Research: the delay and cost in Military "approval" processes meant that they were still using python 2.1 :)
* lkcl_
is having to do migen FSMs for litex simulation
<lkcl_>
urr....
<lkcl_>
interestingly though there is the concept of "NextValue" in migen FSMs
<lkcl_>
urrr in migen if you accidentally mix comb and sync (by not using NextValue) you get *silent* failure, no warnings
<lkcl_>
whitequark: i am just... really relieved that you know what you're doing.
<DaKnig>
`a=Signal(10); a.cast(5)` doesnt behave as I expected
<whitequark>
lkcl_: yeah, that's why you regularly write rants on the libresoc bugtracker all but accusing me of incompetence
<whitequark>
DaKnig: unfortunately, that's how python class methods work
<whitequark>
i'm not aware of any reasonable way to warn on that
<lkcl_>
whitequark: that's an unfortunate misperception / misunderstanding / misreading, i can only apologise for
<lkcl_>
at some point we'll both feel comfortable - and safe - being able to discuss this and get to the bottom of it, properly.
<lkcl_>
oh: do remember to fill in the NLNet Request for Payment, and let me know when you've emailed it to them?
<whitequark>
already done a few days ago
<lkcl_>
ah good. i did ask if you could let me know that you'd done it so i can mark the records as "done".
<lkcl_>
updated. they should take... 2 weeks? if you need it sooner ping me ok?
<whitequark>
2 weeks is fine
<lkcl_>
fantastic. debugging cxxsim and fixing that issue that cesar tracked down we can also easily justify putting in some more EUR for you.
<DaKnig>
`Value.any` is the same as `Value.bool`, right?
<whitequark>
yes
zignig has joined #nmigen
<zignig>
ping!
<jeanthom>
hi zignig
<zignig>
jeanthom: hey !
<zignig>
what faboulus thing are you building in nmignen ATM ?!
<DaKnig>
lkcl_: yeah thanks. I like the trick with the |C(0,width)
Asuu has quit [Quit: Konversation terminated!]
<lkcl_>
DaKnig: o yeah, i really should have done that as Const(0, fullwidth-width) rather than use Repl, however you can see i must have cut/paste exts() to create extz().