Go Back   Velocity Reviews > Newsgroups > VHDL
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

VHDL - 3:8 decoder with enable

 
Thread Tools Search this Thread
Old 11-19-2007, 09:38 PM   #1
Default 3:8 decoder with enable


Code:
ENTITY Decoder3_8_Enable IS port (a: in std_logic_vector(2 downto 0); e: in std_logic ; y:out std_logic_vector(7 downto 0)); END ENTITY Decoder3_8_Enable; -- ARCHITECTURE RTL OF Decoder3_8 IS BEGIN process (e , a) begin if e = '1' then if a="000" then y="00000001" elsif a="001" then y="00000010" elsif a="010" then y="00000100" elsif a="011" then y="00001000" elsif a="100" then y="00010000" elsif a="101" then y="00100000" elsif a="110" then y="01000000" elsif a="111" then y="10000000" else'--------'; end if; end process END ARCHITECTURE RTL;


the code doesnt work , anyone know why ?!!


HaYZaM
HaYZaM is offline   Reply With Quote
Old 11-20-2007, 12:46 PM   #2
manasiw2
Junior Member
 
Join Date: Oct 2007
Posts: 5
Default
Hi
check this modified code...its syntactically correct...please check functionality.



library ieee;
use ieee.std_logic_1164.all;

ENTITY Decoder3_8_Enable IS
port (a: in std_logic_vector(2 downto 0);
e: in std_logic ;
y: out std_logic_vector(7 downto 0)
);
END Decoder3_8_Enable;

--
ARCHITECTURE RTL OF Decoder3_8_Enable IS
BEGIN
process (e , a)
begin
if e = '1' then
if a = "000" then y <="00000001";
elsif a = "001" then y <="00000010";
elsif a = "010" then y <="00000100";
elsif a = "011" then y <="00001000";
elsif a = "100" then y <="00010000";
elsif a = "101" then y <="00100000";
elsif a = "110" then y <="01000000";
elsif a = "111" then y <="10000000";
else null;
end if;
end if;
end process;
END ARCHITECTURE RTL;


manasiw2
manasiw2 is offline   Reply With Quote
Old 11-22-2007, 04:28 PM   #3
forums4f
Junior Member
 
Join Date: Nov 2007
Posts: 2
Default
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std_all
entity dec is
port(
a:in std_ulogic_vector(2 downto 0);
z : out std_ulogic_vector(7 downto 0);
e : in std_ulogic); --enable
end entity ;
architecture shiftdec of dec is
constant z_out:bit_vector(7 downto 0):=(0=>'1',others=>'0'); --"00000001";
begin
z<=to_stdulogicvector(z_out sll to_integer(unsigned(a))) when e='1' else 'Z';
end architecture;
-----------------------
also
u can use conv_std_logic_vector (parameter,bit_number)
conv_integer(parameter)

use ieee.std_logic_1164.all
or
use ieee.std_logic_signed.all


forums4f
forums4f is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
PIX 501 [ERR]vpdn enable outside waqas001 General Help Related Topics 0 04-22-2008 12:08 PM
AAA authentication problem for enable mode access leopard Hardware 1 07-02-2007 08:08 AM
save cost advice: decoder chip for large printer lois8386 General Help Related Topics 0 11-03-2006 06:19 AM
Spoke to Spoke Enhanced Config (ASA-PIX) NEED HELP ASAP!! T-Mak Hardware 1 10-27-2006 11:56 AM
How to enable communication between VLANS on a singlel switch makhan Hardware 1 10-26-2006 08:39 AM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46