SystemC-Components icon indicating copy to clipboard operation
SystemC-Components copied to clipboard

Add APB examples and fix APB pin level adapters

Open JingJerYen opened this issue 3 months ago • 3 comments

I initially added an example for APB, but later found that the test didn’t work correctly due to several bugs. So I rewrote it to fix those issues.

Fix details:

  1. Strobe signals were not handled properly — only consecutive 0xFF values were considered, but the APB spec does not guarantee they are contiguous.

  2. A deadlock occurred due to a missing generic payload free.

  3. Removed unused variables, redundant code, and replaced wait(1_ps) with wait(SC_ZERO_TIME).

The waveform below shows the correct behavior after applying this patch.

apb

JingJerYen avatar Oct 12 '25 14:10 JingJerYen

@JingJerYen THX for the PR. I need to review the code in more detail as these are significant changes. Did you run it with a verilated design? Or coupled with a Verilog simulator?

eyck avatar Oct 16 '25 05:10 eyck

For this PR, I didn't run it with any RTL-level design. I just added the examples and found they didn't work, so I tried to fix the pin-level adapters. And the waveform was produced by examples/apb.

I can add some comments on the code to explain some parts of the commit

JingJerYen avatar Oct 17 '25 02:10 JingJerYen

螢幕擷取畫面 2025-10-17 165226 I've verified this patch using my company's Verilated CPU IP. The waveform is identical and correct before and after applying the patch, but the simulation speed is much slower before the patch when collecting waveform. I guess this is caused by the wait(1_ps) statement?

JingJerYen avatar Oct 18 '25 02:10 JingJerYen

As written earlier there were issues in other cases. Therefore I made the PSTRB/byte enable handling configurable using a cci_param.

eyck avatar Dec 08 '25 13:12 eyck