- common functions lg2() and po2() added

- reworked cop0_ctrl_in/out types

Committed on the Free edition of March Hare Software CVSNT Server.
Upgrade to CVS Suite for more features and support:
http://march-hare.com/cvsnt/


git-svn-id: http://moon:8086/svn/vhdl/trunk@388 cc03376c-175c-47c8-b038-4cd826a8556b
This commit is contained in:
2009-03-15 20:09:27 +00:00
parent a332b172b3
commit b44d2ba1f9
+49 -33
View File
@@ -23,8 +23,8 @@
library IEEE; library IEEE;
use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_1164.ALL;
use IEEE.numeric_std.ALL; use IEEE.NUMERIC_STD.ALL;
use IEEE.MATH_REAL.ALL;
-------------------------------------------------------------------------- --------------------------------------------------------------------------
package mips_types is package mips_types is
@@ -150,6 +150,29 @@ package mips_types is
alu_lts alu_lts
); );
type sdu_t is record
imem_dep : STD_LOGIC;
dmem_dep : STD_LOGIC;
mul_dep : STD_LOGIC;
ID_nop : STD_LOGIC;
EX_nop : STD_LOGIC;
MEM_nop : STD_LOGIC;
WB_nop : STD_LOGIC;
ID_stall : STD_LOGIC;
EX_stall : STD_LOGIC;
MEM_stall : STD_LOGIC;
WB_stall : STD_LOGIC;
end record;
type hdu_t is record
alu_fwd_a_ex : boolean;
alu_fwd_a_mem : boolean;
alu_fwd_a_wb : boolean;
alu_fwd_b_ex : boolean;
alu_fwd_b_mem : boolean;
alu_fwd_b_wb : boolean;
end record;
type alu_flags_t is record type alu_flags_t is record
c : STD_LOGIC; c : STD_LOGIC;
uvf : STD_LOGIC; uvf : STD_LOGIC;
@@ -196,7 +219,9 @@ package mips_types is
cause : word_t; cause : word_t;
end record; end record;
type cop_ctrl_in_t is record type cop0_ctrl_in_t is record
sdu : sdu_t;
events : event_t;
bd_wb : STD_LOGIC; bd_wb : STD_LOGIC;
epc_mem : word_t; epc_mem : word_t;
epc_wb : word_t; epc_wb : word_t;
@@ -205,43 +230,16 @@ package mips_types is
exc_left : STD_LOGIC; exc_left : STD_LOGIC;
end record; end record;
type cop_ctrl_out_t is record type cop0_ctrl_out_t is record
RE : STD_LOGIC; RE : STD_LOGIC;
ee : STD_LOGIC;
ec : STD_LOGIC;
exc_commit : STD_LOGIC; exc_commit : STD_LOGIC;
exc_pending : STD_LOGIC; exc_pending : STD_LOGIC;
exc_exit : STD_LOGIC; exc_exit : STD_LOGIC;
reg_write : STD_LOGIC;
cop_read : STD_LOGIC;
user_mode : STD_LOGIC; user_mode : STD_LOGIC;
int : STD_LOGIC; int : STD_LOGIC;
exc_vec : word_t; exc_vec : word_t;
end record; end record;
type sdu_t is record
imem_dep : STD_LOGIC;
dmem_dep : STD_LOGIC;
mul_dep : STD_LOGIC;
ID_nop : STD_LOGIC;
EX_nop : STD_LOGIC;
MEM_nop : STD_LOGIC;
WB_nop : STD_LOGIC;
ID_stall : STD_LOGIC;
EX_stall : STD_LOGIC;
MEM_stall : STD_LOGIC;
WB_stall : STD_LOGIC;
end record;
type hdu_t is record
alu_fwd_a_ex : boolean;
alu_fwd_a_mem : boolean;
alu_fwd_a_wb : boolean;
alu_fwd_b_ex : boolean;
alu_fwd_b_mem : boolean;
alu_fwd_b_wb : boolean;
end record;
type alu_ctrl_t is record type alu_ctrl_t is record
outsel : alu_outsel_t; outsel : alu_outsel_t;
add : STD_LOGIC; add : STD_LOGIC;
@@ -307,6 +305,7 @@ package mips_types is
shamt : shamt_t; shamt : shamt_t;
ctrl : ctrl_lines_t; ctrl : ctrl_lines_t;
reg_write : STD_LOGIC; reg_write : STD_LOGIC;
cop_read : STD_LOGIC;
reg_a_rptr : reg_ptr_t; reg_a_rptr : reg_ptr_t;
reg_b_rptr : reg_ptr_t; reg_b_rptr : reg_ptr_t;
reg_a : word_t; reg_a : word_t;
@@ -331,6 +330,7 @@ package mips_types is
alu_flags : alu_flags_t; alu_flags : alu_flags_t;
result : word_t; result : word_t;
reg_write : STD_LOGIC; reg_write : STD_LOGIC;
cop_read : STD_LOGIC;
wreg_we : STD_LOGIC; wreg_we : STD_LOGIC;
reg_wptr : reg_ptr_t; reg_wptr : reg_ptr_t;
reg_a_rptr : reg_ptr_t; reg_a_rptr : reg_ptr_t;
@@ -382,6 +382,9 @@ package mips_types is
function event_is_active(e : event_t) return std_logic; function event_is_active(e : event_t) return std_logic;
function "or" (a, b : event_t) return event_t; function "or" (a, b : event_t) return event_t;
function lg2(x : natural) return natural;
function po2(x : natural) return natural;
end mips_types; end mips_types;
-------------------------------------------------------------------------- --------------------------------------------------------------------------
@@ -572,6 +575,7 @@ package body mips_types is
end events_clr; end events_clr;
--------------------------------------------------------------------------
function event_is_active(e : event_t) return std_logic is function event_is_active(e : event_t) return std_logic is
variable result : std_logic; variable result : std_logic;
begin begin
@@ -595,6 +599,7 @@ package body mips_types is
end event_is_active; end event_is_active;
--------------------------------------------------------------------------
function "or" (a, b : event_t) return event_t is function "or" (a, b : event_t) return event_t is
variable result : event_t; variable result : event_t;
begin begin
@@ -616,7 +621,18 @@ package body mips_types is
end "or"; end "or";
-------------------------------------------------------------------------- --------------------------------------------------------------------------
end mips_types; function lg2(x : natural) return natural is
begin
return natural(ceil(log2(real(x))));
end lg2;
--------------------------------------------------------------------------
function po2(x : natural) return natural is
begin
return 2**lg2(x);
end po2;
-------------------------------------------------------------------------- --------------------------------------------------------------------------
-------------------------------------------------------------------------- end mips_types;