PYNQ-Z2: Embedded Vision Workshop Series with Adam Taylor
Getting Started | Getting Up and Running | Unlocking Your Inner PYNQ Hero | Project14 | PYNQ Workshop
I recently participated in this Element 14 workshop session https://www.element14.com/community/events/5504/l/pynq-z2-workshop-getting-started-with-pynq-win-a-500-gift-card-for-your-embedded-vision-project led by Adam Taylor, where we took an introductory look at the PYNQ-Z2 development board produced by the Tul Corporation.
In one of the lab exercises we looked at the Logictools overlay and more specifically the Pattern Generator and Trace Analyzer.
The Logictools IP contains four main hardware blocks, namely:
- Pattern Generator
- Finite State Machine Generator
- Boolean Generator
- Trace Analyzer
which are controlled by a MicroBlaze instance running on the FPGA fabric of the Xilinx ZYNQ XC7Z020 device.
Via the PYNQ framework these blocks can be easily configured via iPython running within a Jupyter Notebook.
The configuration requirement is pretty minimal, most of it is provided by the pre-built PYNQ-Z2 image which just requires downloading and the transfering onto a microSD card and inserting into the PYNQ-Z2 board.
One of the exercises in the PYNQ-Z2 Workshop demonstrated the ease of creating and testing a 3-bit down counter, and here I have modified this to create and test a 4-bit gray-code.
In addition, to installing the PYNQ-Z2 image onto the board, I looped four (of the twenty) Arduino header GPIO outputs (PYNQ-Z2 board has both Arduino and Raspberry Pi headers available) back to four inputs to allow the digital pattern to be generated and then captured and analyzed.
In a real world scenario, these could be connected to an external device allowing the Pattern Generator to be used as a stimulus to control an external circuit, and the Trace Analyzer to monitor it.
The Logictools overlay uses the WaveJSON waveform description format found in WaveDrom https://wavedrom.com/ and extends it to work with the Pattern Generator to create and render waveforms within the PYNQ framework.
First step is to setup the Logictools overlay and load the bitstream into the FPGA fabric. Then we create the WaveJSON string that defines the waveform to work with, along with the GPIO pins that the waveform will be output to and captured from.
I've added in the hex values for each state for annotation purposes.
Then we can render the waveform in a graphical format which makes it easier to interpret.
Note at this stage no analysis data has been captured so the lower half of the diagram contains no data.
We now set up the pattern generator, run it, and render out the results.
The lower half of the diagram now shows the analysis results captured from the GPIO loopback connection and matches the waveform being generated.
The analysis data can also be displayed in WaveJSON description format if need be...
….and can be be further annotated if required.
(Interesting to note that the implementation of WaveJSON format on PYNQ doesn't appear to support wave types '6', '7', '8', & '9'.)
This however merely scratches the surface of what can be achieved with the Logictools overlay. Much more background reading and experimentation required !