Altera_Forum
Honored Contributor
17 years agoWhen to deassert a signal?
I have a problem where I need to check a bit stream to see if it matches a certain pattern. When I find, the pattern, I need to start doing something with the remaining bits until a valid signal is deasserted. Then I need to start everything over again. I'm having trouble figuring out the order in which to do things to make sure it all works right
library ieee;
use ieee.std_logic_1164.all;
entity FrameHolder2 is
port
(
clk,reset: in std_logic;
input: in std_logic;
valid: in std_logic;
output: out std_logic
);
end FrameHolder2;
architecture structure of FrameHolder2 is
signal prehold: std_logic_vector(63 downto 0);
signal start: std_logic;
component rshift8bit is
PORT
(
aclr : IN STD_LOGIC ;
clock : IN STD_LOGIC ;
enable : IN STD_LOGIC ;
shiftin : IN STD_LOGIC ;
q : OUT STD_LOGIC_VECTOR (63 DOWNTO 0)
);
end component;
stage0: rshift8bit port map(reset,clk,not start,input,prehold);
--stage1: buffer data in somewhere port map(reset,clk,start and valid,input,something);
start <= '1' when prehold = "1101010101010101010101010101010101010101010101010101010101010101" else '0';
--store data somewhere when start = '1' and valid = '0';
end structure;
When valid goes to '0', I need start to go to 0 but I can't just add a "and valid ='0'" to start's when clause because valid might not be '1' right away. I need start to go to 0 when valid goes from 1 to 0. How do I do that?