def __init__(self, bitfile, **kwargs): super().__init__(bitfile, **kwargs) if self.is_loaded(): self.iop_pmoda.mbtype = "Pmod" self.iop_pmodb.mbtype = "Pmod" self.iop_arduino.mbtype = "Arduino" self.PMODA = self.iop_pmoda.mb_info self.PMODB = self.iop_pmodb.mb_info self.ARDUINO = self.iop_arduino.mb_info self.audio = self.audio_direct_0 self.leds = self.leds_gpio.channel1 self.switches = self.switches_gpio.channel1 self.buttons = self.btns_gpio.channel1 self.leds.setlength(4) self.switches.setlength(2) self.buttons.setlength(4) self.leds.setdirection("out") self.switches.setdirection("in") self.buttons.setdirection("in") self.rgbleds = ([None] * 4) + [pynq.lib.RGBLED(i) for i in range(4, 6)] self.trace_pmoda = TraceAnalyzer( self.trace_analyzer_pmoda.description['ip'], PYNQZ1_PMODA_SPECIFICATION) self.trace_arduino = TraceAnalyzer( self.trace_analyzer_arduino.description['ip'], PYNQZ1_ARDUINO_SPECIFICATION)
def test_trace_buffers(): """Test for the TraceAnalyzer class. This group of tests will examine a scenario where 2 trace analyzers are instantiated. This should be no problem since the trace analyzer is implemented as a singleton. """ ol.download() num_samples = sorted( sample([k for k in range(MAX_NUM_TRACE_SAMPLES)], 2)) analyzers = [None, None] for i in range(2): analyzers[i] = TraceAnalyzer(mb_info) analyzers[i].setup(num_analyzer_samples=num_samples[i]) assert 'trace_buf' in analyzers[i].logictools_controller.buffers, \ 'Analyzer with {} samples does not allocate trace_buf.'.format( num_samples[i]) analyzers[i].run() analyzers[i].analyze(0) assert analyzers[i].samples is not None, \ 'Analyzer with {} samples has empty raw samples.'.format( num_samples[i]) analyzers[i].stop() assert len(analyzers[i].samples) == num_samples[i], \ 'Analyzer with {} samples gets wrong number of samples.'.format( num_samples[i]) analyzers[i].reset() analyzers[i].__del__() assert 'trace_buf' not in analyzers[i].logictools_controller.buffers, \ 'trace_buf is not freed after use.'
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) if self.is_loaded(): self.iop_pmod0.mbtype = "Pmod" self.iop_pmod1.mbtype = "Pmod" self.iop_rpi.mbtype = "Rpi" self.PMOD0 = self.iop_pmod0.mb_info self.PMOD1 = self.iop_pmod1.mb_info self.PMODA = self.PMOD0 self.PMODB = self.PMOD1 self.RPI = self.iop_rpi.mb_info self.audio = self.audio_codec_ctrl_0 self.audio.configure(iic_index=5) self.leds = self.gpio_leds.channel1 self.leds.setdirection('out') self.leds.setlength(4) self.rgbleds = [pynq.lib.RGBLED(i, "rgbleds") for i in range(2)] self.buttons = self.gpio_btns.channel1 self.buttons.setdirection('in') self.buttons.setlength(4) self.switches = self.gpio_sws.channel1 self.switches.setdirection('in') self.switches.setlength(4) self.iop_grove.mbtype = "GC" self.GC = self.iop_grove.mb_info self.trace_rpi = TraceAnalyzer( self.trace_analyzer_pi.description['ip'], PYNQZU_RPI_SPECIFICATION) self.trace_pmod0 = TraceAnalyzer( self.trace_analyzer_pmod0.description['ip'], PYNQZU_PMODA_SPECIFICATION) self.trace_pmod1 = TraceAnalyzer( self.trace_analyzer_pmod1.description['ip'], PYNQZU_PMODB_SPECIFICATION) pynq.lib.pynqmicroblaze.bsp.add_module_path( '/pynq/lib/pynqmicroblaze/grove_modules')
def __init__(self, bitfile, **kwargs): super().__init__(bitfile, **kwargs) if self.is_loaded(): self.iop_pmoda.mbtype = "Pmod" self.iop_pmodb.mbtype = "Pmod" self.iop_arduino.mbtype = "Arduino" self.iop_rpi.mbtype = "Rpi" self.PMODA = self.iop_pmoda.mb_info self.PMODB = self.iop_pmodb.mb_info self.ARDUINO = self.iop_arduino.mb_info self.RPI = self.iop_rpi.mb_info self.pin_select = GPIO( GPIO.get_gpio_pin(self.gpio_dict['pmoda_rp_pin_sel']['index']), "out") self.audio = self.audio_codec_ctrl_0 self.audio.configure() self.leds = self.leds_gpio.channel1 self.switches = self.switches_gpio.channel1 self.buttons = self.btns_gpio.channel1 self.leds.setlength(4) self.switches.setlength(2) self.buttons.setlength(4) self.leds.setdirection("out") self.switches.setdirection("in") self.buttons.setdirection("in") self.rgbleds = ([None] * 4) + [pynq.lib.RGBLED(i) for i in range(4, 6)] self.trace_rpi = TraceAnalyzer( self.trace_analyzer_pi.description['ip'], PYNQZ2_RPI_SPECIFICATION) self.trace_pmoda = TraceAnalyzer( self.trace_analyzer_pi.description['ip'], PYNQZ2_PMODA_SPECIFICATION) self.trace_pmodb = TraceAnalyzer( self.trace_analyzer_pmodb.description['ip'], PYNQZ2_PMODB_SPECIFICATION)
def test_trace_max_samples(): """Test for the TraceAnalyzer class. The loop back data tests will be conducted for pattern generator and FSM generator, hence this test only checks basic properties, attributes, etc. for the trace analyzer. The 1st group of tests will examine 0, or (MAX_NUM_TRACE_SAMPLES + 1) samples. An exception should be raised in these cases. """ ol.download() for num_samples in [0, MAX_NUM_TRACE_SAMPLES + 1]: exception_raised = False analyzer = None try: analyzer = TraceAnalyzer(mb_info) analyzer.setup(num_analyzer_samples=num_samples) except ValueError: exception_raised = True finally: analyzer.logictools_controller.reset_buffers() analyzer.__del__() assert exception_raised, \ 'Should raise exception when capturing {} sample(s).'.format( num_samples)
def __init__(self, bitfile, **kwargs): super().__init__(bitfile, **kwargs) if self.is_loaded(): self.iop_pmoda.mbtype = "Pmod" self.PMODA = self.iop_pmoda.mb_info self.leds = self.leds_gpio.channel1 self.switches = self.switches_gpio.channel1 self.buttons = self.btns_gpio.channel1 self.leds.setlength(8) self.switches.setlength(8) self.buttons.setlength(4) self.leds.setdirection("out") self.switches.setdirection("in") self.buttons.setdirection("in") self.trace_pmoda = TraceAnalyzer( self.trace_analyzer_pmoda.description['ip'], PYNQZ1_PMODA_SPECIFICATION)
def test_trace_run(): """Test for the TraceAnalyzer class. This group of tests will examine 1, 2, or MAX_NUM_TRACE_SAMPLES samples. No exception should be raised in these cases. For each case, all the methods are tested, and the states of the trace analyzer have been checked. """ ol.download() for num_samples in [1, 2, MAX_NUM_TRACE_SAMPLES]: analyzer = TraceAnalyzer(mb_info) assert analyzer.status == 'RESET' analyzer.setup(num_analyzer_samples=num_samples) assert analyzer.status == 'READY' analyzer.run() analyzer.stop() assert analyzer.status == 'READY' analyzer.analyze(0) analyzer.reset() assert analyzer.status == 'RESET' analyzer.__del__()