andreahmed

Untitled

Nov 25th, 2016
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. ------------------------------------------------------------------
  2. LIBRARY ieee;
  3. USE ieee.std_logic_1164.all;
  4. library work;
  5. ------------------------------------------------------------------
  6. ENTITY rom IS
  7. PORT (clk: IN STD_LOGIC;
  8. address: IN INTEGER RANGE 0 to 2**15;
  9. data_out: OUT STD_LOGIC_VECTOR(7 DOWNTO 0));
  10. END rom;
  11. ------------------------------------------------------------------
  12. ARCHITECTURE rom OF rom IS
  13. SIGNAL reg_address: INTEGER RANGE 0 to 2**15;
  14. TYPE memory IS ARRAY (0 TO 15) OF STD_LOGIC_VECTOR(7 DOWNTO 0);
  15. CONSTANT myrom: memory := (
  16. 0=> "00000000", -- 0
  17. 1=> "00000000", -- 1
  18. 2=> "00010000", -- 2 *
  19. 3=> "00111000", -- 3 ***
  20. 4=> "01101100", -- 4 ** **
  21. 5=> "11000110", -- 5 ** **
  22. 6=> "11000110", -- 6 ** **
  23. 7=> "11111110", -- 7 *******
  24. 8=> "11000110", -- 8 ** **
  25. 9=> "11000110", -- 9 ** **
  26. 10=> "11000110", -- a ** **
  27. 11=> "11000110", -- b ** **
  28. 12=> "00000000", -- c
  29. 13=> "00000000", -- d
  30. 14=> "00000000", -- e
  31. 15=> "00000000", -- f
  32. OTHERS => "00000000");
  33. BEGIN
  34. --Register the address:----------
  35. PROCESS (clk)
  36. BEGIN IF (clk'EVENT AND clk='1') THEN
  37. reg_address <= address;
  38. END IF;
  39. END PROCESS;
  40. --Get unregistered output:-------
  41. data_out <= myrom(reg_address);
  42. END rom;
Add Comment
Please, Sign In to add comment