[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: gEDA-user: OT: (Vhdl help)



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;

-- 
Ben Jackson AD7GD
<ben@xxxxxxx>
http://www.ben.com/


_______________________________________________
geda-user mailing list
geda-user@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user