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
rohitksingh has joined #m-labs
rohitksingh has quit [Ping timeout: 250 seconds]
_whitelogger has joined #m-labs
<_whitenotifier> [nmigen] RobertBaruch opened issue #197: Consider adding Default to Module in dsl.py - https://git.io/JeeTk
Astro- has quit [Ping timeout: 268 seconds]
Astro- has joined #m-labs
proteusdude has quit [Ping timeout: 246 seconds]
_whitelogger has joined #m-labs
proteusdude has joined #m-labs
rohitksingh has joined #m-labs
<_whitenotifier> [nmigen] whitequark commented on issue #197: Consider adding Default to Module in dsl.py - https://git.io/Jeeka
rohitksingh has quit [Ping timeout: 264 seconds]
rohitksingh has joined #m-labs
rohitksingh has quit [Remote host closed the connection]
<ZirconiumX> If I have a bunch of unit tests for an nMigen module, do I have to create a new pysim.Simulator for each one?
<whitequark> currently yes
<whitequark> there's an open issue for that
<ZirconiumX> Right, okay
<_whitenotifier> [nmigen] whitequark commented on issue #197: Consider adding Default to Module in dsl.py - https://git.io/Jeeqk
<whitequark> kernlbob: you probably want to use `bits.bit_select(counter[3:7], 1)`, not an Array
<_whitenotifier> [nmigen] programmerjake commented on issue #197: Consider adding Default to Module in dsl.py - https://git.io/JeeqN
<_whitenotifier> [nmigen] whitequark commented on issue #197: Consider adding Default to Module in dsl.py - https://git.io/Jeeqx
<_whitenotifier> [nmigen] whitequark closed issue #196: Signal's `max` parameter isn't a max - https://git.io/fjje7
<_whitenotifier> [m-labs/nmigen] whitequark pushed 1 commit to master [+0/-0/±2] https://git.io/JeemJ
<_whitenotifier> [m-labs/nmigen] whitequark ccfbccc - hdl.ast: add Signal.range(...), to replace Signal(min=..., max=...).
<kernlbob> @whitequark thanks. How would you feel about extending HDL so that `word[value]` was a synonym for `word.bitselect(value, 1)`?
<_whitenotifier> [nmigen] Success. The Travis CI build passed - https://travis-ci.org/m-labs/nmigen/builds/582300639?utm_source=github_status&utm_medium=notification
<_whitenotifier> [nmigen] Success. 82.97% (+0.18%) compared to 5e9587b - https://codecov.io/gh/m-labs/nmigen/commit/ccfbccc044e32492eb8f44c3157a1e1449d9097f
<_whitenotifier> [nmigen] Success. 100% of diff hit (target 82.78%) - https://codecov.io/gh/m-labs/nmigen/commit/ccfbccc044e32492eb8f44c3157a1e1449d9097f
<_whitenotifier> [m-labs/nmigen] whitequark pushed 2 commits to master [+0/-0/±9] https://git.io/Jeemz
<_whitenotifier> [m-labs/nmigen] whitequark eb04a25 - hdl.mem,lib,examples: use Signal.range().
<_whitenotifier> [m-labs/nmigen] whitequark 3f6abc0 - hdl.dsl: add Default(), an alias for Case() with no arguments.
<_whitenotifier> [nmigen] whitequark closed issue #197: Consider adding Default to Module in dsl.py - https://git.io/JeeTk
<whitequark> kernlbob: not going to happen
<kernlbob> whitequark: ok.
<_whitenotifier> [nmigen] Success. 82.82% (+0.03%) compared to 5e9587b - https://codecov.io/gh/m-labs/nmigen/commit/ccfbccc044e32492eb8f44c3157a1e1449d9097f
<_whitenotifier> [nmigen] Success. 91.66% of diff hit (target 82.78%) - https://codecov.io/gh/m-labs/nmigen/commit/ccfbccc044e32492eb8f44c3157a1e1449d9097f
<_whitenotifier> [nmigen] Success. The Travis CI build passed - https://travis-ci.org/m-labs/nmigen/builds/582300639?utm_source=github_status&utm_medium=notification
<_whitenotifier> [nmigen] Success. The Travis CI build passed - https://travis-ci.org/m-labs/nmigen/builds/582303174?utm_source=github_status&utm_medium=notification
<_whitenotifier> [nmigen] Success. 82.97% (+0.15%) compared to ccfbccc - https://codecov.io/gh/m-labs/nmigen/commit/3f6abc0b7a12fffdd8e05c0d5811af3de459d13f
<_whitenotifier> [nmigen] Success. 100% of diff hit (target 82.82%) - https://codecov.io/gh/m-labs/nmigen/commit/3f6abc0b7a12fffdd8e05c0d5811af3de459d13f
bluebugs has joined #m-labs
bluebugs has quit [Changing host]
bluebugs has joined #m-labs
cedric has quit [Ping timeout: 276 seconds]
<_whitenotifier> [nmigen] Success. 82.83% (+<.01%) compared to ccfbccc - https://codecov.io/gh/m-labs/nmigen/commit/3f6abc0b7a12fffdd8e05c0d5811af3de459d13f
<_whitenotifier> [nmigen] Success. The Travis CI build passed - https://travis-ci.org/m-labs/nmigen/builds/582303174?utm_source=github_status&utm_medium=notification
<ZirconiumX> whitequark: I think it'd be nice to annotate Signals as inputs or outputs so nMigen can warn if you connect two inputs or outputs together.
<ZirconiumX> At the moment it seems to rely on naming conventions to prevent that
<whitequark> ZirconiumX: it would be nice
<whitequark> unfortunately, I don't really see a way to do this
<ZirconiumX> Is it an undecidable problem or something?
<whitequark> no, it just doesn't fit well into nmigen's existing design
<whitequark> I mean, maybe I'm just missing something!
<whitequark> you can try coming up with a specific design for this and we can discuss it; it's just that I wasn't able to
<whitequark> so far
<ZirconiumX> Constructors can take keyword arguments in Python, right?
<whitequark> sure
<ZirconiumX> So then how about an enum-like kwarg of Signal(..., type=connection.INPUT)?
<whitequark> and what semantics would that have?
<ZirconiumX> I'm wary of linking this to Verilog, so I won't
<ZirconiumX> It'd need to default to an in/out type because of backcompat
<whitequark> no, that's irrelevant
<whitequark> signals are not tied to fragments in nmigen
<whitequark> you can use any signal in any fragment
<ZirconiumX> Would you mind defining fragment here in terms of nMigen?
<whitequark> well
<whitequark> a fragment is nmigen's internal representation
<ZirconiumX> Would that have been the F in Migen's FHDL?
<whitequark> yeah
<whitequark> a fragment in nmigen has (a) ports and (b) tree of switch and assign statements
<whitequark> it's essentially equivalent to an RTLIL module
<ZirconiumX> Okay, I think I get it
<ZirconiumX> My main aim for something like this is as a lint
<ZirconiumX> If an annotated output connects to another annotated output, there's probably something wrong
<whitequark> you already get a warning in this case
<whitequark> (hierarchy being flattened)
<whitequark> well, if those are outputs of different modules
<whitequark> if those are the outputs of the same module, then that's perfectly reasonable
* ZirconiumX is scanning through the nMigen source, and may be a little while
<whitequark> defining the exact semantics of what does it mean to have an "input signal" or "output signal" is hard
<whitequark> i'm not sure if it makes sense at all
<whitequark> in fact, i wonder if the right approach here is to define a dataflow language on top of nmigen that distinguishes between input, output, and control signals, and natively supports pipelining
<ZirconiumX> I think the main purpose of it would be as a lint.
<whitequark> a lint has to have very few false positives or it's worse than useless
<whitequark> so this doesn't change much
<ZirconiumX> "you say this is an input signal; okay, fine, but you haven't connected it to anything"
<ZirconiumX> I don't think I understand enough about nMigen to really appreciate the problems involved here
<whitequark> unconnected inputs in nmigen are defined to go to their reset value, so leaving them unconnected is perfectly sound
<ZirconiumX> Doesn't that require you to define a reset value, though?
<whitequark> if you don't explicitly specify a reset value, it's 0
<ZirconiumX> Personally I feel like this would be a good time for "errors should not pass silently; unless explicitly silenced"
<ZirconiumX> To quote Tim Peters
<whitequark> but it's not an error
<whitequark> not having 'x is a deliberate, explicit choice
<whitequark> and so is having signals reset to 0 by default
<ZirconiumX> It's possible to not have 'x and still require it to be given a value
<whitequark> sure
<whitequark> you're a few years late to suggest doing that though
<whitequark> about eight, i think
<ZirconiumX> I'll get my DeLorean then
<whitequark> I'm also not actually convinced that sprinkling "reset=0" everywhere is beneficial
<ZirconiumX> That's not what I mean; zero as a default seems sane to me
<whitequark> okay
<whitequark> then I don't understand what you are suggesting
<ZirconiumX> When module X adds module Y as a submodule, module Y has an annotation that marks signals as public or whatever. While elaborating module X, nMigen checks if X references all public signals of Y and warns if not.
<whitequark> sure. lots of existing migen/nmigen code rely on disconnected signals having their reset value
<whitequark> for example, if you don't use some feature, you never set the signal that enables it to 1. what's wrong with that?
<whitequark> you can't do this in verilog (without a lot of effort) because of 'x, but in nmigen it's natural
<whitequark> also, if you were writing such a lint, it's not necessary to extend nmigen at all
<ZirconiumX> To me as a beginner it might as well be 'x unless I know what the reset value of something is
<whitequark> there's already a pass that sets all unused signals to their reset value. it'd be relatively easy to make it emit a diagnostic instead.
<whitequark> *unassigned signals
<whitequark> hm
<whitequark> so thinking more about it
<whitequark> wouldn't it make more sense to have something like Rust's #[must_use] annotation on the signals without which a module is pointless?
<ZirconiumX> Yes, it would
<whitequark> this wouldn't apply to inputs only; if you instantiate a FIFO and never use dout, that's bad
<ZirconiumX> Or memory
<ZirconiumX> I think something like must_read and must_write would be helpful
<whitequark> I don't see why is the distinction needed
<whitequark> the semantics of must_use would be, "this signal needs to be referenced from an outer fragment"
<ZirconiumX> Is writing to a FIFO output a particularly useful thing to do?
<whitequark> hmm.
<whitequark> ok, true
<ZirconiumX> Sure, you get a warning about the hierarchy being flattened
<ZirconiumX> But it counts as a "reference"
<whitequark> yes, you have a point
<whitequark> now the syntax I'd like to use for this is Python's type annotations
<whitequark> since... well... that's what's appropriate
X-Scale has joined #m-labs
<ZirconiumX> Sure, though I have basically never used that syntax before ^.^
<whitequark> anyway, you should think of this as some kind of long-term nice-to-have feature
<whitequark> a CDC verifier is far higher priority
<ZirconiumX> Sure, fair.
qinfengling is now known as fengling
<_whitenotifier> [nmigen] RobertBaruch commented on issue #197: Consider adding Default to Module in dsl.py - https://git.io/JeeZI
<kernlbob> I am trying to run my whole design from a PLL-generated 24MHz clock. (iCEBreaker platform)
<kernlbob> Do I just create the top level module like this?
<kernlbob> ```
<kernlbob> cd_c24mhz = ClockDomain()
<kernlbob> my_pll = Instance('SB_PLL40_PAD', O_PLLOUTGLOBAL=cd_c24mhz.clk, ...)
<kernlbob> m = Module()
<kernlbob> m.domains.sync = cd_c24mhz
<kernlbob> ```
<whitequark> this is the basic idea
<whitequark> however, the PLL lock signal isn't synchronized to its clock
<whitequark> so you have to use a ResetSynchronizer
<whitequark> m.submodules += ResetSynchronizer(~pll_lock, "sync")
<kernlbob> Lemme look at Reset Synchronizer...
<_whitenotifier> [nmigen] RobertBaruch opened issue #198: Enumerated signals? - https://git.io/Jeens
cr1901_modern has quit [Quit: Leaving.]
rohitksingh has joined #m-labs
<kernlbob> This is what I tried. It does not elaborate.
<kernlbob> ```
<kernlbob> (The platform is still iCEBreaker.)
<kernlbob> class Example(Elaboratable):
<kernlbob> def elaborate(self, platform):
<kernlbob> clk_pin = platform.request('clk12')
<kernlbob> pll_lock = Signal()
<kernlbob> cd_pll = ClockDomain()
<kernlbob> pll = Instance("SB_PLL40_PAD",
<kernlbob> p_FEEDBACK_PATH='SIMPLE',
<tpw_rules> ow
<kernlbob> p_DIVR=0b0000,
<kernlbob> p_DIVF=0b0111111,
<kernlbob> p_DIVQ=0b101,
<kernlbob> p_FILTER_RANGE=0b001,
<kernlbob> i_PACKAGEPIN=clk_pin,
<kernlbob> o_PLLOUTGLOBAL=cd_pll.clk,
<kernlbob> o_LOCK=pll_lock,
<kernlbob> i_RESETB=Signal(reset=1),
<kernlbob> i_BYPASS=Signal(reset=0))
<kernlbob> synchro = ResetSynchronizer(~pll_lock, 'sync')
<kernlbob> m = Module()
<kernlbob> m.domains.sync = cd_pll
<kernlbob> m.submodules += pll
<kernlbob> m.submodules += synchro
<kernlbob> return m
<kernlbob> ```
<kernlbob> And the error is
<kernlbob> ```
<kernlbob> ...
<kernlbob> File "/Users/kbob/Documents/Code/Python/Envs/nmigen/lib/python3.7/site-packages/nmigen/vendor/lattice_ice40.py", line 138, in create_missing_domain
<kernlbob> clk_i = self.request(self.default_clk).i
<kernlbob> File "/Users/kbob/Documents/Code/Python/Envs/nmigen/lib/python3.7/site-packages/nmigen/build/res.py", line 65, in request
<kernlbob> .format(name, number))
<kernlbob> nmigen.build.res.ResourceError: Resource clk12#0 has already been requested
<kernlbob> ```
<kernlbob> I must missing something basic, because I don't know how to start
<kernlbob> debugging this. What am I doing wrong?
cr1901_modern has joined #m-labs
<davidc__> uh... this isn't slack :P
<kernlbob> @davidc__: Yes it isn't. What would be a better question format?
<tpw_rules> pastebin
rohitksingh has quit [Ping timeout: 264 seconds]
zng has quit [*.net *.split]
<cr1901_modern> Can Arrays be used as ranges?
zng has joined #m-labs
rohitksingh has joined #m-labs
kernlbob has quit [*.net *.split]
<vup> kernlbob: so what happens is, that the `'sync'` clock domain referenced by the ResetSynchronizer is different from the `cd_pll` `ClockDomain`, so the platform creates the default `'sync'` clock domain (by using the 'clk12' pin) and you use the 'clk12' pin in the pll instance, which explains why the 'clk12' pin is requested twice
<_whitenotifier> [nmigen] RobertBaruch opened issue #199: Documentation: 'domain' in Past et al is a string - https://git.io/JevZm
<vup> to fix it you need to specify that `cd_pll` should be the 'sync' ClockDomain, by giving it the 'sync` name: `cd_pll = ClockDomain(jsync')`
rohitksingh has quit [Ping timeout: 276 seconds]
<ZirconiumX> [21:18:56] * kernlbob has disconnected (*.net *.split)
<ZirconiumX> vup: you'll probably need to copy paste it when they get back
<vup> well i hope they read the log
<emily> after pasting an entire program? sounds a little optimistic >.>
<vup> :/
rohitksingh has joined #m-labs
<_whitenotifier> [nmigen] whitequark commented on issue #198: Enumerated signals? - https://git.io/JeJmt
<_whitenotifier> [nmigen] whitequark commented on issue #198: Enumerated signals? - https://git.io/JeJYe
<_whitenotifier> [m-labs/nmigen] whitequark pushed 1 commit to master [+0/-0/±2] https://git.io/JeJOA
<_whitenotifier> [m-labs/nmigen] whitequark 9b398b5 - hdl.ast: check type of Sample(domain=...).
<_whitenotifier> [nmigen] whitequark closed issue #199: Documentation: 'domain' in Past et al is a string - https://git.io/JevZm
<_whitenotifier> [nmigen] Success. The Travis CI build passed - https://travis-ci.org/m-labs/nmigen/builds/582455413?utm_source=github_status&utm_medium=notification
<_whitenotifier> [nmigen] Success. 82.87% (+0.03%) compared to 3f6abc0 - https://codecov.io/gh/m-labs/nmigen/commit/9b398b502e23c4597246db576765994ccd7127aa
<_whitenotifier> [nmigen] Success. 100% of diff hit (target 82.83%) - https://codecov.io/gh/m-labs/nmigen/commit/9b398b502e23c4597246db576765994ccd7127aa