<bl0x[m]>
<hello__jk[m]> "Hello everyone I'm new here" <- Hi, welcome!
<bl0x[m]>
What should be the threshold for using explicit Signatures instead of declaring In and Out members? For example when I have a simple counter, does using a Signature really improve the code or is that mostly for demonstration purposes? Are signatures more useful/applicable when one has a producer/consumer scenario?
<bl0x[m]>
I find the semantics a bit misleading when connecting e.g. a counter via a Signature. I'll most often have another set of Signals in the parent module that then connect to the Members is the signature. Also, a counter Signature with a trigger and a value member is neither an In nor an Out. It's usually both. And I don't want to declare two signatures. Hmmm, perhaps I'm overthinking this...
<zignig>
... bus timeout ...
zignig has quit [Quit: leaving]
d_olex has quit [Ping timeout: 256 seconds]
d_olex has joined #amaranth-lang
d_olex has quit [Max SendQ exceeded]
d_olex has joined #amaranth-lang
peepsalot has quit [Remote host closed the connection]
<whitequark[cis]>
<bl0x[m]> "What should be the threshold for..." <- I'm not sure what your actual question is. what is a simple counter?
<bl0x[m]>
For the time being let's consider a counter an 8 Bit register that increments by 1, whenever a trigger/count signal goes from 0 to 1. The value of the register can be accessed from outside. So the counter module would have a trigger input and a count value output.
<whitequark[cis]>
yeah. you could make it a component although I wouldn't make one for something that simple that can be easily inlined into elaborate()
zyp[m] has joined #amaranth-lang
<zyp[m]>
<bl0x[m]> "What should be the threshold for..." <- I'd say that the rule of thumb for when it makes sense to make explicit signatures is when they'll be used as signature members
<zyp[m]>
in general it doesn't make sense for the toplevel signature of a component to be externally defined, unless you're making some sort of pluggable modules where the whole interface is 100% predefined
<bl0x[m]>
<whitequark[cis]> "yeah. you could make it a..." <- Well, it was a simple example.
<zyp[m]>
or actually, let me put it simpler; the rule of thumb for when it makes sense to make an explicit signature is if you'd use the resulting interface with connect(), because then you'd generally want to have the same signature on both sides
<zyp[m]>
you rarely want to use connect() on a whole component
<bl0x[m]>
zyp[m]: Ah, I see.
<bl0x[m]>
So, use a Signature and connect() call for the e.g. Data stream part of the interface and then connect other (control) signals by hand?
<whitequark[cis]>
that is a common pattern, yes
<bl0x[m]>
Ok, I think I get it now. Thanks
<zyp[m]>
consider something like a DMA block, it'll have a bus interface and a stream input or output, so you'd call connect() once to connect the bus interface to a bus arbitrator, and once more to connect the stream interface to a data source or sink
<zyp[m]>
and then the bus and stream signatures should be defined and reusable
<zyp[m]>
but the resulting signature of the component is implicit and unimportant