Forum Discussion
How to properly constrain bidirectional I2C SCL / SDA ports ?
Hi,
What about SCL as data?
there are some cases that use SCL as data, SDA as clock.
Do we make create_clock on SDA ? and input delay on SCL port with respect to SDA clock?
In I2C, SDA is never the clock and SCL is never data. The bus does not swap those roles.
create_clock on SDA + set_input_delay on SCL would only apply if a non-I2C design literally used the SDA pin as the capture clock of FPGA registers, and SCL as data into those registers, e.g.:
create_clock -name sda_clk -period <T> [get_ports {sda}]
set_input_delay -clock [get_clocks sda_clk] -max <placeholder> [get_ports {scl}]
set_input_delay -clock [get_clocks sda_clk] -min <placeholder> [get_ports {scl}]
That is generic source-synchronous / edge-clocked methodology. See AN433.
https://docs.altera.com/v/u/docs/653688/an-433-constraining-and-analyzing-source-synchronous-interfaces
AN 433 covers interfaces where the same device drives both clock and data, and the receiver captures data with that forwarded clock. That does not apply to I2C.
Regards,
Richard Tan
- M_Aboelnaga16 days ago
New Contributor
Actually It applies in my I3c design
I was asking about I2c just because i saw the question on I2C.
But my design yes checks on SCL as data ( while SCL is high) and capture with SDA rising edge ( to capture Stop Condition)
So, in this case : Is it normal to have 2 clocks and 2 input delays with swapped roles ( clock SCL with input delay on SDA , clock on SDA with input delay on SCL)? - RichardT_altera16 days ago
Super Contributor
I believe it is possible to have 2 clocks and 2 input delays with swapped roles.
You might need to constrain each capture relationship to the clock that actually clocks the flop (set_input_delay / -add_delay)
Expect Clock-As-Data behavior when the same pin is both clock and data.
https://docs.altera.com/r/docs/683243/26.3/quartus-prime-pro-edition-user-guide-timing-analyzer/clock-as-data-analysis
Use -add_delay when a port already has delays vs another clock.
Note that: Specifying an input delay on the same port for a different clock, -clock_fall or -reference_pin removes any previously set input delays, unless you specify the -add_delay option.
Regards,
Richard Tan- M_Aboelnaga15 days ago
New Contributor
but when I tried on quartus, it ignores the input delay i put because the same port as a clock defintion
- RichardT_altera8 days ago
Super Contributor
Could you share your design archive (Project → Archive Project) as a .qar file for further investigation?
If the design contains confidential information, you may send the .qar file to me via private message instead.
In addition, could you briefly describe your I3C design architecture or provide a simple block diagram? This will help me better understand the design and the data flow during my investigation.
Thank you.
Regards,
Richard Tan