关于vhdl—— case when后面的赋值语句不更新的问题 ?
时间:10-02
整理:3721RD
点击:
library ieee;
use ieee.std_logic_1164.all;
entity getdata is
port (
DATA_IN : in bit_vector(15 downto 0);//数据输入
CLK_IN : in std_logic;//时钟
DATA_OUTT : out bit_vector(47 downto 0);
DATA_OUTID : out bit_vector(15 downto 0);
EN : out std_logic;
EN1 : out std_logic
);
end getdata;
architecture bhv of getdata is
type DATA_PROCESS_STATES is (DATA3,DATA2,DATA1,DATA0);
signal DATA_PROCESS_STATE : DATA_PROCESS_STATES :=DATA3;
begin
process (DATA_IN,CLK_IN)
variable BISS_DATA : bit_vector (47 downto 0);
variable CP_DATA : bit_vector (15 downto 0);
begin
if (CLK_IN'event and CLK_IN='1') then
case DATA_PROCESS_STATE is
when DATA3 =>
EN1
EN
BISS_DATA(31 downto 16) := DATA_IN;
DATA_COUT := DATA_COUT + 1;
DATA_PROCESS_STATE
BISS_DATA(15 downto 0) := DATA_IN;
DATA_COUT := DATA_COUT + 1;
DATA_OUTT null;
end case;
end if;
end process;
end bhv;
每次编译6分钟,调试到我爆炸了,用signaltap仿真有BISS_DATA收到的数据、没有CP_DATA的数据,一直是0x0000 。要放弃了
use ieee.std_logic_1164.all;
entity getdata is
port (
DATA_IN : in bit_vector(15 downto 0);//数据输入
CLK_IN : in std_logic;//时钟
DATA_OUTT : out bit_vector(47 downto 0);
DATA_OUTID : out bit_vector(15 downto 0);
EN : out std_logic;
EN1 : out std_logic
);
end getdata;
architecture bhv of getdata is
type DATA_PROCESS_STATES is (DATA3,DATA2,DATA1,DATA0);
signal DATA_PROCESS_STATE : DATA_PROCESS_STATES :=DATA3;
begin
process (DATA_IN,CLK_IN)
variable BISS_DATA : bit_vector (47 downto 0);
variable CP_DATA : bit_vector (15 downto 0);
begin
if (CLK_IN'event and CLK_IN='1') then
case DATA_PROCESS_STATE is
when DATA3 =>
EN1
EN
BISS_DATA(31 downto 16) := DATA_IN;
DATA_COUT := DATA_COUT + 1;
DATA_PROCESS_STATE
BISS_DATA(15 downto 0) := DATA_IN;
DATA_COUT := DATA_COUT + 1;
DATA_OUTT null;
end case;
end if;
end process;
end bhv;
每次编译6分钟,调试到我爆炸了,用signaltap仿真有BISS_DATA收到的数据、没有CP_DATA的数据,一直是0x0000 。要放弃了
VHDL忘得差不多了..在下说一下我的观点..可能原因:
signal DATA_PROCESS_STATE : DATA_PROCESS_STATES :=DATA3
小编在这里只在这里对signal设定初值..但实际综合后有没有效我不是很确定..
可以尝试加一个复位信号,激活复位信号并让DATA_PROCESS_STATE确切回到DATA3的状态:
porcess(DATA_IN,CLK_IN,RST)
……
if RST='0' THEN DATA_PROCESS_STATES<=DATA3;
elseif CLK_IN'event and CLK_IN='1' THEN
……
试一下,可能是这样。不对的话坐等大神
我去试试看111111111
其实你是怀疑没有跑到DATA3状态,但是我用一个i变量测试它让它跑500次DATA3状态再进入下一状态,用signaltap检测到已经在DATA3状态下i=500了,进去DATA3状态应该不是问题的。