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

Subversion Repositories core_arm

[/] [core_arm/] [trunk/] [vhdl/] [arm/] [armcmd_lm.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.armpctrl.all;
8
use work.armpmodel.all;
9
use work.armcmd.all;
10
use work.armldst.all;
11
use work.armdecode.all;
12
use work.arm_comp.all;
13
use work.armcmd_comp.all;
14
 
15
entity armcmd_lm is
16
  port (
17
    rst     : in  std_logic;
18
    clk     : in  std_logic;
19
    i       : in  armcmd_lm_typ_in;
20
    o       : out armcmd_lm_typ_out
21
    );
22
end armcmd_lm;
23
 
24
architecture rtl of armcmd_lm is
25
 
26
  type armcmd_lm_tmp_type is record
27
    o       : armcmd_lm_typ_out;
28
    ctrlmemo : acm_ctrlmemout;
29
    cnt : std_logic_vector(ACM_CNT_SZ-1 downto 0);
30
  end record;
31
  type armcmd_lm_reg_type is record
32
    cnt : std_logic_vector(ACM_CNT_SZ-1 downto 0);
33
  end record;
34
  type armcmd_lm_dbg_type is record
35
     dummy : std_logic;
36
     -- pragma translate_off
37
     dbg : armcmd_lm_tmp_type;
38
     -- pragma translate_on
39
  end record;
40
  signal r, c       : armcmd_lm_reg_type;
41
  signal rdbg, cdbg : armcmd_lm_dbg_type;
42
 
43
begin
44
 
45
  p0: process (clk, rst, r, i  )
46
    variable v    : armcmd_lm_reg_type;
47
    variable t    : armcmd_lm_tmp_type;
48
    variable vdbg : armcmd_lm_dbg_type;
49
  begin
50
 
51
    -- $(init(t:armcmd_lm_tmp_type))
52
 
53
    v := r;
54
 
55
    t.cnt := i.ctrli.cnt;
56
 
57
    t.o.ctrlo := i.ctrli.ctrlo;
58
    t.o.ctrlo.nextinsn := '0';
59
 
60
    t.ctrlmemo := i.ctrlmulti.ctrlmemo;
61
 
62
--t.cmdldmo.ctrlo.usermode_nc := t.usermode_nc;
63
 
64
    -- LRM/STM: Increment after  (regorder [0-15],start:+0,end(onwb):+4) :ldmia|stmia <rn>,{<reglist>}
65
    -- LRM/STM: Increment before (regorder [0-15],start:+4,end(onwb):+0) :ldmib|stmib <rn>,{<reglist>}
66
    -- LRM/STM: Decrement after  (regorder [15-0],start:-0,end(onwb):-4) :ldmda|stmda <rn>,{<reglist>}
67
    -- LRM/STM: Decrement before (regorder [15-0],start:-4,end(onwb):-0) :ldmdb|stmdb <rn>,{<reglist>}
68
    case i.ctrli.cnt is
69
      when ACM_CNT_ZERO =>
70
        -- [frame: ctrli.cnt=0] start address issue 
71
        --
72
        --             RRSTG      RSSTG       EXSTG       DMSTG       MESTG     WRSTG          
73
        --      --+-----------+-----------+-----------+-----------+-----------+---------+          
74
        --  <rn>->+-----------+-+--------op1          |           |           |                   
75
        --        |           | +>[buf1]  | \         |           |           |                   
76
        --        | (regread) |           | +(aluop)+ |  +(trans) | +>(dcache-+-+->(write)       
77
        --        |           |           | /   |     |  |   |    | |         | |                   
78
        --        |           | startoff-op2    |     |  |   |    | |         | |                   
79
        --      --+-----------+-----------+-----+-----+--+---+----+-+---------+-+-------+
80
        --                                      |        |   |      |           |                   
81
        --         pctrl.data1 (as address)  :  +--------+   +------+           |                             
82
        --  cyceven:pctrl.me.param: o-------------------------------+           |                      
83
        --          pctrl.wr.rd(<nxtreg>):o-------------------------------------+
84
 
85
 
86
        t.ctrlmemo.rsop_op1_src := apc_opsrc_through;      -- route <rn> to exestg op1
87
        t.ctrlmemo.r1_src := acm_rrn;                      -- fetch <rn> (address base)
88
        t.ctrlmemo.rsop_op2_src := apc_opsrc_none;         -- route 0|4 to exestg op2
89
        t.ctrlmemo.data2 := i.ctrlmulti.soff;         -- dep. LDSTM amode: 0|(-)4
90
        t.ctrlmemo.rsop_buf1_src := apc_bufsrc_through;    -- save <rn> for writeback
91
        t.ctrlmemo.exop_data_src := apc_datasrc_aluout;    -- save aluresult (address in(de)cerement) as MESTG_address
92
        t.ctrlmemo.rd_src := acm_rdlocal;                  -- write to rnext (MESTG result)
93
 
94
        t.ctrlmemo.meop_param.read  := '1';                -- MESTG: dcache inputs (readdata)
95
        t.ctrlmemo.meop_param.addrin  := '1';              -- MESTG: dcache inputs (tag cmp)
96
        t.ctrlmemo.meop_enable := '1';                     -- MESTG: dcache inputs
97
 
98
        if i.ctrlmulti.mem = '1' then
99
          t.o.ctrlo.hold := '1';                      -- wait for all mem cmd to finish first
100
        end if;
101
 
102
      when others       =>
103
 
104
        -- [frame: ctrli.cnt!=0] address issue 
105
        --
106
        --             RRSTG      RSSTG       EXSTG       DMSTG       MESTG       WRSTG           
107
        --      --+-----------+-----------+-----------+-----------+-----------+----------+           
108
        --        |           | (lastalu)op1          |           |           |
109
        --        |           |           | \         |           |           |
110
        --        | (regread) |           | +(aluop)  |  +(trans) | +>(dcache)+-+->(write)
111
        --        |           |           | /   |     |  |   |    | |         | |
112
        --        |           | in/Decr--op2    |     |  |   |    | |         | |           
113
        --      --+-----------+-----------+-----+-----+--+---+----+-+---------+-+--------+           
114
        --                                      |        |   |      |           |                      
115
        --         pctrl.data1 (as address)  :  +--------+   +------+           |                      
116
        --  cyceven:pctrl.me.param: o-------------------------------+           |                      
117
        --          pctrl.wr.rd(<nxtreg>):o-------------------------------------+
118
 
119
        t.ctrlmemo.rsop_op1_src := apc_opsrc_alures;       -- route <lastalu> to exestg op1
120
        t.ctrlmemo.rsop_op2_src := apc_opsrc_none;         -- route 0|(-)4 to exestg op2
121
        t.ctrlmemo.data2 := i.ctrlmulti.ival;         -- dep. LDSTM amode: 0|(-)4
122
        t.ctrlmemo.exop_data_src := apc_datasrc_aluout;    -- save aluresult (address in(de)cerement) as MESTG_address
123
        t.ctrlmemo.rd_src := acm_rdlocal;                  -- write to rnext (MESTG result)
124
 
125
        t.ctrlmemo.meop_param.read  := '1';                -- MESTG: dcache inputs (readdata)
126
        t.ctrlmemo.meop_param.addrin  := '1';              -- MESTG: dcache inputs (tag cmp)
127
        t.ctrlmemo.meop_enable := '1';                     -- MESTG: dcache inputs
128
 
129
    end case;
130
 
131
    -- finish - update <rn>
132
    if i.ctrlmulti.reglist = ALS_REGLIST_ZERO then
133
 
134
      t.ctrlmemo.meop_enable := '0';                  -- MESTG: dcache inputs
135
      t.ctrlmemo.rd_src := acm_rdnone;                  -- no rdwrite 
136
 
137
      if v.cnt(0) = i.ctrli.cnt(0) then
138
 
139
        if i.ctrlmulti.mem = '1' then
140
          t.o.ctrlo.hold := '1'; -- wait for all mem cmd to finish
141
        else
142
          t.o.ctrlo.nextinsn := '1';
143
        end if;
144
 
145
      else
146
 
147
          -- [frame:] update <rn>
148
          --
149
          --             RRSTG      RSSTG       EXSTG       DMSTG       MESTG       WRSTG
150
          --      --+-----------+-----------+-----------+-----------+-----------+----------+
151
          --        |           |(lastalu)-op1          |           |           |
152
          --        |           |           | \         |           |           |
153
          --        | (regread) |           | +(aluop)  |   (trans) | (dcache)  | +->(write)
154
          --        |           |           | /   |     |           |           | | 
155
          --        |           |  in/Decr-op2    |     |           |           | |
156
          --      --+-----------+-----------+-----+-----+-----------+-----------+-+--------+
157
          --                                      |                               |                 
158
          --         pctrl.data1 (as wrdata):     +-------------------------------+
159
 
160
          t.ctrlmemo.rsop_op1_src := apc_opsrc_alures;       -- route <lastalu> to exestg op1
161
          t.ctrlmemo.rsop_op2_src := apc_opsrc_none;         -- route 0|(-)4 to exestg op2
162
          t.ctrlmemo.data1 := i.ctrlmulti.eoff;       -- dep. LDSTM amode: 0|(-)4
163
          if i.ctrli.insn.insn(ADE_WB_C) = '1' then
164
            t.ctrlmemo.rd_src := acm_rdrrn;
165
          end if;
166
 
167
      end if;
168
 
169
    else
170
      v.cnt := i.ctrli.cnt;
171
    end if;
172
 
173
    -- dabort
174
    if not (i.ctrli.cnt = ACM_CNT_ZERO) then
175
      if i.ctrlmulti.dabort = '1' then
176
 
177
        t.o.ctrlo.nextinsn := '1';
178
 
179
        -- dabort frame, writeback <rn>
180
        --
181
        --             RRSTG      RSSTG       EXSTG       DMSTG       MESTG       WRSTG
182
        --      --+-----------+-----------+-----------+-----------+-----------+----------+
183
        --        |           |  [buf1] -op1          |           |           |
184
        --        |           |           | \         |           |           |
185
        --        | (regread) |           | +(aluop)  |   (trans) | (dcache)  | +->(write)
186
        --        |           |           | /   |     |           |           | | 
187
        --        |           |   0     -op2    |     |           |           | |
188
        --      --+-----------+-----------+-----+-----+-----------+-----------+-+--------+
189
        --                                      |                               |                 
190
        --         pctrl.data1 (as wrdata):     +-------------------------------+   
191
 
192
        t.ctrlmemo.rd_src := acm_rdrrn;
193
        t.ctrlmemo.rsop_op1_src := apc_opsrc_buf;        -- route old <rn> to exestg op1 (saved in cycle zero)
194
        t.ctrlmemo.rsop_op2_src := apc_opsrc_none;       -- route 0 to exestg op2
195
        t.ctrlmemo.data2 := (others => '0');
196
 
197
        t.ctrlmemo.meop_enable := '0';                   -- MESTG: dcache inputs
198
      end if;
199
    end if;
200
 
201
    -- reset
202
    if ( rst = '0' ) then
203
    end if;
204
 
205
    t.o.ctrlmemo := t.ctrlmemo;
206
 
207
 
208
    c <= v;
209
 
210
    o <= t.o;
211
 
212
    -- reset
213
    if ( rst = '0' ) then
214
    end if;
215
 
216
    c <= v;
217
 
218
    o <= t.o;
219
 
220
    -- pragma translate_off
221
    vdbg := rdbg;
222
    vdbg.dbg := t;
223
    cdbg <= vdbg;
224
    -- pragma translate_on  
225
 
226
  end process p0;
227
 
228
  pregs : process (clk, c)
229
  begin
230
    if rising_edge(clk) then
231
      r <= c;
232
      -- pragma translate_off
233
      rdbg <= cdbg;
234
      -- pragma translate_on
235
    end if;
236
  end process;
237
 
238
end rtl;

powered by: WebSVN 2.1.0

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