123 lines
4.5 KiB
VHDL
123 lines
4.5 KiB
VHDL
-------------------------------------------------------------------------
|
|
-- Project: JCPU, a portable 8-bit RISC CPU written in VHDL
|
|
-- This file: The ROM file for use in your VHDL design
|
|
--
|
|
-- Copyright (C) 2007 J. Ahrensfeld
|
|
--
|
|
-- This program is free software: you can redistribute it and/or modify
|
|
-- it under the terms of the GNU General Public License as published by
|
|
-- the Free Software Foundation, either version 3 of the License, or
|
|
-- (at your option) any later version.
|
|
--
|
|
-- This program is distributed in the hope that it will be useful,
|
|
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
-- GNU General Public License for more details.
|
|
--
|
|
-- You should have received a copy of the GNU General Public License
|
|
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
--
|
|
-- For questions and ideas, please contact the author at jens@jayfield.org
|
|
--
|
|
--------------------------------------------------------------------------
|
|
|
|
LIBRARY ieee;
|
|
use IEEE.STD_LOGIC_1164.ALL;
|
|
USE ieee.numeric_std.ALL;
|
|
|
|
|
|
ENTITY rom IS
|
|
Generic
|
|
(
|
|
addr_width : integer := 2;
|
|
data_width : integer := 32
|
|
);
|
|
Port
|
|
(
|
|
addr : in unsigned(addr_width-1 downto 0);
|
|
dout : out unsigned(data_width-1 downto 0)
|
|
);
|
|
END rom;
|
|
|
|
ARCHITECTURE itest OF rom IS
|
|
|
|
subtype word_t is unsigned(data_width-1 downto 0);
|
|
type word_array_t is array (0 to 2**addr_width-1) of word_t;
|
|
|
|
-- Assembled from itest.jsm
|
|
constant word_array : word_array_t :=
|
|
(
|
|
|
|
X"08100001", -- [0x00400000] j 0x00400004 [main]
|
|
X"3c011234", -- [0x00400004] lui $1, 4660
|
|
X"34215a5a", -- [0x00400008] ori $1, $1, 23130
|
|
X"00010840", -- [0x0040000c] sll $1, $1, 1
|
|
X"00010900", -- [0x00400010] sll $1, $1, 4
|
|
X"00010880", -- [0x00400014] sll $1, $1, 2
|
|
X"00010840", -- [0x00400018] sll $1, $1, 1
|
|
X"00010a00", -- [0x0040001c] sll $1, $1, 8
|
|
X"00010882", -- [0x00400020] srl $1, $1, 2
|
|
X"00010942", -- [0x00400024] srl $1, $1, 5
|
|
X"00010842", -- [0x00400028] srl $1, $1, 1
|
|
X"00010a02", -- [0x0040002c] srl $1, $1, 8
|
|
X"3821ffff", -- [0x00400030] xori $1, $1, -1
|
|
X"3c1f0040", -- [0x00400034] lui $31, 64
|
|
X"03e00008", -- [0x00400038] jr $31
|
|
X"003f0826", -- [0x0040003c] xor $1, $1, $31
|
|
X"00000000", -- [0x00400040] nop
|
|
X"00000000", -- [0x00400044] nop
|
|
X"00000000", -- [0x00400048] nop
|
|
X"00000000", -- [0x0040004c] nop
|
|
X"00000000", -- [0x00400050] nop
|
|
X"00000000", -- [0x00400054] nop
|
|
X"00000000", -- [0x00400058] nop
|
|
X"00000000", -- [0x0040005c] nop
|
|
X"00000000", -- [0x00400060] nop
|
|
X"00000000", -- [0x00400064] nop
|
|
X"00000000", -- [0x00400068] nop
|
|
X"00000000", -- [0x0040006c] nop
|
|
X"00000000", -- [0x00400070] nop
|
|
X"00000000", -- [0x00400074] nop
|
|
X"00000000", -- [0x00400078] nop
|
|
X"00000000", -- [0x0040007c] nop
|
|
X"00000000", -- [0x00400080] nop
|
|
X"00000000", -- [0x00400084] nop
|
|
X"00000000", -- [0x00400088] nop
|
|
X"00000000", -- [0x0040008c] nop
|
|
X"00000000", -- [0x00400090] nop
|
|
X"00000000", -- [0x00400094] nop
|
|
X"00000000", -- [0x00400098] nop
|
|
X"00000000", -- [0x0040009c] nop
|
|
X"00000000", -- [0x004000a0] nop
|
|
X"00000000", -- [0x004000a4] nop
|
|
X"00000000", -- [0x004000a8] nop
|
|
X"00000000", -- [0x004000ac] nop
|
|
X"00000000", -- [0x004000b0] nop
|
|
X"00000000", -- [0x004000b4] nop
|
|
X"00000000", -- [0x004000b8]
|
|
X"00000000", -- [0x004000bc]
|
|
X"00000000", -- [0x004000c0]
|
|
X"00000000", -- [0x004000c4]
|
|
X"00000000", -- [0x004000c8]
|
|
X"00000000", -- [0x004000cc]
|
|
X"00000000", -- [0x004000d0]
|
|
X"00000000", -- [0x004000d4]
|
|
X"00000000", -- [0x004000d8]
|
|
X"00000000", -- [0x004000dc]
|
|
X"00000000", -- [0x004000e0]
|
|
X"00000000", -- [0x004000e4]
|
|
X"00000000", -- [0x004000e8]
|
|
X"00000000", -- [0x004000ec]
|
|
X"00000000", -- [0x004000f0]
|
|
X"00000000", -- [0x004000f4]
|
|
X"00000000", -- [0x004000f8]
|
|
X"00000000" -- [0x004000fc]
|
|
);
|
|
|
|
begin
|
|
|
|
PROM_READ:
|
|
dout <= word_array(to_integer(addr));
|
|
|
|
end itest;
|