Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

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.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top