-
Notifications
You must be signed in to change notification settings - Fork 0
/
instruction_memory.vhd
66 lines (59 loc) · 1.74 KB
/
instruction_memory.vhd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
----------------------------------------------------------------------------------
-- Company:
-- Engineer:
--
-- Create Date: 17:30:27 10/04/2016
-- Design Name:
-- Module Name: instruction_memory - Behavioral
-- Project Name:
-- Target Devices:
-- Tool versions:
-- Description:
--
-- Dependencies:
--
-- Revision:
-- Revision 0.01 - File Created
-- Additional Comments:
--
----------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
use std.textio.all;
entity instructionMemory is
Port (
--clk : in STD_LOGIC;
address : in STD_LOGIC_VECTOR (31 downto 0);
reset : in STD_LOGIC;
outInstruction : out STD_LOGIC_VECTOR (31 downto 0));
end instructionMemory;
architecture arqInstructionMemory of instructionMemory is
type rom_type is array (0 to 63) of std_logic_vector (31 downto 0);
impure function InitRomFromFile (RomFileName : in string) return rom_type is
FILE RomFile : text open read_mode is RomFileName;
variable RomFileLine : line;
variable temp_bv : bit_vector(31 downto 0);
variable temp_mem : rom_type;
begin
for I in rom_type'range loop
readline (RomFile, RomFileLine);
read(RomFileLine, temp_bv);
temp_mem(i) := to_stdlogicvector(temp_bv);
end loop;
return temp_mem;
end function;
signal instructions : rom_type := InitRomFromFile("testJMPL.data");
begin
--reset,address, instructions)
process(reset,address, instructions)--clk)
begin
--if(rising_edge(clk))then
if(reset = '1')then
outInstruction <= (others=>'0');
else
outInstruction <= instructions(conv_integer(address(5 downto 0)));
end if;
--end if;
end process;
end arqInstructionMemory;