集成电路技术分享

 找回密码
 我要注册

QQ登录

只需一步,快速开始

搜索
查看: 3371|回复: 3

初学者请教高手帮我看下程序

[复制链接]
likefeng24 发表于 2011-4-12 21:56:42 | 显示全部楼层 |阅读模式
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
USE IEEE.STD_LOGIC_UNSIGNED.ALL;
ENTITY biaoding IS
PORT( rst,up,down: IN BIT;
      DA: OUT STD_LOGIC_VECTOR(11 DOWNTO 0));
END biaoding;

ARCHITECTURE bEhAv OF biaoding IS
BEGIN
PROCESS(rst,up,down)
VARIABLE Q:STD_LOGIC_VECTOR(11 DOWNTO 0);
VARIABLE A:STD_LOGIC_VECTOR(3 DOWNTO 0);
BEGIN
IF( rst='1' )THEN A:="0101";
ELSIF( up'EVENT AND up='1')THEN A:=A+1;
ELSIF( down'EVENT AND down='1' )THEN A:=A-1;
END IF;

case A IS
WHEN "0000"=> Q:="000000001000";
WHEN "0001"=> Q:="000110100000";
WHEN "0010"=> Q:="001100111000";
WHEN "0011"=> Q:="010011010000";
WHEN "0100"=> Q:="011001101000";
WHEN "0101"=> Q:="100000000000";
WHEN "0110"=> Q:="100110011000";
WHEN "0111"=> Q:="101100110000";
WHEN "1000"=> Q:="110011001000";
WHEN "1001"=> Q:="111001100000";
WHEN "1010"=> Q:="111111110111";
WHEN OTHERS=> NULL;
END case;
      da <= Q ;
END PROCESS;
END bEhAv;


程序编译时总是提示错误Process clocking is too complex
请帮我指出问题,谢谢。
hng1123 发表于 2011-4-13 21:52:23 | 显示全部楼层
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
USE IEEE.STD_LOGIC_UNSIGNED.ALL;
ENTITY biaoding IS
PORT( rst,up,down: IN BIT;
      DA: OUT STD_LOGIC_VECTOR(11 DOWNTO 0));
END biaoding;

ARCHITECTURE bEhAv OF biaoding IS
signal A:STD_LOGIC_VECTOR(3 DOWNTO 0);


BEGIN
PROCESS(rst,up,down)
VARIABLE Q:STD_LOGIC_VECTOR(11 DOWNTO 0);

BEGIN
IF( rst='1' )THEN A <= "0101";
ELSIF( up='1')THEN A <= A+1;
ELSIF( down='1' )THEN A <= A-1;
END IF;

case A IS
WHEN "0000"=> Q:="000000001000";
WHEN "0001"=> Q:="000110100000";
WHEN "0010"=> Q:="001100111000";
WHEN "0011"=> Q:="010011010000";
WHEN "0100"=> Q:="011001101000";
WHEN "0101"=> Q:="100000000000";
WHEN "0110"=> Q:="100110011000";
WHEN "0111"=> Q:="101100110000";
WHEN "1000"=> Q:="110011001000";
WHEN "1001"=> Q:="111001100000";
WHEN "1010"=> Q:="111111110111";
WHEN OTHERS=> NULL;
END case;
      da <= Q ;
END PROCESS;
END bEhAv;



这样就可以了
soberoy 发表于 2011-5-15 01:02:47 | 显示全部楼层
额。。。第一段两个clock,第二段又没有clock。。。
wangjinzeng 发表于 2011-5-30 15:32:33 | 显示全部楼层
ELSIF( up'EVENT AND up='1')THEN A:=A+1;
ELSIF( down'EVENT AND down='1' )THEN A:=A-1;

这里两个信号都取沿(event)重复,建议将up,down信号改为一般使能输入,再引入系统时钟clk。另外,程序的其他地方还存在错误
您需要登录后才可以回帖 登录 | 我要注册

本版积分规则

关闭

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

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

GMT+8, 2024-12-26 03:16 , Processed in 0.059315 second(s), 24 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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