1 |
69 |
jlechner |
-------------------------------------------------------------------------------
|
2 |
|
|
-- File: rise_pack.vhd
|
3 |
|
|
-- Author: Jakob Lechner, Urban Stadler, Harald Trinkl, Christian Walter
|
4 |
|
|
-- Created: 2006-11-29
|
5 |
|
|
-- Last updated: 2006-11-29
|
6 |
|
|
|
7 |
|
|
-- Description:
|
8 |
|
|
-- Package for RISE project.
|
9 |
|
|
-------------------------------------------------------------------------------
|
10 |
|
|
|
11 |
|
|
|
12 |
|
|
library IEEE;
|
13 |
|
|
use IEEE.STD_LOGIC_1164.all;
|
14 |
|
|
use IEEE.STD_LOGIC_ARITH.all;
|
15 |
|
|
use work.RISE_CONST_PACK.all;
|
16 |
|
|
|
17 |
|
|
package RISE_PACK_SPECIFIC is
|
18 |
|
|
|
19 |
|
|
constant OPCODE_WIDTH : integer := CONST_OPCODE_WIDTH;
|
20 |
|
|
constant COND_WIDTH : integer := CONST_COND_WIDTH;
|
21 |
|
|
|
22 |
|
|
subtype OPCODE_T is std_logic_vector(OPCODE_WIDTH-1 downto 0);
|
23 |
|
|
subtype COND_T is std_logic_vector(COND_WIDTH-1 downto 0);
|
24 |
|
|
|
25 |
|
|
|
26 |
|
|
-- RISE OPCODES --
|
27 |
|
|
-- load opcodes
|
28 |
|
|
constant OPCODE_LD_IMM : OPCODE_T := CONST_OPCODE_LD_IMM;
|
29 |
|
|
constant OPCODE_LD_IMM_HB : OPCODE_T := CONST_OPCODE_LD_IMM_HB;
|
30 |
|
|
constant OPCODE_LD_DISP : OPCODE_T := CONST_OPCODE_LD_DISP;
|
31 |
|
|
constant OPCODE_LD_DISP_MS : OPCODE_T := CONST_OPCODE_LD_DISP_MS;
|
32 |
|
|
constant OPCODE_LD_REG : OPCODE_T := CONST_OPCODE_LD_REG;
|
33 |
|
|
|
34 |
|
|
-- store opcodes
|
35 |
|
|
constant OPCODE_ST_DISP : OPCODE_T := CONST_OPCODE_ST_DISP;
|
36 |
|
|
|
37 |
|
|
-- arithmethic opcodes
|
38 |
|
|
constant OPCODE_ADD : OPCODE_T := CONST_OPCODE_ADD;
|
39 |
|
|
constant OPCODE_ADD_IMM : OPCODE_T := CONST_OPCODE_ADD_IMM;
|
40 |
|
|
constant OPCODE_SUB : OPCODE_T := CONST_OPCODE_SUB;
|
41 |
|
|
constant OPCODE_SUB_IMM : OPCODE_T := CONST_OPCODE_SUB_IMM;
|
42 |
|
|
constant OPCODE_NEG : OPCODE_T := CONST_OPCODE_NEG;
|
43 |
|
|
constant OPCODE_ARS : OPCODE_T := CONST_OPCODE_ARS;
|
44 |
|
|
constant OPCODE_ALS : OPCODE_T := CONST_OPCODE_ALS;
|
45 |
|
|
|
46 |
|
|
-- logical opcodes
|
47 |
|
|
constant OPCODE_AND : OPCODE_T := CONST_OPCODE_AND;
|
48 |
|
|
constant OPCODE_NOT : OPCODE_T := CONST_OPCODE_NOT;
|
49 |
|
|
constant OPCODE_EOR : OPCODE_T := CONST_OPCODE_EOR;
|
50 |
|
|
constant OPCODE_LS : OPCODE_T := CONST_OPCODE_LS;
|
51 |
|
|
constant OPCODE_RS : OPCODE_T := CONST_OPCODE_RS;
|
52 |
|
|
|
53 |
|
|
-- program control
|
54 |
|
|
constant OPCODE_JMP : OPCODE_T := CONST_OPCODE_JMP;
|
55 |
|
|
|
56 |
|
|
-- other
|
57 |
|
|
constant OPCODE_TST : OPCODE_T := CONST_OPCODE_TST;
|
58 |
|
|
constant OPCODE_NOP : OPCODE_T := CONST_OPCODE_NOP;
|
59 |
|
|
|
60 |
|
|
-- CONDITION CODES --
|
61 |
|
|
constant COND_UNCONDITIONAL : COND_T := CONST_COND_UNCONDITIONAL;
|
62 |
|
|
constant COND_NOT_ZERO : COND_T := CONST_COND_NOT_ZERO;
|
63 |
|
|
constant COND_ZERO : COND_T := CONST_COND_ZERO;
|
64 |
|
|
constant COND_CARRY : COND_T := CONST_COND_CARRY;
|
65 |
|
|
constant COND_NEGATIVE : COND_T := CONST_COND_NEGATIVE;
|
66 |
|
|
constant COND_OVERFLOW : COND_T := CONST_COND_OVERFLOW;
|
67 |
|
|
constant COND_ZERO_NEGATIVE : COND_T := CONST_COND_ZERO_NEGATIVE;
|
68 |
|
|
|
69 |
|
|
function svector2opcode (v : std_logic_vector) return OPCODE_T;
|
70 |
|
|
function svector2cond (v : std_logic_vector) return COND_T;
|
71 |
|
|
|
72 |
|
|
end RISE_PACK_SPECIFIC;
|
73 |
|
|
|
74 |
|
|
package body RISE_PACK_SPECIFIC is
|
75 |
|
|
|
76 |
|
|
-- purpose: converts std_logic_vector to enum type
|
77 |
|
|
function svector2opcode (v : std_logic_vector) return OPCODE_T is
|
78 |
|
|
variable v_tmp : CONST_OPCODE_T;
|
79 |
|
|
begin -- svector2opcode
|
80 |
|
|
v_tmp := v;
|
81 |
|
|
return v_tmp;
|
82 |
|
|
end svector2opcode;
|
83 |
|
|
|
84 |
|
|
-- purpose: converts std_logic_vector to enum type
|
85 |
|
|
function svector2cond (v : std_logic_vector) return COND_T is
|
86 |
|
|
variable v_tmp : CONST_COND_T;
|
87 |
|
|
begin -- svector2cond
|
88 |
|
|
v_tmp := v;
|
89 |
|
|
return v_tmp;
|
90 |
|
|
end svector2cond;
|
91 |
|
|
|
92 |
|
|
end RISE_PACK_SPECIFIC;
|
93 |
|
|
|
94 |
|
|
|