Prev Problem
Next Problem

23. Open-Drain I2C SDA line

Back To All Submissions
Previous Submission
Next Submission

Solving Approach

How do you plan to solve it?

 

 

Code

// Module: i2c_line
// Function: Models an open-drain I2C SDA line using tri1
// When drive_low = 1 → line pulled LOW
// When drive_low = 0 → line released (pulled HIGH through tri1)

module i2c_line (
    input  drive_low,   // 1 = pull low, 0 = release
    output tri1 sda     // tri1 means line is HIGH when undriven
);

    assign sda = (drive_low) ? 1'b0 : 1'bz; // Pull low or release

endmodule
Was this helpful?
Upvote
Downvote