OpenCores
URL https://opencores.org/ocsvn/core_arm/core_arm/trunk

Subversion Repositories core_arm

[/] [core_arm/] [trunk/] [vhdl/] [mem/] [cache/] [libs/] [kecs_libicache.vhd] - Blame information for rev 4

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 tarookumic
-- $(lic)
2
-- $(help_generic)
3
-- $(help_local)
4
 
5
library ieee;
6
use ieee.std_logic_1164.all;
7
use work.config.all;
8
use work.cache_config.all;
9
use work.target.all;
10
use work.device.all;
11
use work.kecs_libcmem.all;
12
use work.kehl_libint.all;
13
 
14
-- PREFIX: kcli_xxx
15
package kecs_libicache is
16
 
17
type kcli_ketyp_ctrl is record
18
  burst : std_logic;
19
end record;
20
 
21
-- icache tag layout
22
-- addr: |         tag         | (tag)addr | line | 00 |
23
--                                   |
24
--     +-----------------------------+
25
--     | +---------------------+---------+
26
--     +>|       CLTAG         | CLVALID |
27
--       +---------------------+---------+
28
 
29
-- addr to cmem-tag fields/access layout
30
constant KCLI_TTAG_D : integer  :=  2 + KCML_IC_TLINE_BSZ + KCML_IC_TADDR_BSZ;
31
constant KCLI_TTAG_U : integer  := (2 + KCML_IC_TLINE_BSZ + KCML_IC_TADDR_BSZ + KCML_IC_TTAG_BSZ) -1;
32
constant KCLI_TADDR_D : integer :=  2 + KCML_IC_TLINE_BSZ;
33
constant KCLI_TADDR_U : integer := (2 + KCML_IC_TLINE_BSZ + KCML_IC_TADDR_BSZ) -1;
34
constant KCLI_TLINE_D : integer :=  2;
35
constant KCLI_TLINE_U : integer := (2 + KCML_IC_TLINE_BSZ ) -1;
36
 
37
-- addr to cmem-data fields/access layout
38
constant KCLI_DADDR_D : integer :=  2 + KCML_IC_DLINE_BSZ;
39
constant KCLI_DADDR_U : integer := (2 + KCML_IC_DLINE_BSZ + KCML_IC_DADDR_BSZ) -1;
40
constant KCLI_DLINE_D : integer :=  2;
41
constant KCLI_DLINE_U : integer := (2 + KCML_IC_DLINE_BSZ ) -1;
42
 
43
function kcli_is_taghit (
44
  addr : std_logic_vector(31 downto 0);
45
  cline : kcml_ketyp_ic_tline
46
) return boolean;
47
 
48
function kcli_is_linevalid (
49
  addr : std_logic_vector(31 downto 0);
50
  cline : kcml_ketyp_ic_tline
51
) return boolean;
52
 
53
-- check weather next is last of line
54
function kcli_is_onetogo(
55
  addr : std_logic_vector(31 downto 0)
56
) return boolean;
57
 
58
end kecs_libicache;
59
 
60
package body kecs_libicache is
61
 
62
function kcli_is_taghit (
63
  addr : std_logic_vector(31 downto 0);
64
  cline : kcml_ketyp_ic_tline
65
) return boolean is
66
  variable tmp : boolean;
67
  variable tag : std_logic_vector(KCLI_TTAG_U downto KCLI_TTAG_D);
68
begin
69
  tmp := false;
70
  tag := addr(KCLI_TTAG_U downto KCLI_TTAG_D);
71
  if (tag = cline.tag) then
72
    tmp := true;
73
  end if;
74
  return tmp;
75
end;
76
 
77
function kcli_is_linevalid (
78
  addr : std_logic_vector(31 downto 0);
79
  cline : kcml_ketyp_ic_tline
80
) return boolean is
81
  variable tmp : boolean;
82
  variable line : std_logic_vector(KCLI_TLINE_U downto KCLI_TLINE_D);
83
begin
84
  tmp := false;
85
  line := addr(KCLI_TLINE_U downto KCLI_TLINE_D);
86
  if (cline.valid(khin_convint(line)) = '1')
87
  then
88
    tmp := true;
89
  end if;
90
  return tmp;
91
end;
92
 
93
constant lastaddr : std_logic_vector(KCML_IC_TLINE_BSZ-1 downto 0) := (others=>'1');
94
 
95
function kcli_is_onetogo (
96
  addr : std_logic_vector(31 downto 0)
97
) return boolean is
98
  variable tmp : boolean;
99
begin
100
  tmp := false;
101
  if addr(KCLI_TLINE_U downto KCLI_TLINE_D+1) = lastaddr(KCML_IC_TLINE_BSZ-1 downto 1) then
102
    tmp := true;
103
  end if;
104
  return tmp;
105
end;
106
 
107
end kecs_libicache;
108
 

powered by: WebSVN 2.1.0

© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.