inout口浅析--1

     首先让我们回顾一下tri-state logic gates,引自维基百科中的解释。

     Three-state, or 3-state, logic gates are a type of logic gates that have three states of the output: high (H), low (L) and high-impedance (Z).The high-impedance state plays no role in the logic, which remains strictly binary. These devices are used on buses also known as the Data Buses of the CPU to allow multiple chips to send data. A group of three-states driving a line with a suitable control circuit is basically equivalent to a multiplexer, which may be physically distributed over separate devices 。

     In electronics, High impedance would mean that the output is effectively disconnected from the circuit

     Synthesis of z (关于高阻状态综合后的结果) 

The z value implies high impedance or  an open circuit.  It is not a normal logic value and 

can only be synthesized by a tri-state bufer.The operation of  the buffer is controlled by an enable signal, oe (for "output enable").  

When  it is  1,  the input is passed to output.  On the other hand, when it is 0, the y output appears  to be an open circuit.

The code of  the tri-state buffer is assign  y  =  (oe)  ?  a-in  :  l'bz; 

2011050709464597.png

   tri-state buffer  最常见的应用就是用来描述,bidirectional ports。

  双向是分时复用,并不可以同时输入输出,因此它是单工的:也就是输

  入的时候,必须禁止输出使能;输出的时候,必须打开输出使能。

  注意:一般情况下,在子模块中,将双向口的拆分为输入和输出两个信号;最终只在顶层模块例化双向口。


     第一种描述 Inout口的方式

    2011050709512239.png

  即采用两个 tri-state buffer 来描述双向口

      将该模块看成一个介于 system和外设之间的模块,。

      信号说明:  

                data_to_bus是从sys来的想要输出到 data_bus上的数据。

                sdlink 是 tri-state buffer的控制信号.

                data_to_sys是从inout口data_inout接收到的外部数据总线的数据再传给sys的信号.

         当sdlink = 1时,可以认为此时CPU占据总线使用权,将要输出的数据通过 inout口 送到 数据总线上。而此时外设处于 输出高阻状态不占据总线使用权,所以

外设并没有输出数据到data_bus上,因此data_to_sys呈现高阻状态。

          综合后的RTL视图如下所示

           2011050710042645.png

      testbench文件如下(先做输出data到数据总线的验证)

2011050710143167.png

  仿真结果如下所示:

2011050710151072.png

     (再做从数据总线读回数据送sys).

  testbench部分文件如下所示,适当增加信号,例如用 io_data_reg模拟外部输入sys的总线数据.

2011050710240260.png

2011050710243242.png

   仿真结果如下所示:

2011050710254290.png

       第二种描述 inout口的方式

    2011050710274416.png

     即 单tri-state buffer描述bid--pors

   2011050710290685.png

    这两种方式都可用于 描述 现实中的 双向端口,尤其是在描述 双向数据端口的时候。

先说到这,以后再做补充.  如果有 论述 不对 的地方,还请大家帮忙指出。

QQ:117242951

  维基百科网址 http://en.wikipedia.org/wiki/Main_Page

转载于:https://www.cnblogs.com/whut-xxxy/archive/2011/05/07/2039638.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值