SHARE
TWEET

Untitled

a guest Apr 21st, 2019 80 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. LIBRARY ieee;
  2. USE ieee.std_logic_1164.all;
  3. ENTITY videoram IS
  4.     PORT( DATA: IN std_logic_vector(7 downto 0);
  5.         KKS: IN std_logic_vector(7 downto 0);
  6.         CLK: IN std_logic;
  7.         Query: IN std_logic;
  8.         Q: OUT std_logic_vector(7 downto 0);
  9.         Get: OUT std_logic;
  10.         Synchro: OUT std_logic
  11.         );
  12. END videoram;
  13.  
  14. ARCHITECTURE behaviour OF videoram IS
  15. type MEM is array (7 downto 0) of std_logic_vector(7 downto 0);
  16. SIGNAL memory: MEM;
  17. SIGNAL getf, sf: std_logic;
  18.  
  19. BEGIN
  20.     PROCESS(CLK)
  21.         variable count: integer;
  22.     BEGIN
  23.         IF CLK = '1' THEN
  24.             count := count + 1;
  25.             IF count = 8 THEN
  26.                 getf <= '0';
  27.                 count := 0;
  28.             END IF;
  29.         IF ( KKS = memory(7)) THEN
  30.             count := 0;
  31.             Synchro <= '1';
  32.         ELSE
  33.             Synchro <= '0';
  34.         END IF;
  35.  
  36.         IF (( Query = '1' ) AND ( KKS = memory(7) )) OR (getf = '1') THEN
  37.  
  38.             IF( getf = '0') THEN getf <= '1'; END IF;
  39.  
  40.                 memory(7) <= memory(6);
  41.                 memory(6) <= memory(5);
  42.                 memory(5) <= memory(4);
  43.                 memory(4) <= memory(3);
  44.                 memory(3) <= memory(2);
  45.                 memory(2) <= memory(1);
  46.                 memory(1) <= memory(0);
  47.                 memory(0) <= DATA;
  48.             ELSE
  49.                 --getf <= '0';
  50.                 memory(7) <= memory(6);
  51.                 memory(6) <= memory(5);
  52.                 memory(5) <= memory(4);
  53.                 memory(4) <= memory(3);
  54.                 memory(3) <= memory(2);
  55.                 memory(2) <= memory(1);
  56.                 memory(1) <= memory(0);
  57.                 memory(0) <= memory(7);
  58.             END IF;
  59.  
  60.         END IF;
  61.     END PROCESS;
  62.     Q <= memory(7);
  63.     Get <= getf;
  64. END behaviour;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top