阅读:8636回复:5
std_logic_vector和整数怎么相加?(10分)
刚刚学习VHDL,看到书上说加上
use ieee.numeric_std.all; 就可以对std_logic_vector使用加法运算了,可是我使用了之后还是编译不了,哪位指教一下?谢谢啦!! 附:VHDL代码: signal ref_timer: std_logic_vector(8 downto 0) ... synchronous: process(reset, clk) begin if reset = \'1\' then ref_timer <= (others => \'0\'); elsif clk\'event and clk = \'1\' then if(ref_timer = \"100111000\" ) then ref_timer <= ref_timer + 1; end if; end if; end process; quartus编译错误: VHDL error at DRAM.vhd(84): can\'t determine definition of operator \"+\" -- found 0 possible definitions |
|
|
沙发#
发布于:2003-11-27 16:34
signal ref_timer:integer range 0 to 511
|
|
板凳#
发布于:2003-11-27 16:42
加上:
library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; 就好了! |
|
地板#
发布于:2003-11-27 16:45
signal ref_timer: std_logic_vector(8 downto 0);
... synchronous: process(reset, clk) begin if reset = \'1\' then ref_timer <= (others => \'0\'); elsif clk\'event and clk = \'1\' then if(ref_timer = \"100111000\" ) then ref_timer<=\"000000000\"; ---加上去 else ref_timer <= ref_timer + 1; end if; end if; |
|
地下室#
发布于:2003-12-02 15:41
加上:
library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; 就好了! 我也是这样认为。 |
|
5楼#
发布于:2003-12-31 10:27
我将以上的程序在MAXPLUS2中做了仿真,基本是对的,但发现有毛刺,从书上看,这个程序最终输出应该是经过了时钟同步的,不应该有毛刺的,不知道为什么
|
|
|