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

Subversion Repositories core_arm

[/] [core_arm/] [trunk/] [vhdl/] [arm/] [armiu_mestg.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
-- $(lic)
2
-- $(help_generic)
3
-- $(help_local)
4
 
5
library ieee;
6
use ieee.std_logic_1164.all;
7
use work.armpctrl.all;
8
use work.armdecode.all;
9
use work.arm_comp.all;
10
use work.armpmodel.all;
11
use work.ctrl_comp.all;
12
 
13
entity armiu_mestg is
14
  port (
15
    rst     : in  std_logic;
16
    clk     : in  std_logic;
17
    i       : in  armiu_mestg_typ_in;
18
    o       : out armiu_mestg_typ_out
19
    );
20
end armiu_mestg;
21
 
22
architecture rtl of armiu_mestg is
23
 
24
  type armiu_mestg_tmp_type is record
25
    o       : armiu_mestg_typ_out;
26
    commit : std_logic;
27
    meid : std_logic_vector(2 downto 0);
28
    wrid : std_logic_vector(2 downto 0);
29
  end record;
30
  type armiu_mestg_reg_type is record
31
    pctrl : apc_pctrl;
32
    mexc : std_logic;
33
  end record;
34
  type armiu_mestg_dbg_type is record
35
     dummy : std_logic;
36
     -- pragma translate_off
37
     dbg : armiu_mestg_tmp_type;
38
     -- pragma translate_on
39
  end record;
40
  signal r, c       : armiu_mestg_reg_type;
41
  signal rdbg, cdbg : armiu_mestg_dbg_type;
42
 
43
begin
44
 
45
  p0: process (clk, rst, r, i  )
46
    variable v    : armiu_mestg_reg_type;
47
    variable t    : armiu_mestg_tmp_type;
48
    variable vdbg : armiu_mestg_dbg_type;
49
  begin
50
 
51
    -- $(init(t:armiu_mestg_tmp_type))
52
 
53
    v := r;
54
    t.commit := not i.flush_v ;
55
 
56
    t.meid := i.pstate.fromME_pctrl_r.insn.id;
57
    t.wrid := i.pstate.fromWR_pctrl_r.insn.id;
58
 
59
    --if i.dco.me_mexc = '1' then
60
    --  v.mexc := '1';
61
    --end if;
62
 
63
    -- swp addresses
64
    t.o.dci.addr_in := i.pstate.fromDM_pctrl_r.data1;
65
    case i.pstate.fromDM_pctrl_r.insn.decinsn is
66
      when type_arm_swp =>
67
        t.o.dci.addr_in(1 downto 0) := (others => '0');
68
      when others =>
69
    end case;
70
    t.o.dci.addr_re := r.pctrl.data1;
71
    t.o.dci.atomic_readwrite := '0';
72
    case r.pctrl.insn.decinsn is
73
      when type_arm_swp =>
74
        t.o.dci.addr_re(1 downto 0) := (others => '0');
75
        t.o.dci.atomic_readwrite := '1';
76
      when others =>
77
    end case;
78
 
79
    -- reset
80
    if ( rst = '0' ) then
81
      v.mexc := '0';
82
    end if;
83
 
84
    -- pipeline propagation
85
    t.o.pctrl_r := r.pctrl;
86
    t.o.toWR_pctrl_v := v.pctrl;
87
 
88
    -- irq
89
    if (not (i.irqo.irl = IRQ_NOIRQ)) and
90
       (not (t.meid = t.wrid)) then
91
      t.commit := '0';
92
      t.o.toWR_pctrl_v.wr.wrop_trap.trap := '1';
93
      t.o.toWR_pctrl_v.wr.wrop_trap.traptype := apm_trap_irq;
94
      t.o.toWR_pctrl_v.data2(3 downto 0) := i.irqo.irl;
95
    end if;
96
 
97
    -- dcache input
98
    t.o.dci.data_in  := i.pstate.fromDM_pctrl_r.data2;
99
    t.o.dci.data_re  := r.pctrl.data2;
100
 
101
    t.o.dci.addrin_re := r.pctrl.me.meop_param.addrin and
102
                         r.pctrl.valid;
103
    t.o.dci.annul := (not t.commit) ;
104
    t.o.dci.forcewrite := '0';
105
    t.o.dci.forceread := '0';
106
 
107
    t.o.dci.param_r.size      := r.pctrl.me.meop_param.size;
108
    t.o.dci.param_r.read      := r.pctrl.me.meop_param.read;
109
    t.o.dci.param_r.lock      := r.pctrl.me.meop_param.lock;
110
    t.o.dci.param_r.writedata := r.pctrl.me.meop_param.writedata;
111
    t.o.dci.param_r.addrin    := r.pctrl.me.meop_param.addrin;
112
    t.o.dci.param_r.signed    := r.pctrl.me.meop_param.signed;
113
 
114
    -- pipeline flush
115
    if not (t.commit = '1') then
116
      t.o.toWR_pctrl_v.valid := '0';
117
    end if;
118
 
119
    if i.pstate.hold_r.hold = '0' then
120
      v.pctrl := i.fromDM_pctrl_v;
121
    end if;
122
 
123
    c <= v;
124
 
125
    o <= t.o;
126
 
127
    -- pragma translate_off
128
    vdbg := rdbg;
129
    vdbg.dbg := t;
130
    cdbg <= vdbg;
131
    -- pragma translate_on  
132
 
133
  end process p0;
134
 
135
  pregs : process (clk, c)
136
  begin
137
    if rising_edge(clk) then
138
      r <= c;
139
      -- pragma translate_off
140
      rdbg <= cdbg;
141
      -- pragma translate_on
142
    end if;
143
  end process;
144
 
145
end rtl;

powered by: WebSVN 2.1.0

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