Prev Problem
Next Problem

23. Open-Drain I2C SDA line

Back To All Submissions
Previous Submission
Next Submission

Solving Approach

Since we initiate the sda as tr1, it is by default 1. In case drive_low is 1, sda becomes 0 and in case drive_low is 0, sda becomes high impedance, releasing the line and hence defaulting to 1 as per tr1 initialisation.

 

 

Code

/*Write your code here*/
module i2c_line (
    input drive_low,
    output tri1 sda
);
    // tr1 t1; 
    assign sda = drive_low? 1'b0 : 1'bz;
endmodule
Was this helpful?
Upvote
Downvote