sb0 changed the topic of #m-labs to: https://m-labs.hk :: Mattermost https://chat.m-labs.hk :: Logs http://irclog.whitequark.org/m-labs
cr1901 has quit [Quit: Leaving.]
cr1901 has joined #m-labs
cr1901 has quit [Ping timeout: 246 seconds]
X-Scale has quit [Ping timeout: 246 seconds]
X-Scale` has joined #m-labs
X-Scale` is now known as X-Scale
X-Scale has quit [Ping timeout: 258 seconds]
X-Scale has joined #m-labs
cr1901 has joined #m-labs
_whitelogger has joined #m-labs
rohitksingh_work has joined #m-labs
proteusguy has joined #m-labs
_whitelogger has joined #m-labs
cedric has quit [Quit: ZNC 1.7.1 - https://znc.in]
cedric has joined #m-labs
cedric has joined #m-labs
cedric has quit [Changing host]
_whitelogger has joined #m-labs
m4ssi has joined #m-labs
sb0 has joined #m-labs
<attie> whitequark: do I see it correctly that in nmigen module.submodules.name is write-only, so you can't refer to it after adding it? Is there a reason why?
<whitequark> attie: mmm, sort of
<whitequark> Module() is really syntactic sugar, and it doesn't stay around beyond your elaborate() function
<whitequark> also, Module in general doesn't do setattr() and so on
<whitequark> e.g. the clock domains are all confined to m.d.<name>, which means you can have pretty much any domain name you want (except comb)
<attie> yeah I remember there was some discussion about namespace conflicts in module
<whitequark> it would be pretty easy to add m.submodules.foo as a reader
<whitequark> but that seems more verbose than assigning it with a local in elaborate()
<attie> but I always found it a bit unintuitive that if I write "m.submodules.a = x; m.submodules.a" that gives an AttributeError
<whitequark> I agree
<whitequark> feel free to file an issue and/or PR
<attie> ok
<attie> should adding two submodules with the same name be a problem?
<attie> do they overwrite each other?
<whitequark> mmm, good question
<whitequark> they do not currently overwrite each other
<whitequark> because submodule names are advisory and only affect naming in the netlist
<whitequark> I think either disallowing duplicate submodule names, or disallowing m.submodules.<x> when there are more than one submodule with that name is equally acceptable
<attie> throwing an error if you assign the same submodule twice would be the most explicit I think
<whitequark> sure
<whitequark> i think then the internal representation needs to be refactored into something like a dict
<whitequark> where anonymous modules are represented with numbers
<attie> although I guess if you're adding submodules in a for loop, being able to suggest a name but not have to fiddle with disambiguation might be borderline useful...
<whitequark> yes
<whitequark> iirc that's the original motivation
<attie> could keep the list, and search from the back to always return the last assigned module of that name, too
<whitequark> that seems like it would have surprising behavior
<attie> would it? it's analogous to "x=a;x=b;x" returning b
<whitequark> but a is garbage collected in your example
<whitequark> you're not *replacing* an old submodule with that name
<attie> yes, but you're already not doing that
<attie> I guess there's danger in making it behave more like a regular variable name in that then you might assume it behaves like that in all ways
<whitequark> yes
<attie> so error on duplicate assignment for least amount of footgun?
<whitequark> sure. let's do that.
<attie> at the minor inconvenience of not being able to suggest a name when assigning in a loop
<whitequark> we have m.submodules[] anyway
<attie> does that have a getter?
<whitequark> doesn't
<attie> whitequark: is there actually a reason to keep a single _submodules and not split into named and unnamed submodules (thereby avoiding having to assign numbers to anon modules)?
<whitequark> Fragment uses the same representation
<whitequark> but I think it's OK to lower it from a different one in Module
<whitequark> certainly a list and a dict would be good enough
<_whitenotifier-3> [nmigen] nakengelhardt opened pull request #156: add getters to m.submodules - https://git.io/fjMv1
<_whitenotifier-3> [nmigen] whitequark reviewed pull request #156 commit - https://git.io/fjMvy
<_whitenotifier-3> [nmigen] nakengelhardt reviewed pull request #156 commit - https://git.io/fjMv7
<_whitenotifier-3> [nmigen] nakengelhardt synchronize pull request #156: add getters to m.submodules - https://git.io/fjMv1
<_whitenotifier-3> [nmigen] Success. The Travis CI build passed - https://travis-ci.org/m-labs/nmigen/builds/560973729?utm_source=github_status&utm_medium=notification
<_whitenotifier-3> [nmigen] codecov[bot] commented on pull request #156: add getters to m.submodules - https://git.io/fjMv5
<_whitenotifier-3> [nmigen] Success. The Travis CI build passed - https://travis-ci.org/m-labs/nmigen/builds/560973729?utm_source=github_status&utm_medium=notification
<_whitenotifier-3> [nmigen] Success. Absolute coverage decreased by -0.39% but relative coverage increased by +19.32% compared to 81e5983 - https://codecov.io/gh/m-labs/nmigen/compare/81e59832fbcb5a86b0720aac3993213dd08d45a5...c945c2df5367dcc4376970713d495443c79912ac
<_whitenotifier-3> [nmigen] nakengelhardt reviewed pull request #156 commit - https://git.io/fjMvx
<_whitenotifier-3> [nmigen] Success. The Travis CI build passed - https://travis-ci.org/m-labs/nmigen/builds/560976483?utm_source=github_status&utm_medium=notification
<_whitenotifier-3> [nmigen] whitequark reviewed pull request #156 commit - https://git.io/fjMfv
<attie> whitequark: is there a philosophy behind which python error to emit, or is it all just "this one sounds about right"?
<whitequark> pretty much the latter
<attie> ok
<whitequark> mm, AttributeError in getattr() means hasattr() will return False
<whitequark> instead of raising
<whitequark> so that one should stay as AttributeError
<whitequark> but the duplicate name seems to be a good fit for NameError.
Gurty has quit [Ping timeout: 264 seconds]
<attie> ok
<attie> it also occurs to me that m.domains.x could also have a getter
<attie> any objections?
<whitequark> no objections
<attie> I'll just append that to this PR then or do you prefer it separately?
<whitequark> separately ideally
sb0 has quit [Quit: Leaving]
<_whitenotifier-3> [nmigen] nakengelhardt synchronize pull request #156: add getters to m.submodules - https://git.io/fjMv1
<_whitenotifier-3> [nmigen] Success. The Travis CI build passed - https://travis-ci.org/m-labs/nmigen/builds/560986795?utm_source=github_status&utm_medium=notification
<_whitenotifier-3> [nmigen] Success. The Travis CI build passed - https://travis-ci.org/m-labs/nmigen/builds/560986795?utm_source=github_status&utm_medium=notification
<attie> ok
<attie> hmm yea that one looks a bit more complicated, I'll have to think about it
<attie> m.domain.sync and m.domains.sync are very close to each other
<whitequark> hm yes, that's unfortunate
<whitequark> attie: perhaps we should simplify that part in the other direction?
<whitequark> i.e. disallow m.domains.foo = x completely
<whitequark> have m.domains += ClockDomain("sync") and m.domains["sync"] += code / m.domains.sync += code / m.d.sync += code
<whitequark> alternatively, rename m.domains back to m.clock_domains
<whitequark> the latter seems more sensible, especially as rjo's plan for multiple comb domains doesn't seem very viable to me
<_whitenotifier-3> [nmigen] whitequark closed pull request #156: add getters to m.submodules - https://git.io/fjMv1
<_whitenotifier-3> [m-labs/nmigen] whitequark pushed 1 commit to master [+0/-0/±2] https://git.io/fjMfS
<_whitenotifier-3> [m-labs/nmigen] nakengelhardt 698b005 - hdl.dsl: add getters to m.submodules.
<_whitenotifier-3> [nmigen] Success. The Travis CI build passed - https://travis-ci.org/m-labs/nmigen/builds/561000386?utm_source=github_status&utm_medium=notification
<_whitenotifier-3> [nmigen] Success. The Travis CI build passed - https://travis-ci.org/m-labs/nmigen/builds/561000386?utm_source=github_status&utm_medium=notification
rohitksingh_work has quit [Read error: Connection reset by peer]
Gurty has joined #m-labs
Gurty has quit [Changing host]
Gurty has joined #m-labs
<attie> ok back from dinner
<attie> whitequark: what effect does the name in m.domains.foo even have? if I say m.domains.foo = ClockDomain("bar") is foo used anywhere?
<whitequark> attie: nope. and it's not used by the tracer either, at least not by the current impl
<attie> that kind of makes me prefer the m.domains += ClockDomain("sync") solution
<attie> either of those changes would break existing code but I guess now before 0.1 would be the time to do it
<cr1901> Good thiing I didn't write the rest of the "nmigen for omigen users" tutorial yet. Gonna have to see what changed.
m4ssi has quit [Remote host closed the connection]
cr19011 has joined #m-labs
cr1901 has quit [Ping timeout: 244 seconds]
cr19011 has quit [Read error: Connection reset by peer]
cr1901 has joined #m-labs