Re: how to make list of unequal-sized signals

Samuele Disegna <[email protected]> Thu, 25 Feb 2016 16:15:31 +0100
Newsgroups gmane.comp.python.myhdl
Message-ID <CADXD_DaSwNfmO_f_yE25Om0mf1qj8Lya5vv7R1ZnTEbziTtO-A@mail.gmail.com>
I am sorry.. Previous code is wrong.
Il 25/Feb/2016 16:05, "Samuele Disegna" <[email protected]> ha scritto:

> What about this?
>
> multout = [Signal(intbv(0, min=de.min*coeff, max=de.max*coeff)) for coeff
> in coeffs]
>
> resized_multout = [Signal(intbv(0, min=de.min*coeffmax,
> max=de.max*coeffmax)) for coeff in coeffs]
>
> for i in range(len(coeffs)):
>   @always_comb
>       def res():
>            resized_multout[i].next = multout[i]
>
> @always_comb
>     def outdat():
>         totsum = 0
>         for i in range(len(coeffs)):
>             totsum += resized_multout[i]
>         qe.data.next = totsum
>
> Samuele
> Il 25/Feb/2016 15:38, "David Belohrad" <[email protected]> ha scritto:
>
>> Hi all,
>>
>> that is indeed exactly what I want to do. I do not want instantiate a
>> memory like iface, but rather bunch of individual signals, which will be
>> properly linked.
>>
>> using this construct:
>> multout = [Signal(intbv(0, min=de.min*coeff, max=de.max*coeff)) for coeff
>> in coeffs]
>>
>> outside of the yield functions works exactly as expected, i.e. it
>> generates tons of signals. Problem is, that I use multout as follows:
>>
>>     @always_comb
>>     def outdat():
>>         totsum = 0
>>         for i in range(len(coeffs)):
>>             totsum += multout[i]
>>         qe.data.next = totsum
>>
>> and when multout is inside any decorated block it tries to instantiate
>> memory-like array (as properly stated in docs), which i'd like to avoid and
>> instead generate 'on-fly' totsum = resize(multout[0],
>> totsum'length)+resize(multout[1], totsum'length)+....
>>
>> which would permit me to take control over length of multout (which is an
>> output of multiplier, hence I'd like to use minimum amount of bits to
>> implement it to control fpga resources)...
>>
>>
>>
>>
>>
>>
>> Christopher Felton <[email protected]> writes:
>>
>> >> this does not seem to be convertible, as the signals in the array
>> >> have different lengths
>> >>
>> >> multout = [Signal(intbv(0, min=de.min*coeff, max=de.max*coeff)) for
>> >> coeff in coeffs]
>> >
>> > You can't do this, in hardware if they are all different
>> > types they would need to be mapped to some non-homogeneous
>> > structure (i.e. not memory).
>> >
>> > What I would do if first find the min and max in your
>> > coefficients and create the coefficient array
>> > (list-of-signals) from the overall collection's min and
>> > max.  Then you have a structure that can be mapped to
>> > to a memory if needed.
>> >
>> > If that is not desired, you don't have much choice but
>> > to individually select the different size `coeff`.  Note,
>> > if you use the ROM [1] structure (tuple-of-ints) it will
>> > use the minimal hardware you desire.
>> >
>> > Regards,
>> > Chris
>> >
>> >
>> > [1]
>> >
>> http://docs.myhdl.org/en/stable/manual/conversion_examples.html#rom-inference
>> >
>> >
>> >
>> ------------------------------------------------------------------------------
>> > Site24x7 APM Insight: Get Deep Visibility into Application Performance
>> > APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
>> > Monitor end-to-end web transactions and take corrective actions now
>> > Troubleshoot faster and improve end-user experience. Signup Now!
>> > http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
>> > _______________________________________________
>> > myhdl-list mailing list
>> > [email protected]
>> > https://lists.sourceforge.net/lists/listinfo/myhdl-list
>>
>>
>> ------------------------------------------------------------------------------
>> Site24x7 APM Insight: Get Deep Visibility into Application Performance
>> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
>> Monitor end-to-end web transactions and take corrective actions now
>> Troubleshoot faster and improve end-user experience. Signup Now!
>> http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
>> _______________________________________________
>> myhdl-list mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/myhdl-list
>>
>

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140

_______________________________________________
myhdl-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/myhdl-list