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 range with bitstream: VHDL

Status
Not open for further replies.

lightofspace

Newbie level 5
Joined
Oct 18, 2006
Messages
9
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,355
vhdl case range

Hi there!!
I am stuck in a problem of CASE range, I have the following code:
----------------------------------------------------------------------------
input_data: IN std_logic_vector (7 downto 0);
output: OUT std_logic_vector (3 downto 0);
.
.
.
.
case input_data is
when "00000001" => output <= "0010";
when "10000000" to "11111111" => output <= "1000";
when others => output <= "1111";
end case;
----------------------------------------------------------------------------
I want to make case range facility to work with binary also, how can I do this?
thanks in advance,
ahmad
 

vhdl case when range

In this special case you can write the case as follows...
Code:
case input_data is
when "00000001" => output <= "0010";
when "00000000" => output <= "1111";
when others => output <= "1000"; -- "10000000" to "11111111"
end case;

Other way is you generate this case statement using some kind of script!!
Code:
case input_data is
when "00000001" => output <= "0010";
when "10000000" | 
         "10000001" |
         "10000010" |
         ...................
         ...................
         "11111111" => output <= "1000";
when others => output <= "1111";
end case;
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top