Skip to content

Add proper control of SDA drive mode - #125

Merged
clayton8 merged 5 commits into
chipsalliance:v1p5from
glaserf:sda-od-pp-pr
Feb 6, 2026
Merged

clayton8 merged 5 commits into
chipsalliance:v1p5from
glaserf:sda-od-pp-pr

Conversation

@glaserf

@glaserf glaserf commented Feb 2, 2026 •

Copy link
Copy Markdown
Collaborator

This PR implements dynamic control of the drive mode of the SDA pad for the various parts of the I3C protocol, including the handoff special cases with mid-bit changes.

Furthermore, the drive mode signal is now taken directly from a register without any further logic.

Finally, this PR hard-wires the I3C Target Device to the pads.

@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.

There are still some unresolved comments of mine

@glaserf
glaserf force-pushed the sda-od-pp-pr branch 4 times, most recently from 1a0e5df to 3381e0b Compare February 5, 2026 13:58
Refactor the interface to no longer encode the request types as one-hot
but valid/value pair. Also, prepare for many more request types other
than Bit/Byte/IBI.

Signed-off-by: Florian Glaser <glaserf@lowrisc.org>
@glaserf
glaserf force-pushed the sda-od-pp-pr branch 4 times, most recently from 06069a0 to af1cb5e Compare February 5, 2026 17:50
@glaserf
glaserf marked this pull request as ready for review February 5, 2026 17:51
@glaserf
glaserf requested review from clayton8 and mkj121 February 5, 2026 17:52
Comment thread src/ctrl/bus_tx_flow.sv Resolved

@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.

Minor comments only - very good

Comment thread src/ctrl/bus_tx_flow.sv Resolved
Comment thread src/ctrl/bus_tx_flow.sv Resolved
Comment thread src/ctrl/bus_tx_flow.sv Resolved
Comment thread src/ctrl/bus_tx_flow.sv Resolved
Comment thread src/ctrl/descriptor_tx.sv Outdated
end else if (tti_tx_desc_queue_rready_o) begin
tx_descriptor <= tti_tx_desc_queue_rdata_i;
descriptor_valid <= 1'b1;
end else if (tx_abort_i || recovery_mode_enter_i) begin

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.

Is this the correct precedence? I was thinking that an abort had higher precedence than the queue being ready

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

You are right, the precedence is kept through the convoluted computation of tti_tx_desc_queue_rready_o, which stays zero if descriptor_valid is one, which is only set to zero on completion or abort of the transaction.
Note that I have only really done a reformatting of the code here. I suggest that we try to change that and keep it in the more logical way if it does not break anything (as I would expect).

Comment thread src/ctrl/bus_tx_flow.sv Resolved
Comment thread src/ctrl/bus_tx_flow.sv Resolved
Comment thread src/ctrl/i3c_target_fsm.sv Resolved
@glaserf
glaserf force-pushed the sda-od-pp-pr branch 5 times, most recently from 75cc94b to 7d2e877 Compare February 6, 2026 14:23
As per Sect. 5.1.2.3.2 of the spec; start to drive SDA low in PushPull
mode on SCL rising edge of the ACK bit in case the target sees an ACK by
the controller.

Signed-off-by: Florian Glaser <glaserf@lowrisc.org>

@glaserf glaserf left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Thanks for your positive feedback! See below for my responses.

Comment thread src/ctrl/bus_tx_flow.sv Resolved
Comment thread src/ctrl/bus_tx_flow.sv Resolved
Comment thread src/ctrl/bus_tx_flow.sv Resolved
Comment thread src/ctrl/descriptor_tx.sv Outdated
end else if (tti_tx_desc_queue_rready_o) begin
tx_descriptor <= tti_tx_desc_queue_rdata_i;
descriptor_valid <= 1'b1;
end else if (tx_abort_i || recovery_mode_enter_i) begin

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

You are right, the precedence is kept through the convoluted computation of tti_tx_desc_queue_rready_o, which stays zero if descriptor_valid is one, which is only set to zero on completion or abort of the transaction.
Note that I have only really done a reformatting of the code here. I suggest that we try to change that and keep it in the more logical way if it does not break anything (as I would expect).

Comment thread src/ctrl/i3c_target_fsm.sv Resolved
Comment thread src/ctrl/bus_tx_flow.sv Resolved
Comment thread src/ctrl/bus_tx_flow.sv Resolved
Comment thread src/ctrl/bus_tx_flow.sv Resolved
This commit implements the two missing special cases for mid-bit drive
mode handling for the SDA pad, which are
1) Releasing SDA to high-Z mid bit on a write ACK (Sect. 5.1.2.3.1)
2) Using the Tbit after a byte of a private read to end or continue
   the read, from both target and controller side (Sect. 5.1.2.3.4).
   This special case is by far the most complex one.

Refer to the relevant Sections of the v1.1.1 I3C specification for
further information.
- Remove the sda_oe comb logic to bus_tx_flow and put it behind a
  register
- Hard-wire the I3C Target device to the pads for de-risking

Signed-off-by: Florian Glaser <glaserf@lowrisc.org>
@clayton8
clayton8 merged commit 9145331 into chipsalliance:v1p5 Feb 6, 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