Advertisement
kernel_memory_dump

RAM ROM VHDL MAJA

Jan 31st, 2015
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 3.00 KB | None | 0 0
  1. ----------------------------------------------------------------------------------
  2. -- Company:
  3. -- Engineer: Marko Rajinac E13624
  4. --
  5. -- Create Date:    13:34:01 12/12/2011
  6. -- Design Name:
  7. -- Module Name:    instr_rom - Behavioral
  8. -- Project Name:
  9. -- Target Devices:
  10. -- Tool versions:
  11. -- Description:
  12. --
  13. -- Dependencies:
  14. --
  15. -- Revision:
  16. -- Revision 0.01 - File Created
  17. -- Additional Comments:
  18. --
  19. ----------------------------------------------------------------------------------
  20. library IEEE;
  21. use IEEE.STD_LOGIC_1164.ALL;
  22. use ieee.std_logic_arith.all;
  23. use ieee.std_logic_unsigned.all;
  24.  
  25. -- Uncomment the following library declaration if using
  26. -- arithmetic functions with Signed or Unsigned values
  27. --use IEEE.NUMERIC_STD.ALL;
  28.  
  29. -- Uncomment the following library declaration if instantiating
  30. -- any Xilinx primitives in this code.
  31. --library UNISIM;
  32. --use UNISIM.VComponents.all;
  33.  
  34. entity instr_rom is
  35.     Port (
  36.      iA : in STD_LOGIC_VECTOR (15 downto 0);
  37.      oQ : out  STD_LOGIC_VECTOR (14 downto 0));
  38. end instr_rom;
  39.  
  40. architecture Behavioral of instr_rom is
  41.     type tMEMORY is array (0 to 31) of std_logic_vector(14 downto 0);
  42.     signal sADRESS : integer RANGE 0 to 31;
  43.    
  44.     constant cMOV STD_LOGIC_VECTOR(3 downto 0) := "0000";
  45.     constant cADD STD_LOGIC_VECTOR (3 downto 0) := "0001";
  46.     constant cSUB STD_LOGIC_VECTOR(3 downto 0) := "0010";
  47.     constant cSHIFT STD_LOGIC_VECTOR(3 downto 0) :="0011";
  48.    
  49.     constant cR0 STD_LOGIC_VECTOR(2 downto 0) := "000";
  50.     constant cR1 STD_LOGIC_VECTOR(2 downto 0) := "001";
  51.     constant cR2 STD_LOGIC_VECTOR(2 downto 0) := "010";
  52.     constant cR3 STD_LOGIC_VECTOR(2 downto 0) := "011";
  53.    
  54.     constant cJMP STD_LOGIC_VECTOR(5 downto 0) := "1000001";
  55.    
  56.    
  57.     constant cROM : tMEMORY :=(
  58.         "00" & cADD & sR3 & cR1 & cR2,
  59.         "100000011000000",--0-- ucitaj iz memorije u r3
  60.         "000110010010000",--1-- uvecaj r2 za 1
  61.         "000001000000010",--2-- saberi r0 i r2 i upisi u r0
  62.         "001000000000000",--3-- siftuj r0 u levo
  63.         "000110001001000",--4-- uvecaj r1 za 1
  64.         "000010111010001",--5-- oduzmi r2 i r1 i stavi ih u r7
  65.         "010101000000011",--6-- ako nije 0 skoci na 3
  66.         cJMP & "000000000", -- jmp na  pocetak
  67.         "000000001110000",--7-- prebaci r6 koji je x0000 u r1 kako bi ga postavio na 0
  68.         "000111011011000",--8-- umanji r3 za 1
  69.         "010101000000001",--9-- ako nije nula skoci na 1 - inace je kraj
  70.         "000110110110000",--10-- uvecaj reg6 za jedan
  71.         "110000000000110",--11-- smesti u drugu lokaciju u memoriji rezultat iz r0
  72.         "000000000000000",
  73.         "000000000000000",
  74.         "000000000000000",
  75.         "000000000000000",
  76.         "000000000000000",
  77.         "000000000000000",
  78.         "000000000000000",
  79.         "000000000000000",
  80.         "000000000000000",
  81.         "000000000000000",
  82.         "000000000000000",
  83.         "000000000000000",
  84.         "000000000000000",
  85.         "000000000000000",
  86.         "000000000000000",
  87.         "000000000000000",
  88.         "000000000000000",
  89.         "000000000000000",
  90.         "000000000000000",
  91.         "010000000011111" --beskonacna petlja - bezuslovni skok na sRam(31)
  92.         );
  93. begin
  94.  
  95.     sADRESS<=conv_integer(iA);
  96.     oQ <= cROM(sADRESS);
  97.  
  98. end Behavioral;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement