Vector 从两个8位向量创建一个16位向量
我想从两个8位向量创建一个16位向量,但有如下错误。如何解决Vector 从两个8位向量创建一个16位向量,vector,concatenation,vhdl,Vector,Concatenation,Vhdl,我想从两个8位向量创建一个16位向量,但有如下错误。如何解决 LIBRARY ieee; USE ieee.std_logic_1164.all; USE ieee.std_logic_arith.all; ENTITY Binary2Gray IS -- Declarations port(data : in STD_LOGIC_VECTOR (3 downto 0); data_out : inout STD_LOGIC_VECTOR (3 downto 0);
LIBRARY ieee;
USE ieee.std_logic_1164.all;
USE ieee.std_logic_arith.all;
ENTITY Binary2Gray IS
-- Declarations
port(data : in STD_LOGIC_VECTOR (3 downto 0);
data_out : inout STD_LOGIC_VECTOR (3 downto 0);
data1 : inout std_logic_vector (1 downto 0);
data2 : inout std_logic_vector (1 downto 0);
CLK_I : in std_logic;
y1 : out std_logic_vector (7 downto 0);
y2 : out std_logic_vector (7 downto 0);
op : out std_logic_vector (15 downto 0)
);
END Binary2Gray ;
-----------------------------
ARCHITECTURE rtl OF Binary2Gray IS
signal op : std_logic_vector (15 downto 0);
begin
process(CLK_I)
BEGIN
data_out(3) <=data(3);
data_out(2) <=data(3) xor data (2);
data_out(1) <=data(2) xor data (1);
data_out(0) <=data(1) xor data (0);
label_1: for data_out in 0 to 3 loop
if(data_out = 0 ) then
data1(0) <=data(1) xor data (0);
elsif (data_out = 1 ) then
data1(1) <=data(2) xor data (1);
elsif (data_out = 2 ) then
data2(0) <=data(3) xor data (2);
else
data2(1) <=data(3);
end if;
end loop label_1;
end process;
with data1 select y1 <=
"00110011" when "00",
"00111101" when "01",
"11010011" when "10",
"11011101" when others;
with data2 select y2 <=
"00110011" when "00",
"00111101" when "01",
"11010011" when "10",
"11011101" when others;
op <= y1 & y2 ;
END rtl;
在VHDL-2002(及更早版本)中,不允许读取像y1
和y2
,因此出现错误
可能的修复方法有:
- 将
和y1
声明为y2
端口buffer
- 创建中间信号
和y1_-sig
,其值和 将它们分配给y2_-sig
、y1
和y2
op
- 如果可能,在工具链中使用VHDL-2008
op
不应在输出端口时声明为信号。注
此外,该过程可能不会像预期的那样工作,因为它不是一个
由于缺少if rising_edge(CLK_I)则语句,或组合
由于灵敏度列表中缺少数据而导致处理。谢谢morten,我将y1和y2更改为缓冲器,并删除op中的信号,使其正常工作
# Error: ELAB1_0008: QAM.vhd : (56, 8): Cannot read output : "y1".
# Error: ELAB1_0008: QAM.vhd : (56, 8): Cannot read output : "y2".