在线咨询
eetop公众号 创芯大讲堂 创芯人才网
切换到宽版

EETOP 创芯网论坛 (原名:电子顶级开发网)

手机号码,快捷登录

手机号码,快捷登录

找回密码

  登录   注册  

快捷导航
搜帖子
查看: 1975|回复: 3

[求助] 关于控制总线信号时序的HDL描述问题!

[复制链接]
发表于 2013-5-4 22:52:30 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

x
关于控制总线信号的VHDL描述我目前知道的两种方法,方法如下:

                      第一种:commond_cnt是一个按输入时钟为源的计数器,按照控制信号的时序顺序来依次给信号赋值法:
                                         case commond_cnt is

when x"0fa2" =>      --enable the control signal

iodir_reg<='1';  --output

ale_reg<='0';

cle_reg<='1';

we_reg<='0';

wp_reg<='1';

re_reg<='1';

databusout_reg<=x"70";

cs_out_reg<=(others=>'0');



when x"0fa4"=>

we_reg<='1';           --input the read status commond



when x"0fb0"=>

cle_reg<='0';
--
databusout_reg(7 downto 0)<=x"70";  --input the read_status commond

cs_out_reg<=(0=>'0',others=>'1');   --just enable the cs1 chip;
--
we_reg<='0';
--
when x"0fb3" =>
--
    we_reg<='1';

when x"0fb8"=>     --read the status byte

iodir_reg<='0';               --change the dir of the port to input
--
cle_reg<='0';

    when x"0fbf"=>

re_reg<='0';                  --falling edge of the re to capture the status byte

when x"0fd0"=>

iodir_reg<='1';  --output

re_reg<='1';

    第二种:根据各个时间点,各信号的电平情况单独赋值:

   
if(cnt=x"0001" or cnt=x"0005") then

      
cle<='1';

   
else

      
cle<='0';

   
end if;


   
if(cnt>x"1" and cnt<x"0005") then

     
ale<='1';

  
else

      
ale<='0';

   
end if;


   
if(cnt>x"0000" and cnt<x"0006")then

     
flag_we:=not flag_we;

      
we<=not flag_we;

else

     
we<='1';

   
end if;


想问一下到底该用哪种方法呢?这两种方法有什么区别?我是觉得第一种方法可读性强一些;
 楼主| 发表于 2013-5-5 10:46:30 | 显示全部楼层
自己顶一下!
发表于 2013-5-5 14:53:19 | 显示全部楼层
比较代码质量无非几个参数:代码健壮性,使用的资源多少,可读性,可扩展性。
要是你前面的都没问题,可读性与可扩展性就比较重要。
 楼主| 发表于 2013-5-5 15:20:23 | 显示全部楼层
回复 3# eaglelsb


   第一种资源用得少啊
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

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

X

小黑屋| 手机版| 关于我们| 联系我们| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2025-6-18 11:14 , Processed in 0.018276 second(s), 9 queries , Gzip On, MemCached On.

eetop公众号 创芯大讲堂 创芯人才网
快速回复 返回顶部 返回列表