Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/sorting/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vector 从两个8位向量创建一个16位向量_Vector_Concatenation_Vhdl - Fatal编程技术网

Vector 从两个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);

我想从两个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);  
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".