Thursday, 9 March 2017

VHDL Code For 3x8 Decoder

The following is the VHDL code for 3x8 decoder in behavioral style along with the test bench.


library IEEE;
entity deco1 is
   Port ( x : in  STD_LOGIC;
          y : in  STD_LOGIC;
          z : in  STD_LOGIC;
          d0 : out  STD_LOGIC;
          d1 : out  STD_LOGIC;
          d2 : out  STD_LOGIC;
          d3 : out  STD_LOGIC;
          d4 : out  STD_LOGIC;
          d5 : out  STD_LOGIC;
          d6 : out  STD_LOGIC;
          d7 : out  STD_LOGIC);
end deco1;

architecture Structural of deco1 is
component decand1 is
Port ( a : in  STD_LOGIC;
          b : in  STD_LOGIC;
          c : in  STD_LOGIC;
          d : out  STD_LOGIC);
end component;
component decnot1 is
Port ( a : in  STD_LOGIC;
          c : out  STD_LOGIC);
end component;
signal s2, s1, s3: STD_LOGIC;
g1: decnot1 port map(x,s1);
g2: decnot1 port map(y,s2);
g3: decnot1 port map(z,s3);
g4: decand1 port map(s1, s2, s3, d0);
g5: decand1 port map(s1, s2, z, d1);
g6: decand1 port map(s1, y, s3, d2);
g7: decand1 port map(s1, y, z, d3);
g8: decand1 port map(x, s2, s3, d4);
g9: decand1 port map(x, s2, z, d5);
g10: decand1 port map(x, y, s3, d6);
g11: decand1 port map(x, y, z, d7);
end Structural;


USE ieee.std_logic_1164.ALL;
ENTITY deco2_tb IS
END deco2_tb;
ARCHITECTURE behavior OF deco2_tb IS
   -- Component Declaration for the Unit Under Test (UUT)
   COMPONENT deco1
        x : IN  std_logic;
        y : IN  std_logic;
        z : IN  std_logic;
        d0 : OUT  std_logic;
        d1 : OUT  std_logic;
        d2 : OUT  std_logic;
        d3 : OUT  std_logic;
        d4 : OUT  std_logic;
        d5 : OUT  std_logic;
        d6 : OUT  std_logic;
        d7 : OUT  std_logic
  signal x : std_logic := '0';
  signal y : std_logic := '0';
  signal z : std_logic := '0';

  signal d0 : std_logic;
  signal d1 : std_logic;
  signal d2 : std_logic;
  signal d3 : std_logic;
  signal d4 : std_logic;
  signal d5 : std_logic;
  signal d6 : std_logic;
  signal d7 : std_logic;
    -- Instantiate the Unit Under Test (UUT)
  uut: deco1 PORT MAP (
         x => x,
         y => y,
         z => z,
         d0 => d0,
         d1 => d1,
         d2 => d2,
         d3 => d3,
         d4 => d4,
         d5 => d5,
         d6 => d6,
         d7 => d7

  -- Stimulus process
  stim_proc: process
     x<='0'; y<='0';z<='0';
        wait for 100ns;
        x<='0'; y<='0';z<='1';
        wait for 100ns;
        x<='0'; y<='1';z<='0';
        wait for 100ns;
        x<='0'; y<='1';z<='1'; wait for 100ns;
        x<='1'; y<='0';z<='0';wait for 100ns;
        x<='1'; y<='0';z<='1';wait for 100ns;
        x<='1'; y<='1';z<='0';wait for 100ns;
        x<='1'; y<='1';z<='1';wait for 100ns;
  end process;


Test Bench Waveform:
Vhdl code for 3x8 decoder

1 comment:

  1. Irrespective of receiving daily oral or future injectable depot therapies, these require health care visits for medication and monitoring of safety and response. If patients are treated early enough, before a lot of immune system damage has occurred, life expectancy is close to normal, as long as they remain on successful treatment. However, when patients stop therapy, virus rebounds to high levels in most patients, sometimes associated with severe illness because i have gone through this and even an increased risk of death. The aim of “cure”is ongoing but i still do believe my government made millions of ARV drugs instead of finding a cure. for ongoing therapy and monitoring. ARV alone cannot cure HIV as among the cells that are infected are very long-living CD4 memory cells and possibly other cells that act as long-term reservoirs. HIV can hide in these cells without being detected by the body’s immune system. Therefore even when ART completely blocks subsequent rounds of infection of cells, reservoirs that have been infected before therapy initiation persist and from these reservoirs HIV rebounds if therapy is stopped. “Cure” could either mean an eradication cure, which means to completely rid the body of reservoir virus or a functional HIV cure, where HIV may remain in reservoir cells but rebound to high levels is prevented after therapy interruption.Dr Itua Herbal Medicine makes me believes there is a hope for people suffering from,Parkinson's disease,Schizophrenia,Cancer,Scoliosis,Fibromyalgia,Fluoroquinolone Toxicity
    Syndrome Fibrodysplasia Ossificans Progressiva.Fatal Familial Insomnia Factor V Leiden Mutation ,Epilepsy Dupuytren's disease,Desmoplastic small-round-cell tumor Diabetes ,Coeliac disease,Creutzfeldt–Jakob disease,Cerebral Amyloid Angiopathy, Ataxia,Arthritis,Amyotrophic Lateral Sclerosis,Alzheimer's disease,Adrenocortical carcinoma.Asthma,Allergic diseases.Hiv_ Aids,Herpe ,Copd,Diabetes,Hepatitis,I read about him online how he cure Tasha and Tara so i contacted him on even talked on whatsapps +2348149277967 believe me it was easy i drank his herbal medicine for two weeks and i was cured just like that isn't Dr Itua a wonder man? Yes he is! I thank him so much so i will advise if you are suffering from one of those diseases Pls do contact him he's a nice man.