AttributeError: Could not find IP or hierarchy fir_filter in overlay

@VLHS,

The tutorial was create with an older version of pynq. In the latest version, the fir is not part of the .ip_dict, so the hierarchy class needs updating. Note, that I also update to allocate, Xlnk is deprecated.

from pynq import DefaultHierarchy
from pynq import allocate

class FirDriver(DefaultHierarchy):
    def __init__(self, description):
        super().__init__(description)
        
    def fir_filter(self, data):
         with allocate(shape=(len(data),), dtype=np.int32) as in_buffer,\
              allocate(shape=(len(data),), dtype=np.int32) as out_buffer:
             np.copyto(in_buffer,data)
             self.fir_dma.sendchannel.transfer(in_buffer)
             self.fir_dma.recvchannel.transfer(out_buffer)
             self.fir_dma.sendchannel.wait()
             self.fir_dma.recvchannel.wait()
             result = out_buffer.copy()
         return result
    
    # use @staticmethod... Can't change class state, just as a utility function
    # remove check for FIR in the desc because somehow it's not there.
    @staticmethod
    def checkhierarchy(description):
        if 'fir_dma' in description['ip']:
            return True
        else:
            return False

I checked, and it is working for me.

Hierarchies
-----------
filter               : __main__.FirDriver

Mario

2 Likes