Forum Discussion
---
## Solutions
### **Solution 1: Fix the DSP Source (Best Practice)**
Modify your DSP output interface so that `valid` remains asserted until `valid & ready = 1`:
```
If (data_available):
valid <= 1
data <= <packet_data>
Else If (valid & ready):
valid <= 0 // Only deassert after successful handshake
Else:
valid <= valid // Hold valid asserted
```
This is the protocol-compliant solution and requires no additional IP.
---
### **Solution 2: Add Input FIFOs (Practical for Complex DSP Pipelines)**
Insert an **Avalon Streaming FIFO** before each of your 32 DSP channels at the mux inputs:
```
DSP_Channel_0 --> [FIFO] --> 16-to-1 Mux Input 0
DSP_Channel_1 --> [FIFO] --> 16-to-1 Mux Input 1
...
DSP_Channel_31 --> [FIFO] --> 16-to-1 Mux Input 15 (Second group)
```
**Benefits:**
- The FIFO accepts your single-cycle pulse
- Holds `valid` asserted until the mux grants `ready`
- Completely decouples your DSP timing from the scheduler
- Adds minimal latency (typically 1–2 cycles per FIFO)
- Works with any scheduling configuration
**Configuration in Platform Designer:**
- FIFO depth: 16–32 (sufficient for burst absorption)
- Single-clock FIFO (matches your system clock domain)
- No packet support needed unless your DSP already uses it
---
### **Solution 3: Increase Scheduling Size (Mitigation Only)**
Increasing from Scheduling Size = 2 to a higher value (e.g., 8–16) gives each channel a longer arbitration window, but **does not solve the underlying protocol issue**. Your sources should still not pulse `valid` for a single cycle. This is a workaround, not a solution.
---
## Verification Approach
After implementing Solution 1 or 2, verify with SignalTap:
1. **At mux inputs**: Confirm that `valid` remains high until `valid & ready = 1` on the same cycle for all channels.
2. **At mux output**: Set trigger on rising edge of output `valid` for each channel and confirm triggers fire for all 32 channels.
3. **Data integrity**: Verify that packets from all channels contain correct channel IDs and data.
---
## Why Cascaded Muxes Don't Hide the Issue
Your 32-to-1 cascaded architecture is sound, but the scheduler starvation propagates through each stage:
- If channels 1–31 don't transfer at the first 16-to-1 mux stage, they never reach the second stage.
- The final 2-to-1 mux then only multiplexes channels from whichever group wins arbitration.
The data path to HPS works (proven by your emulator), so this is purely an input arbitration issue.
---
## So in summary
**Root Cause**: Your DSP sources violate the Avalon-ST protocol by pulsing `valid` for only 1 cycle. The mux scheduler cannot guarantee that `ready` will be presented during that 1-cycle window—especially for non-zero channels that must wait for scheduler rotation.
**Recommended Fix**: Add input FIFOs (Solution 2) for minimum disruption to your existing DSP logic. This is the standard approach for integrating DSP modules with streaming interconnect in Quartus designs.
**Expected Outcome**: All 32 channels will forward packets to the HPS correctly.
---
Do you notice that your replies are in MD format? Are they all AI-generated?