我無法通過拆分reg_mem來更新reg_1和reg_2向量? 這是我在VHDL中的代碼,我寫在MODELSIM中: 在其他程序中,我試圖將另一個矢量拆分成兩個部分,並將它們存儲到兩個不同的Vectors.It工作正常。但相同的語法不在此代碼中工作無法在VHDL中拆分向量
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity Register_unit is
port (
reg_read : in std_logic;
reg_write : in std_logic;
reg_mem : inout std_logic_vector(3 downto 0);
reg_start : inout std_logic_vector(3 downto 0);
reg_end : inout std_logic_vector(3 downto 0);
reg_write_comp : out std_logic;
reg_read_comp : out std_logic;
reg_1 : inout std_logic_vector(1 downto 0);
reg_2 : inout std_logic_vector(1 downto 0));
end Register_unit;
architecture Register_unit_arch of Register_unit is
begin
process (reg_read,reg_write)
begin
if (reg_read = '1' and reg_write = '0') then
reg_end <= reg_mem;
reg_read_comp <= '1';
elsif (reg_write = '1' and reg_read = '0') then
reg_mem <= reg_start;
reg_write_comp <= '1';
end if;
reg_1 <= reg_mem(1 downto 0); --reg_1 is not getting updated
reg_2 <= reg_mem(3 downto 2); --reg2 is not getting updated
end process;
end Register_unit_arch;
靈敏度列表錯誤在非同步的過程。一個解決方案:將流程拆分到流程外部。另請閱讀http://stackoverflow.com/questions/13954193/is-process-in-vhdl-reentrant/13956532#13956532還要注意,沒有辦法重置'reg _ * _ comp'信號。 –