集成电路技术分享

 找回密码
 我要注册

QQ登录

只需一步,快速开始

搜索
查看: 4978|回复: 12

我做了一个双向缓冲器,仿真的时候不对,大家帮忙看看

[复制链接]
AAT 发表于 2010-6-28 00:18:38 | 显示全部楼层 |阅读模式
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;

ENTITY TRIGATE IS
PORT
(
ADDR1:INOUT STD_LOGIC_VECTOR(7 DOWNTO 0);
ADDR2:INOUT STD_LOGIC_VECTOR(7 DOWNTO 0);
DIRR:IN STD_LOGIC;   --控制读时,addr1为输出,addr2为输入
DIRW:IN STD_LOGIC   --控制读时,addr2为输出,addr1为输入

);
END TRIGATE;

ARCHITECTURE A OF TRIGATE IS
BEGIN
PROCESS(DIRR,DIRW)
BEGIN
IF(DIRR='0')THEN
ADDR1 <= ADDR2;
ELSIF(DIRW='0')THEN
ADDR2 <= ADDR1;
END IF;
END PROCESS;
END A;
inter 发表于 2010-6-28 00:41:12 | 显示全部楼层
你这样写好像不行,双向端口若作输入时,其输出特性要表现为高阻,才能接收信号。<br>
还不如用原理图来的方便。
CTT 发表于 2010-6-28 02:01:23 | 显示全部楼层
原帖由 summerxyh 于 2007-2-28 15:29 发表<br>
你这样写好像不行,双向端口若作输入时,其输出特性要表现为高阻,才能接收信号。<br>
还不如用原理图来的方便。 PROCESS(DIRR,DIRW)<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;BEGIN<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;IF(DIRR='0')THEN <br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; ADDR1 &lt;= ADDR2;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; ADDR2&lt;="ZZZZZZZZ";<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;ELSIF(DIRW='0')THEN<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; ADDR2 &lt;= ADDR1;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;ADDR1&lt;="ZZZZZZZZ";<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;END IF;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;END PROCESS;
FFT 发表于 2010-6-28 02:26:15 | 显示全部楼层
这样的描述肯定不对,综合的结果大概是2个8位的寄存器。<br>
因为你这里的条件句对于ADDR1 和&nbsp;&nbsp;ADDR2来说都是不完整的,所以会被综合成为寄存器。<br>
<br>
改成这样就可以了。LIBRARY IEEE;<br>
USE IEEE.STD_LOGIC_1164.ALL;<br>
<br>
ENTITY TRIGATE IS<br>
PORT<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;(<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; ADDR1:INOUT STD_LOGIC_VECTOR(7 DOWNTO 0);<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; ADDR2:INOUT STD_LOGIC_VECTOR(7 DOWNTO 0);<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; DIRR:IN STD_LOGIC;&nbsp; &nbsp;&nbsp;&nbsp;--控制读时,addr1为输出,addr2为输入<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; DIRW:IN STD_LOGIC&nbsp; &nbsp;&nbsp;&nbsp;--控制读时,addr2为输出,addr1为输入<br>
<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;);<br>
END TRIGATE;<br>
<br>
ARCHITECTURE A OF TRIGATE IS<br>
BEGIN <br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbspROCESS(DIRR,DIRW)<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;BEGIN<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;IF(DIRR='0')THEN <br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; ADDR1 &lt;= ADDR2;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; ADDR2 &lt;= (others =&gt; 'Z');<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;ELSIF(DIRW='0')THEN<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; ADDR2 &lt;= ADDR1;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; ADDR1 &lt;= (others =&gt; 'Z');<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ELSE<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; ADDR1 &lt;= (others =&gt; 'Z');<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; ADDR2 &lt;= (others =&gt; 'Z');<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;END IF;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;END PROCESS;<br>
END A; <br>
[ 本帖最后由 dianzi 于 2007-2-28 17:04 编辑 ]
CHANG 发表于 2010-6-28 02:31:05 | 显示全部楼层
收下,我验证一下!谢谢大家
usd 发表于 2010-6-28 03:31:06 | 显示全部楼层
斑竹。只记的这么是给addr1附为高阻态,但是忘记是该那个OTHERS到底是怎么解读的了。ADDR1 &lt;= (others =&gt; 'Z');万望不吝赐教。
ATA 发表于 2010-6-28 04:26:52 | 显示全部楼层
others&nbsp;&nbsp;是不是在有条件或者选择语句的地方都可以用?<br>
我记得if 是和 else一起用的
CTT 发表于 2010-6-28 06:14:39 | 显示全部楼层
ADDR1 &lt;= (others =&gt; 'Z');意思是对ADDR1总线的各位均为高阻,这是一种简写,对位数比较多的时候就比较有用。
usd 发表于 2010-6-28 07:46:20 | 显示全部楼层
原帖由 summerxyh 于 2007-3-1 15:15 发表<br>
ADDR1 &lt;= (others =&gt; 'Z');意思是对ADDR1总线的各位均为高阻,这是一种简写,对位数比较多的时候就比较有用。 说得很对,<br>
<br>
其实你写成&nbsp;&nbsp;ADDR2 &lt;= "'ZZZZZZZZ";&nbsp;&nbsp;也完全一样.
usd 发表于 2010-6-28 08:30:47 | 显示全部楼层
学习<br>
学习到很多东东
您需要登录后才可以回帖 登录 | 我要注册

本版积分规则

关闭

站长推荐上一条 /1 下一条

QQ|小黑屋|手机版|Archiver|fpga论坛|fpga设计论坛 ( 京ICP备20003123号-1 )

GMT+8, 2025-4-4 08:18 , Processed in 0.063337 second(s), 19 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表