Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

variable assignment inside state machine process?

Status
Not open for further replies.

buckeyes1997

Technical User
Oct 25, 2005
2
US
hello
i am trying to get this to work and have been pulling my hair out on this one.

im wanting to basically read a pin every time a clk rising edge happens and then store it to a variable until i get all 36 bits and then spit it out to another signal vector.

ARCHITECTURE ONE OF CLONE34 IS
TYPE STATE_TYPE IS (S0,S1,S2,S3);
SIGNAL state: STATE_TYPE;
BEGIN

PROCESS (clk)
VARIABLE DATA : STD_LOGIC_VECTOR(35 DOWNTO 0):="000000000000000000000000000000000000";
BEGIN

IF clk'EVENT AND clk = '1' THEN
CASE state IS
WHEN S0 =>
IF ADD = SEL(7 DOWNTO 3) THEN
state <= S1;
END IF;

WHEN S1 =>
IF clk='1' AND clk'EVENT THEN
DATA(35):=SEL(1);

state <= S2;
END IF;

WHEN S2 =>
IF clk='1' AND clk'EVENT THEN
DATA(34):=SEL(1);

state <= S3;
END IF;

WHEN S3 =>
IF clk='1' AND clk'EVENT THEN
DATA(33):=SEL(1);

LED1<=DATA(35 DOWNTO 4);
state <= S0;
END IF;





END CASE;
END IF;
END PROCESS;

WITH state SELECT
DAT(0) <= '1' WHEN S3,
'0' WHEN OTHERS;


END ONE;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top