打印

请高手看看这段VHDL的错误

[复制链接]
1322|1
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
sdnd2000|  楼主 | 2007-5-12 16:28 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
用VHDL写的8位比较器,麻烦大家帮小弟找找错误,用MAXPLUS2编译的,好像应该是数据类型不对吧,但我不会改,大家看看吧

library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity compare is
port( a,b: in  std_logic_vector( 7 downto 0);
    d,e,f: out integer range 1 downto 0);
end entity compare;

architecture behave of compare is
begin
process(a,b)
variable m: integer range 7 downto 0;
variable n: integer range 7 downto 0;
begin
  m:= conv_integer(a);
  n:= conv_integer(b);
if m=n then d<='1';
elsif m>n then e<='1';
elsif n>m then f<='1';
end if; 
end process;
end architecture behave;

相关帖子

来自 2楼
picklas| | 2007-5-12 17:33 | 只看该作者

re

因为没看到具体的错误提示,只能猜测了
1 conv_integer是不是实现 std_logic_vector向integer的转化,我记不清了
2 conv_integer两边的数据范围不匹配 8bit std_logic_vector的数据范围-128~+128 或 0-256 ,0-7的范围不够。

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

13

主题

17

帖子

0

粉丝