quick.gif

space2.gif

space2.gif

space2.gif

space2.gif

space2.gif

space2.gif

space2.gif

   

space.gif

   

space.gif

  ../../images/main/bullet_green_ball.gif Gray Counter
   

space.gif


  1 -------------------------------------------------------
  2 -- Design Name : gray_counter
  3 -- File Name   : gray_counter.vhd
  4 -- Function    : 8 bit gray counters
  5 -- Coder       : Deepak Kumar Tala (Verilog)
  6 -- Translator  : Alexander H Pham (VHDL)
  7 -------------------------------------------------------
  8 library ieee;
  9     use ieee.std_logic_1164.all;
 10     use ieee.std_logic_unsigned.all;
 11 
 12 entity gray_counter is
 13     port (
 14         cout   :out std_logic_vector (7 downto 0); -- Output of the counter
 15         enable :in  std_logic;                     -- Enable counting
 16         clk    :in  std_logic;                     -- Input clock
 17         reset  :in  std_logic                      -- Input reset
 18     );
 19 end entity;
 20 
 21 architecture rtl of gray_counter is
 22     signal count :std_logic_vector (7 downto 0);
 23 begin
 24     process (clk, reset) begin
 25         if (reset = '1') then
 26             count <= (others=>'0');
 27         elsif (rising_edge(clk)) then
 28             if (enable = '1') then
 29                 count <= count + 1;
 30             end if;
 31         end if;
 32     end process;
 33     cout <= (count(7) & 
 34             (count(7) xor count(6)) & 
 35             (count(6) xor count(5)) & 
 36             (count(5) xor count(4)) & 
 37             (count(4) xor count(3)) & 
 38             (count(3) xor count(2)) & 
 39             (count(2) xor count(1)) & 
 40             (count(1) xor count(0)) ); 
 41 end architecture;
You could download file vhdl_examples here
   

space.gif

   

space.gif

   

space.gif

   

space.gif

space2.gif

space2.gif

space2.gif

space2.gif

space2.gif

  

Copyright © 1998-2014

Deepak Kumar Tala - All rights reserved

Do you have any Comment? mail me at:deepak@asic-world.com