dpaul
Advanced Member level 5
- Joined
- Jan 16, 2008
- Messages
- 1,860
- Helped
- 317
- Reputation
- 635
- Reaction score
- 354
- Trophy points
- 1,373
- Location
- Germany
- Activity points
- 13,474
Verify this IIC SDA/SCL connection (Verilog)
Hello,
I want to connect the o/p of an IIC master to external SDA and SCL. The o/p of the master IIC block has ports sda_i, sda_o, sda_t_i, and scl_i, scl_o, scl_t_i.
Given below is the connection sketch as I have visualised the connections.
I have written the tri-state logic in Verilog and is given below.
Can anyone confirm if my Verilog code will deliver the functionality required to connect the IIC master to the inout SDA and SCL?
Thanks in advance.
- - - Updated - - -
If the above is not the proper way to implent the SDA and SCL then what should be done?
Use a MUX, with sda_t_i being the output enable (the IIC master spec says that Sda_T is the "serial data o/p enable to 3-state buffer"; same for the Scl)?
Hello,
I want to connect the o/p of an IIC master to external SDA and SCL. The o/p of the master IIC block has ports sda_i, sda_o, sda_t_i, and scl_i, scl_o, scl_t_i.
Given below is the connection sketch as I have visualised the connections.
I have written the tri-state logic in Verilog and is given below.
Code:
module axi_iic_bi_di
(
// IIC master interface signals
// data
input wire sda_i, // IIC data in
output wire sda_o, // IIC data out
input wire sda_t_i, // Data control
//clock
input wire scl_i, // IIC clk input
output wire scl_o, // IIC clk output
input wire scl_t_i, // clock control
// IIC slave interface signals
inout wire Sda_io,
inout wire Scl_io
);
assign sda_o = Sda_io;
assign Sda_io = (sda_t_i == 1'b1) ? sda_i : 1'bz;
//pullup(Sda_io); // pullup done in TB
assign scl_o = Scl_io;
assign Scl_io = (scl_t_i == 1'b1) ? scl_i : 1'bz;
//pullup(Scl_io); // pullup done in TB
endmodule
Can anyone confirm if my Verilog code will deliver the functionality required to connect the IIC master to the inout SDA and SCL?
Thanks in advance.
- - - Updated - - -
If the above is not the proper way to implent the SDA and SCL then what should be done?
Use a MUX, with sda_t_i being the output enable (the IIC master spec says that Sda_T is the "serial data o/p enable to 3-state buffer"; same for the Scl)?
Last edited: