lemueltra

csm16

Feb 23rd, 2017
353
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 1.20 KB | None | 0 0
  1. -- Descrição do contador síncrono módulo 16
  2. library ieee;
  3. use ieee.std_logic_1164.all;
  4.  
  5. entity csm16 is
  6.     port(
  7.         clock: in std_logic;
  8.         clear: in std_logic;
  9.         enable: in std_logic;
  10.         q: out std_logic_vector(3 downto 0)
  11.         ); 
  12. end csm16;
  13.  
  14. architecture estrutural of csm16 is
  15.     component ffjk
  16.         port(
  17.             j: in std_logic;
  18.             k: in std_logic;
  19.             clk: in std_logic;
  20.             clr: in std_logic;
  21.             q: out std_logic
  22.         );
  23.     end component;
  24.     signal enable_aux: std_logic_vector(2 downto 0);
  25.     signal q_aux: std_logic_vector(3 downto 0);
  26.     begin
  27.         ff0: ffjk port map (enable,enable,clock,clear,q_aux(0));
  28.         ff1: ffjk port map (enable_aux(0),enable_aux(0),clock,clear,q_aux(1));
  29.         ff2: ffjk port map (enable_aux(1),enable_aux(1),clock,clear,q_aux(2));
  30.         ff3: ffjk port map (enable_aux(2),enable_aux(2),clock,clear,q_aux(3));
  31.         enable_aux(0) <= q_aux(0) and enable;
  32.         enable_aux(1) <= q_aux(1) and enable_aux(0);
  33.         enable_aux(2) <= q_aux(2) and enable_aux(1);
  34.         q <= q_aux; -- Primeira posição do vetor q_aux recebe a primeira posição do vetor q, a segunda posição do vetor q_aux recebe a segunda posição do vetor q, a terceira posição do vetor q_aux recebe a terceira posição do vetor q
  35. end estrutural;
Advertisement
Add Comment
Please, Sign In to add comment