-
Notifications
You must be signed in to change notification settings - Fork 3
/
opa_isa_pkg.vhd
72 lines (62 loc) · 2.64 KB
/
opa_isa_pkg.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
66
67
68
69
70
71
72
-- opa: Open Processor Architecture
-- Copyright (C) 2014-2016 Wesley W. Terpstra
--
-- 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/>.
--
-- To apply the GPL to my VHDL, please follow these definitions:
-- Program - The entire collection of VHDL in this project and any
-- netlist or floorplan derived from it.
-- System Library - Any macro that translates directly to hardware
-- e.g. registers, IO pins, or memory blocks
--
-- My intent is that if you include OPA into your project, all of the HDL
-- and other design files that go into the same physical chip must also
-- be released under the GPL. If this does not cover your usage, then you
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
library work;
use work.opa_pkg.all;
use work.opa_isa_base_pkg.all;
use work.opa_riscv_pkg.all;
use work.opa_lm32_pkg.all;
package opa_isa_pkg is
function f_opa_isa_info(isa : t_opa_isa) return t_opa_isa_info;
function f_opa_isa_accept(isa : t_opa_isa; config : t_opa_config) return std_logic;
function f_opa_isa_decode(isa : t_opa_isa; config : t_opa_config; x : std_logic_vector) return t_opa_op;
end package;
package body opa_isa_pkg is
function f_opa_isa_info(isa : t_opa_isa) return t_opa_isa_info is
begin
case isa is
when T_OPA_RV32 => return c_opa_rv32;
when T_OPA_LM32 => return c_opa_lm32;
end case;
end f_opa_isa_info;
function f_opa_isa_accept(isa : t_opa_isa; config : t_opa_config) return std_logic is
begin
case isa is
when T_OPA_RV32 => return f_opa_accept_rv32(config);
when T_OPA_LM32 => return f_opa_accept_lm32(config);
end case;
end f_opa_isa_accept;
function f_opa_isa_decode(isa : t_opa_isa; config : t_opa_config; x : std_logic_vector) return t_opa_op is
alias y : std_logic_vector(x'length-1 downto 0) is x;
begin
case isa is
when T_OPA_RV32 => return f_opa_decode_rv32(config, y);
when T_OPA_LM32 => return f_opa_decode_lm32(config, y);
end case;
end f_opa_isa_decode;
end opa_isa_pkg;