Case Statement Question???

Status
Not open for further replies.

Digit0001

Member level 1
Joined
Jun 12, 2010
Messages
41
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,547
Hi

Can someone tell me, Is it possible to have a case statement without using a process?

P.S
 

A 'case' is exclusively for sequential code.
For combinatorial code there is the simular WHEN or WITH you could use.
 

yeh i looked through my notes again and the process is required.
 

Marcel,

A case statement is just a mux. It can be used in a sequential or combinatorial process.

Radix
 

It is used in sequential statements description only.
--
Amr Ali
 

Digit0001 said:
Hi

Can someone tell me, Is it possible to have a case statement without using a process?

P.S




library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;



entity mux is
Port ( i : in STD_LOGIC_VECTOR (3 downto 0);
s : in STD_LOGIC_VECTOR (1 downto 0);
y : out STD_LOGIC);
end mux;

architecture Behavioral of mux is

begin


using if statement

--process (i,s)
--begin
--(if s="00" then y<=i(0);
--elsif s="01"then y<=i(1);
--elsif s="10"then y<=i(2);
--end if; )
--end process;

-- with statement act same as case statement outside process

--with s select

-- y<=i(0) when "00",
-- i(1) when "01",
-- i(2) when "10",
-- i(3) when "11",
-- 'Z' when others;




-- when statement

-- y<=i(0) when s="00"else
-- i(1) when s="01"else
-- i(2) when s="10"else
--i(3) ;

-- case statement with in process


process(s,i)
begin
case s is

when "00"=> y<=i(0);
when "01"=> y<=i(1);
when "10"=> y<=i(2);
when "11"=> y<=i(3);
when others=> null;

end case;
end process;



end Behavioral;

[/b]




so if want to write a case statement outside process , use with select statement both are equl
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…