-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathImplementation_of_ROM.vhd
More file actions
54 lines (45 loc) · 961 Bytes
/
Implementation_of_ROM.vhd
File metadata and controls
54 lines (45 loc) · 961 Bytes
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
-- VHDL code for ROM
-- Header file declaration
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
USE ieee.numeric_std.ALL;
-- Entity declaration
ENTITY ROM IS
PORT (
address : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
dout : OUT STD_LOGIC_VECTOR(3 DOWNTO 0)
);
END ENTITY ROM;
-- Dataflow Modelling Style
-- Architecture declaration
ARCHITECTURE RTL OF ROM IS
TYPE MEMORY_16_4 IS ARRAY (0 TO 15) OF STD_LOGIC_VECTOR(3 DOWNTO 0);
CONSTANT ROM_16_4 : MEMORY_16_4 := (
x"0",
x"1",
x"2",
x"3",
x"4",
x"5",
x"6",
x"7",
x"8",
x"9",
x"a",
x"b",
x"c",
x"d",
x"e",
x"f"
);
BEGIN
main : PROCESS (address)
BEGIN
dout <= ROM_16_4(to_integer(unsigned(address)));
END PROCESS main;
END ARCHITECTURE RTL;
-- For Output:
-- Address:0000
-- Output will be :0000
-- Address:1111
-- Output will be:1111