Conversion of list of objects


#1

I have following class.

class framegrabber_roi():
def init(self, nb_bits_roi=16):
if not 16 == nb_bits_roi:
raise ValueError(“Number of bits to represent ROI must be 16”)
self.roi_width = Signal(intbv(0)[nb_bits_roi:])
self.roi_height = Signal(intbv(0)[nb_bits_roi:])
self.roi_width_offset = Signal(intbv(0)[nb_bits_roi:])
self.roi_height_offset = Signal(intbv(0)[nb_bits_roi:])

I have created a list of objects from the above class.

roi_list = []
for i in range(2):
roi_list.append(framegrabber_roi(16))

When i try to access the list like following

roi_list[0].roi_width.next = avs_mm.writedata_i[16:]

The conversion does not work, it throws following error
Object type is not supported in this context: roi_list, <type ‘list’>

When i use only a single object, the conversion work perfectly fine.
I just wanted to be sure if this is the limitation by the conversion in myhdl because in python i can access the list of objects with their individual elements.
Please let me know if somebody has tried a better approach to handle it.
Thanks for your response.


Requirement: 800+ function inputs/outputs (pinmux)
#2

Yes, MyHDL does not handle a list of classes.
I pass all Signals to each instantiation like:


class _correctionelement(object):
    ''' the element performing the actual work '''

    def __init__(self, Clk, DoFpn, DoPrnu, PrnuFpn, D, Enables, Q=None, PRNU_SCALING=9, ROUNDING=False):
     ....

class ColumnCorrection(object):
    ''' column correction of image streaam '''

    def __init__(self, WIDTH_FPN, WIDTH_PRNU, NBR_COLUMNS, NBR_LINES,
                 NBR_PARALLEL_PIXELS, ClkMM, ResetMM, Clk, Reset,
                 NbrLines, RowSequence,  Enable, Sink,
                 Avalon=None, Source=None,
                 MAX_PRNU_GAIN=2.0,  WIDTH_SCALING=9, ROUNDING=False,
                 ):

   ....

    def rtl(self):
        ''' the logic '''

    ...
        for i in range(self.NBR_PARALLEL_PIXELS):
            cces.append(_correctionelement(self.Clk, self.csr.Control.FpnOn, self.csr.Control.PrnuOn, coefficients[i],
                                           self.Sink.PayLoad.Data[i], pl.Enables, Q=self.Source.PayLoad.Data[i],
                                           PRNU_SCALING=self.WIDTH_SCALING, ROUNDING=self.ROUNDING))
            ccesrtl.append(cces[i].rtl())