conv_integer
은 std_logic_vector
을 integer
으로 변환합니다. 해당 integer
을 std_logic_vector
에 할당 할 수 없습니다. add
에 int
또는 x
을 할당하려는 경우 왜 conv_integer
을 사용 하시겠습니까? conv_integer
은 사용하지 않아야 비 표준화 된 패키지 std_logic_arith
또는 std_logic_unsigned
의 일부임을 유의하시기 바랍니다 : 그들은
더 중요한 것은 ... 모두 같은 유형입니다. 대신 표준 패키지 numeric_std
에서 to_integer(unsigned(...))
을 사용해야합니다.
FPGA 용 RAM을 구현할 때는 FPGA 제조업체 안내서를 참조해야합니다. Xilinx Synthesis User Guide
-- Single-Port RAM with Asynchronous Read (Distributed RAM)
-- File: rams_dist.vhd
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity rams_dist is
port(
clk : in std_logic;
we : in std_logic;
a : in std_logic_vector(5 downto 0);
di : in std_logic_vector(15 downto 0);
do : out std_logic_vector(15 downto 0)
);
end rams_dist;
architecture syn of rams_dist is
type ram_type is array (63 downto 0) of std_logic_vector(15 downto 0);
signal RAM : ram_type;
begin
process(clk)
begin
if (clk'event and clk = '1') then
if (we = '1') then
RAM(conv_integer(a)) <= di;
end if;
end if;
end process;
do <= RAM(conv_integer(a));
end syn;
에서 예를 들어 ... 음, 쓰레기 .... 자일링스는 또한 잘못된 변환 기능을 사용하고 있습니다. 의 표준화 된 코드에 그것을 다시 보자 (비 표준 라이브러리에서 제공) int``당신의 선언과 호환되지 않는 뭔가를 반환
-- Single-Port RAM with Asynchronous Read (Distributed RAM)
-- File: rams_dist.vhd
library ieee;
use ieee.std_logic_1164.all;
entity rams_dist is
port(
clk : in std_logic;
we : in std_logic;
a : in std_logic_vector(5 downto 0);
di : in std_logic_vector(15 downto 0);
do : out std_logic_vector(15 downto 0)
);
end rams_dist;
architecture syn of rams_dist is
use ieee.numeric_std.all;
type ram_type is array (2**a'length-1 downto 0) of std_logic_vector(di'length-1 downto 0);
signal RAM : ram_type := (others => (others => '0')); -- let's initialize it at zeros
begin
ram_proc: process(clk)
begin
if rising_edge(clk) then
if we = '1' then
RAM(to_integer(unsigned(a))) <= di;
end if;
end if;
end process;
do <= RAM(to_integer(unsigned(a)));
end syn;
'때문에 conv_integer'합니다. 재미있게도'int'와'add'를 같은 타입으로 선언 했으므로 변환하지 않고 할당하십시오. 또는 텍스트 줄이 쓸모 없게 만들었으므로이 줄을 모두 삭제하십시오. –
코드를 읽고 이해할 수 있도록 코드를 들여 씁니다. – Paebbels