electronics forum

Rules | Recent posts | topic RSS | Search | Register  | Log in

how to do in vhdl


Post new topic  Reply to topic    EDAboard.com Forum Index -> PLD, SPLD, GAL, CPLD, FPGA Design -> how to do in vhdl
Author Message
voho



Joined: 24 Feb 2004
Posts: 105


Post09 Nov 2005 14:05   

how to do in vhdl


Hi all,

I have 2 inputs A and B and 1 output Q(14:0);
I want to do this in vhdl:

If a=5 and B=10 then Q=000001111111111

Thank's in advance

regards
voho
Back to top
nand_gates



Joined: 19 Jul 2004
Posts: 907
Helped: 120


Post09 Nov 2005 14:59   

Re: how to do in vhdl


Here is how to do it!!

Code:
library ieee;
use ieee.std_logic_1164.all;

entity my_logic is
 
  port (
    A : in  std_logic_vector(14 downto 0);
    B : in  std_logic_vector(14 downto 0);
    Q : out std_logic_vector(14 downto 0));

end my_logic;

architecture behave of my_logic is

begin  -- behave
process (A,B)
begin  -- process
if (a="000000000000101" and B = "000000000001010") then
  Q <= "000001111111111";
else
  Q <= "000000000000000";
end if;
end process;


end behave;
Back to top
Kukaz



Joined: 09 May 2001
Posts: 30
Helped: 1


Post10 Nov 2005 9:21   

Re: how to do in vhdl


OR SO

library ieee;
use ieee.std_logic_1164.all;

entity my_logic is

port (
A : in std_logic_vector(14 downto 0);
B : in std_logic_vector(14 downto 0);
Q : out std_logic_vector(14 downto 0));

end my_logic;

architecture behave of my_logic is
begin

Q <= "000001111111111" WHEN (a="000000000000101" and B = "000000000001010") ELSE "000000000000000";

end behave;
Back to top
Google
AdSense
Google Adsense




Post10 Nov 2005 9:21   

Ads




Back to top
maksya



Joined: 02 Jun 2005
Posts: 172
Helped: 13


Post11 Nov 2005 21:37   

Re: how to do in vhdl


In my opinion, your code needs to be corrected this way:

...
A : in std_logic_vector(2 downto 0);
B : in std_logic_vector(3 downto 0);

...
Q <= "000001111111111" WHEN (a="101" and B = "1010") ELSE
Back to top
Arabic versionBulgarian versionCatalan versionCzech versionDanish versionGerman versionGreek versionEnglish versionSpanish versionFinnish versionFrench versionHindi versionCroatian versionIndonesian versionItalian versionHebrew versionJapanese versionKorean versionLithuanian versionLatvian versionDutch versionNorwegian versionPolish versionPortuguese versionRomanian versionRussian versionSlovak versionSlovenian versionSerbian versionSwedish versionTagalog versionUkrainian versionVietnamese versionChinese version
Post new topic  Reply to topic    EDAboard.com Forum Index -> PLD, SPLD, GAL, CPLD, FPGA Design -> how to do in vhdl
Page 1 of 1 All times are GMT + 1 Hour
Similar topics:
how to do text IO in vhdl (2)
How to Debug VHDL? (2)
how to study vhdl.........? (1)
How to implement a divider by VHDL? (5)
how to do this in vhdl ISE (1)
how to dump waveform in vhdl (1)
how to begin to learn VHDL (12)
How to Initialize 2D array in VHDL? (2)
How to intialize a RAM(VHDL) (6)
How to Implement IPv4 in VHDL (1)


Abuse || Administrator || Moderators || Support us || sitemap
topic RSS