I'm finally getting around to doing my homework from session 3.  I decided to do a simple modification of adding an AXI4-Stream Switch so that I could select between video sources, in this case between the HDMI camera and the TPG (test pattern generator).


I started with the overlay from session 3 and added back the TPG and added an AXI4-Stream Switch.  Seems very straightforward but I encountered a problem that I didn't expect.  The TPG apparently only uses a single clock domain for the AXI control and the video generation.  That meant I had clock conflicts with the frontend implementation which was using a separate video clock and AXI control clock.  Luckily there is an AXI4-Stream Clock Converter that provides syncing across clock domains.  So I added one of those.


Here's the diagram showing the added parts:

I have two slave inputs into the Stream Switch and one master output.  The switch can handle 16 inputs and 16 outputs.


The frontend (HDMI camera) is Slave 0 (SI0) and the TPG is Slave 1 (SI1).


The register offset for the master 0 output (MI0) is 0x40.  The value in the register selects which input is used.


When testing it out I found something I hadn't expected - if I didn't configure the Stream Switch first - the frontend wouldn't start.  Had me baffled for a bit.


Here's the Jupyter notebook:


The color space matrix has an error that I corrected. (Should be a diagonal - fixed it for the video).


And a short video showing it operating: