Skip to content

feat(tb): add write-ACK and ENTDAA handoff checks to I3C bus monitor - #148

Merged
clayton8 merged 4 commits into
chipsalliance:v1p5from
clayton8:v1p5-fix-ack-handoff-tb
Feb 27, 2026
Merged

clayton8 merged 4 commits into
chipsalliance:v1p5from
clayton8:v1p5-fix-ack-handoff-tb

Conversation

@clayton8

@clayton8 clayton8 commented Feb 26, 2026 •

Copy link
Copy Markdown
Collaborator

Fix a CCC write-ACK handoff violation (§5.1.2.3.1) where the Target held SDA driven beyond tSCO after write-direction ACKs, and add extensive protocol-level checking to the I3C
bus monitor.

RTL Fix

  • ccc.sv: TxTargetAddrAck defaulted req_type to RawBit and only overrode to AckHandoff on the SET→RxData path. Reserved-address and RSTACT paths kept RawBit, causing the Target
    to hold SDA beyond tSCO. Replace with a single derived expression: (addr_ack & ~target_rnw) ? AckHandoff : RawBit.

Bus Monitor Enhancements

Add spec-compliant protocol checks to i3c_bus_monitor.py:

  • Write-ACK handoff (§5.1.2.3.1): verify Target releases SDA within tSCO after write-direction ACK
  • IBI ACK→MDB transition (§5.1.2.3.2): verify Target takes over SDA in Push-Pull within tSCO
  • Read T-bit release (§5.1.2.3.4): verify Target releases SDA within tSCO after T-bit
  • Read T-bit PP mode (§5.1.2.3): verify Target drives T-bit in Push-Pull
  • ENTDAA phase tracking and checks (§5.1.4.2): OD mode for PID/BCR/DCR, DA handoff at bit 63, DA+PAR contention detection

TB Cleanup

  • Un-skip resolved IBI tests, add missing teardown() calls
  • Fix TTI monitor race condition (re-sample on next clock edge)
  • Promote bus monitor violations to test failures in teardown()
  • Remove stale bug markers and FIXME comments

@clayton8
clayton8 force-pushed the v1p5-fix-ack-handoff-tb branch 2 times, most recently from b30df87 to 0fad7c4 Compare February 27, 2026 00:14
Implement protocol-level handoff violation and drive mode detection per
MIPI I3C Basic v1.1.1 spec requirements:

Write-ACK Handoff (Check 5, S5.1.2.3.1):
  After write-direction ACK (RnW=0, SDA=0), schedule tSCO-precise check
  (max 12ns, Table 87 S6.2) to verify Target releases SDA to Hi-Z.
  Fires on directed writes and direct CCC SETs; skipped for broadcast
  ACKs and read-direction ACKs.

Read T-bit Release (Checks 8/9, S5.1.2.3.4, Figs 150-152):
  After T-bit SCL rising edge, schedule tSCO check for Target SDA
  release. Applies to both T=0 (end) and T=1 (continue) cases.

Read T-bit PP Mode (Check 13, S5.1.2.3):
  Verify Target drives T-bit in Push-Pull mode, not Open Drain.

ENTDAA Phase Tracking (S5.1.4.2):
  Detect ENTDAA CCC (0x07) and track 73-bit DAA data phase:
  bits 0-63 PID/BCR/DCR, bits 64-71 DA+PAR, bit 72 ACK/NACK.

ENTDAA OD Mode (Check 14, S5.1.4.2):
  Verify Target drives PID/BCR/DCR (bits 0-63) in Open Drain mode.

ENTDAA DA Handoff (Check 15, S5.1.2.5.4, Fig 23):
  At bit 63, schedule tSCO check for Target release before Controller
  drives DA[6]. During bits 64-71, verify DUT not driving SDA.
  Per Fig 25 legend, ACK/NACK at bit 72 is 'without Handoff'.

ENTDAA DA+PAR Contention (Check 16, S5.1.4.2 step 9):
  During Controller DA+PAR phase, verify Target is not driving.

Generic handoff mechanism uses _handoff_check_id and _handoff_spec_ref
for reuse across write-ACK, read T-bit, and ENTDAA handoffs. Pending
checks cleared on START/STOP detection.
@clayton8
clayton8 force-pushed the v1p5-fix-ack-handoff-tb branch from 0fad7c4 to aff6f93 Compare February 27, 2026 01:16
…d direction

The TxTargetAddrAck state in ccc.sv defaulted to RawBit and only
overrode to AckHandoff on the SET→RxData path. The reserved-address
(7E/W→NextCCC) and RSTACT (→WaitForBusCond) paths kept RawBit,
causing the Target to hold SDA driven beyond tSCO after write-direction
ACKs (spec §5.1.2.3.1 violation).

Replace the default+override pattern with a single derived expression:
  (addr_ack & ~target_rnw) ? AckHandoff : RawBit
This encodes the spec rule directly and prevents future CCC branches
from silently omitting the handoff.

@mkj121 mkj121 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One query about ENTDAA Sr driving

- test_i3c_target: remove fclk=100 from read_to_multiple_targets; the
  design's 2-FF synchronizer needs fclk≥250 MHz to meet tSCO≤12 ns
- test_ibi: un-skip test_ibi_multiple_arb_losses and
  test_ibi_flush_from_idle_interrupt_flood (underlying issues resolved)
- test_bypass, test_ibi: add missing await tb.teardown() calls
- i3c_bus_monitor: implement _on_ibi_ack_rise with OD-mode check and
  tSCO handoff scheduling for IBI ACK→MDB transition (§5.1.2.3.2)
- interface: call bus_monitor.check() during teardown instead of
  logging a warning
- tti_monitor: fix race condition — re-sample recovery_pending on next
  clock edge; replace broken not(FallingEdge(...)) guard with proper
  desc_w/data_w check; remove unused FallingEdge import
- recovery_interface: replace stale FIXME comments with accurate notes
  (PEC excludes address per design)
- test_ccc, test_i3c_target, test_ibi: remove "BLOCKED BY DESIGN BUG"
  markers, bug-file references, and RTL-bug explanations from
  docstrings and assertions (bugs resolved or tracked elsewhere)
@clayton8
clayton8 force-pushed the v1p5-fix-ack-handoff-tb branch from 64d9fbf to dafda5b Compare February 27, 2026 07:28
@mkj121

mkj121 commented Feb 27, 2026 via email

Copy link
Copy Markdown
Collaborator

Comment thread src/ctrl/ccc.sv Resolved
Comment thread src/ctrl/ccc.sv Resolved
@clayton8
clayton8 merged commit e8c58a0 into chipsalliance:v1p5 Feb 27, 2026
49 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants