Hello!
I am new in verilog and I begin working on I2C protocol hardware implementation
The master code works well
but when I combine all files together the master code does not work as it was
"sda_reg" is the problem and I do not know what I did wrong
the top code
Hello, FvM!
In the first image, "enable" signal was = 1. So sda = sda_reg and that works
In the second image, "enable" signal was = 1. sda should = sda_reg but this is not happening
When "enable" =0, the master will read from the slave (acknowledge bit)
I managed this piece in my code, but I can not see the result because of this don't care in my simulation
If you want the master code, please inform me and I will edit the post
Thanks!
The code for driving the tristate at the output should be in this form:
assign sda = (sda_low) ? 1'b0 : 1'bz;
One point of confusion I suspect: when sda is being 'driven' to z it will still 'read' 1 or 0 for the purpose of the rest of your code depending on the pin's actual state.