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

Subversion Repositories core_arm

[/] [core_arm/] [trunk/] [vhdl/] [mem/] [cache/] [kecs_wb.vhd] - Blame information for rev 6

Go to most recent revision | 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.iface.all;
9
use work.target.all;
10
use work.kecs_config.all;
11
use work.kecs_libiface.all;
12
use work.kecs_libwb.all;
13
use work.kehl_libint.all;
14
use work.kebu_libahb.all;
15
use work.kecs_libcomp.all;
16
use work.kems_libbase.all;
17
 
18
entity kecs_wb is
19
  port (
20
    rst     : in  std_logic;
21
    clk     : in  clk_type;
22
    wbi  : in  kcif_ketyp_wb_in;
23
    wbo  : out kcif_ketyp_wb_out;
24
    mcwbo : in kbah_ketyp_out;
25
    mcwbi : out kbah_ketyp_in
26
  );
27
end kecs_wb;
28
 
29
architecture rtl of kecs_wb is
30
 
31
  type kecswb_tmp_type is record
32
     wbo   : kcif_ketyp_wb_out;
33
     wbfifoi : kcif_ketyp_wbfifo_in;
34
     consume : std_logic;
35
  end record;
36
  type kecswb_reg_type is record
37
     active : std_logic;
38
     mcwbi : kbah_ketyp_in;
39
     last_addr, last_data : std_logic_vector(31 downto 0);
40
  end record;
41
  type kecswb_dbg_type is record
42
     dummy : std_logic;
43
     -- pragma translate_off
44
     dbg : kecswb_tmp_type;
45
     -- pragma translate_on
46
  end record;
47
  signal r, c       : kecswb_reg_type;
48
  signal rdbg, cdbg : kecswb_dbg_type;
49
  signal wbfifoi : kcif_ketyp_wbfifo_in;
50
  signal wbfifoo : kcif_ketyp_wbfifo_out;
51
 
52
begin
53
 
54
  p0: process (clk, rst, r, wbi, mcwbo, wbfifoo )
55
    variable v    : kecswb_reg_type;
56
    variable t    : kecswb_tmp_type;
57
    variable vdbg : kecswb_dbg_type;
58
  begin
59
 
60
    -- $(init(t:kecswb_tmp_type))
61
    v := r;
62
 
63
    t.wbfifoi.fifo_read := '0';
64
    t.wbfifoi.fifo_write := '0';
65
    t.consume := '0';
66
 
67
    if mcwbo.ready = '1' then
68
      v.active := '0';
69
    end if;
70
 
71
    if v.active = '0' then
72
      if r.mcwbi.req = '0' and wbfifoo.fifo_empty_r = '0' then
73
        t.consume := '1';
74
      end if;
75
    end if;
76
 
77
    if mcwbo.grant = '1' then
78
      v.active := '1';
79
      v.mcwbi.req := '0';
80
      v.last_addr := r.mcwbi.address;
81
      v.last_data := r.mcwbi.data;
82
      if wbfifoo.fifo_empty_r = '0' then
83
        t.consume := '1';
84
      end if;
85
    end if;
86
 
87
    if mcwbo.retry = '1' then
88
      v.mcwbi.req := '1';
89
      v.mcwbi.address := r.last_addr;
90
      v.mcwbi.data := r.last_data;
91
    end if;
92
 
93
    if t.consume = '1' then
94
      v.mcwbi.req := '1';
95
      v.mcwbi.address := wbfifoo.fifo_entry.addr;
96
      v.mcwbi.data    := wbfifoo.fifo_entry.data;
97
      v.mcwbi.burst   := wbfifoo.fifo_entry.burst;
98
      v.mcwbi.size    := wbfifoo.fifo_entry.size;
99
      v.mcwbi.read := '0';
100
      v.mcwbi.lock := '0';
101
      t.wbfifoi.fifo_read := '1';
102
    end if;
103
 
104
    -- reset
105
    if ( rst = '0' ) then
106
      v.mcwbi.req := '0';
107
      v.active := '0';
108
    end if;
109
 
110
    t.wbfifoi.fifo_entry := wbi.fifo_entry;
111
    t.wbfifoi.fifo_write := wbi.fifo_write;
112
    t.wbo.fifo_stored_v  := wbfifoo.fifo_stored_v;
113
    t.wbo.empty_v := wbfifoo.fifo_empty_r and (not r.mcwbi.req) and (not r.active); -- might be v.active
114
 
115
    c <= v;
116
 
117
    wbfifoi <= t.wbfifoi;
118
    wbo <= t.wbo;
119
    mcwbi <= r.mcwbi;
120
 
121
    -- pragma translate_off
122
    vdbg := rdbg;
123
    vdbg.dbg := t;
124
    cdbg <= vdbg;
125
    -- pragma translate_on  end process p0;
126
 
127
  end process p0;
128
 
129
  pregs : process (clk, c)
130
  begin
131
    if rising_edge(clk) then
132
      r <= c;
133
      -- pragma translate_off
134
      rdbg <= cdbg;
135
      -- pragma translate_on
136
    end if;
137
  end process;
138
 
139
  gfifo0 : if KCLD_WBBUF_SZ > 0 generate
140
    fifo0 : kecs_wbfifo generic map ( WBBUF_SZ => KCLD_WBBUF_SZ )
141
      port map (rst, clk, wbfifoi, wbfifoo );
142
  end generate;
143
 
144
end rtl;
145
 

powered by: WebSVN 2.1.0

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