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

Subversion Repositories core_arm

[/] [core_arm/] [trunk/] [vhdl/] [sparc/] [mmulrue.vhd] - Blame information for rev 5

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 tarookumic
----------------------------------------------------------------------------
2
--  This file is a part of the LEON VHDL model
3
--  Copyright (C) 2003  Gaisler Research, all rights reserved
4
--
5
--  This library is free software; you can redistribute it and/or
6
--  modify it under the terms of the GNU Lesser General Public
7
--  License as published by the Free Software Foundation; either
8
--  version 2 of the License, or (at your option) any later version.
9
--
10
--  See the file COPYING.LGPL for the full details of the license.
11
----------------------------------------------------------------------------
12
 
13
-- Konrad Eisele<eiselekd@web.de> ,2002  
14
 
15
library ieee;
16
use ieee.std_logic_1164.all;
17
use IEEE.std_logic_arith.all;
18
use IEEE.std_logic_unsigned."+";
19
use IEEE.std_logic_unsigned.conv_integer;
20
use work.leon_iface.all;
21
use work.leon_config.all;
22
use work.mmuconfig.all;
23
use work.leon_target.all;
24
 
25
entity mmulrue is
26
  generic (
27
    position : integer;
28
    entries  : integer := 8 );
29
  port (
30
    rst    : in std_logic;
31
    clk    : in clk_type;
32
    lruei  : in mmulrue_in_type;
33
    lrueo  : out mmulrue_out_type );
34
end mmulrue;
35
 
36
architecture rtl of mmulrue is
37
 
38
  constant entries_log : integer := log2(entries);
39
  type lru_rtype is record
40
    pos      : std_logic_vector(entries_log-1 downto 0);
41
    movetop  : std_logic;
42
    -- pragma translate_off
43
    dummy  : std_logic;
44
    -- pragma translate_on
45
  end record;
46
 
47
  signal c,r   : lru_rtype;
48
begin
49
 
50
  p0: process (clk, rst, r, c, lruei)
51
    variable v : lru_rtype;
52
  begin
53
    v := r;
54
    -- #init
55
 
56
    if (r.movetop and (not lruei.fromleft)) = '1' then
57
      v.pos := lruei.left(entries_log-1 downto 0);
58
      v.movetop := '0';
59
    elsif (lruei.fromright) = '1' then
60
      v.pos := lruei.right(entries_log-1 downto 0);
61
      v.movetop := not lruei.clear;
62
    end if;
63
 
64
    if (lruei.touch and not lruei.clear) = '1' then  -- touch request
65
      if (v.pos = lruei.pos(entries_log-1 downto 0)) then     -- check
66
          v.movetop := '1';
67
      end if;
68
    end if;
69
 
70
    if (rst) = '0' then
71
      v.pos := std_logic_vector(conv_unsigned(position, entries_log));
72
      v.movetop := '0';
73
    end if;
74
 
75
    --# Drive signals
76
    lrueo.pos(entries_log-1 downto 0) <= r.pos;
77
    lrueo.movetop <= r.movetop;
78
 
79
    c <= v;
80
  end process p0;
81
 
82
  p1: process (clk)
83
  begin if rising_edge(clk) then r <= c; end if;
84
  end process p1;
85
 
86
end rtl;
87
 
88
 
89
 
90
 
91
 
92
 
93
 
94
 

powered by: WebSVN 2.1.0

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