uni

University stuff
git clone git://git.margiolis.net/uni.git
Log | Files | Refs | README | LICENSE

instrmem.vhd (1922B)


      1 library ieee;
      2 use ieee.std_logic_1164.all;
      3 use ieee.std_logic_unsigned.all;
      4 use ieee.numeric_std.all;
      5 
      6 entity instrmem is port (
      7 	addr:	in std_logic_vector(31 downto 0);
      8 	c:	out std_logic_vector(31 downto 0)
      9 );
     10 end instrmem;
     11 
     12 architecture dataflow of instrmem is
     13 
     14 type instr_arr is array(0 to 31) of std_logic_vector (31 downto 0);
     15 constant instr_mem: instr_arr := (
     16 	"00000000010001100010000000100000", -- 0 add $4, $2, $6
     17 	"00000000010001100010100000100010", -- 1 sub $5, $2, $6
     18 	"11111100100001010000000000000000", -- 2 read $4, $5
     19 	"00000000000000000000000000000000", -- 3
     20 	"00000000000000000000000000000000", -- 4
     21 	"00000000000000000000000000000000", -- 5
     22 	"00000000000000000000000000000000", -- 6
     23 	"00000000000000000000000000000000", -- 7
     24 	"00000000000000000000000000000000", -- 8
     25 	"00000000000000000000000000000000", -- 9
     26 	"00000000000000000000000000000000", -- 10
     27 	"00000000000000000000000000000000", -- 11
     28 	"00000000000000000000000000000000", -- 12
     29 	"00000000000000000000000000000000", -- 13
     30 	"00000000000000000000000000000000", -- 14
     31 	"00000000000000000000000000000000", -- 15
     32 	"00000000000000000000000000000000", -- 16
     33 	"00000000000000000000000000000000", -- 17
     34 	"00000000000000000000000000000000", -- 18
     35 	"00000000000000000000000000000000", -- 19
     36 	"00000000000000000000000000000000", -- 20
     37 	"00000000000000000000000000000000", -- 21
     38 	"00000000000000000000000000000000", -- 22
     39 	"00000000000000000000000000000000", -- 23
     40 	"00000000000000000000000000000000", -- 24
     41 	"00000000000000000000000000000000", -- 25
     42 	"00000000000000000000000000000000", -- 26
     43 	"00000000000000000000000000000000", -- 27
     44 	"00000000000000000000000000000000", -- 28
     45 	"00000000000000000000000000000000", -- 29
     46 	"00000000000000000000000000000000", -- 30
     47 	"00000000000000000000000000000000"  -- 31
     48 );
     49 
     50 begin
     51 	-- Our addresses are multiples of 4, so ignore the last 2 bits.
     52 	c <= instr_mem(to_integer(unsigned(addr(31 downto 2))));
     53 end dataflow;