On Thu, 2008-06-26 at 14:56 -0700, Ben Jackson wrote: > On Thu, Jun 26, 2008 at 07:47:57PM +0100, Peter Clifton wrote: > > > > -- I2C bus signals > > sda : inout std_logic; > > scl : inout std_logic; > > > > So.. my total NOOB question.. when I make a symbol for that, and > > instantiate it in my schematic, exactly how to I hook up those signals > > to a bi-directional IO buffer. > > > > The IOBUF has explicit I, O and T (direction) connections. > > The point of that is to work around the quirks of 'inout' ports in a > format where only uni-directional assignments are possible. Essentially > (to convert to Verilog for the example): > > assign PIN = T ? O : 1'bZ; > assign I = PIN; > > so whenever 'T', PIN is connected to 'O', otherwise it's tristate. The > input 'I' is always whatever is on PIN (which, when T, is going to be your > own O). > > In the case of I2C where you only want inputs and pulldowns, 'O' is always > 0 (zero) and T should be true when you want to pull down. My own i2c > module has inputs sda, scl and outputs sda_pull and scl_pull. At the top > level they're connected like: > > assign SDA_PIN = sda_pull ? 0 : 1'bZ; > assign sda = SDA_PIN;
This is similar to the code in the Xilinx I2C entity. When I try to assign from the input port of the IOBUF using similar code, I just end up getting this error. http://www.xilinx.com/support/answers/14264.htm It amusingly suggests that this error can be ignored in some cases, but due to the fact it stops synthesis, it seems not!. The SDA pin should be driven to '0' or 'Z' by the I2C module. It will be driven to '0' or 'Z' by the block of VHDL interfacing between the IOBUF and the INOUT port of the I2C controller. I've hacked Xilinx's I2C example code to use separate input and output ports now.. still... might be a while before I can make the thing work! -- Peter Clifton Electrical Engineering Division, Engineering Department, University of Cambridge, 9, JJ Thomson Avenue, Cambridge CB3 0FA Tel: +44 (0)7729 980173 - (No signal in the lab!) _______________________________________________ geda-user mailing list [email protected] http://www.seul.org/cgi-bin/mailman/listinfo/geda-user

