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

Subversion Repositories core_arm

[/] [core_arm/] [trunk/] [vhdl/] [arm/] [armcmd_sr.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.armcmd.all;
8
use work.armpctrl.all;
9
use work.armpmodel.all;
10
use work.armdecode.all;
11
use work.armshiefter.all;
12
use work.armcmd_comp.all;
13
 
14
entity armcmd_sr is
15
  port (
16
    rst     : in  std_logic;
17
    clk     : in  std_logic;
18
    i       : in  armcmd_sr_typ_in;
19
    o       : out armcmd_sr_typ_out
20
    );
21
end armcmd_sr;
22
 
23
architecture rtl of armcmd_sr is
24
 
25
  type armcmd_sr_tmp_type is record
26
    o       : armcmd_sr_typ_out;
27
  end record;
28
  type armcmd_sr_reg_type is record
29
    dummy      : std_logic;
30
  end record;
31
  type armcmd_sr_dbg_type is record
32
     dummy : std_logic;
33
     -- pragma translate_off
34
     dbg : armcmd_sr_tmp_type;
35
     -- pragma translate_on
36
  end record;
37
  signal r, c       : armcmd_sr_reg_type;
38
  signal rdbg, cdbg : armcmd_sr_dbg_type;
39
 
40
begin
41
 
42
  p0: process (clk, rst, r, i  )
43
    variable v    : armcmd_sr_reg_type;
44
    variable t    : armcmd_sr_tmp_type;
45
    variable vdbg : armcmd_sr_dbg_type;
46
  begin
47
 
48
    -- $(init(t:armcmd_sr_tmp_type))
49
 
50
    v := r;
51
 
52
    t.o.ctrlo    := i.ctrli.ctrlo;
53
 
54
    t.o.r2_src  := acm_none;
55
    t.o.rd_src  := acm_rdnone;
56
 
57
    t.o.rsop_op2_src := apc_opsrc_none;
58
    t.o.rsop_styp := ash_styp_none;
59
    t.o.rsop_sdir := ash_sdir_snone;
60
    t.o.exop_setcpsr := '0';
61
 
62
    case i.ctrli.insn.decinsn is
63
      when type_arm_mrs =>
64
        t.o.rd_src  := acm_rdrrd;
65
      when type_arm_msr =>
66
 
67
        case i.ctrli.cnt is
68
          when ACM_CNT_ZERO =>
69
 
70
            -- [frame:] 
71
            --            RRSTG   |   RSSTG       EXSTG       DMSTG       MESTG       WRSTG
72
            --      --+-----------+-----------+-----------+-----------+-----------+----------+
73
            --        |           +           |           |           |           |
74
            --        |           |           | [cpsr]    |           |           |
75
            --        |  (regread)|  (shift)  |  | (aluop)|  (trans)  |   (dcache)| +(write)
76
            --        |           |    V      |  |        |           |           | | 
77
            --        |           |  [imrot]-op2-msr/rs   |           |           | +[spsr]
78
            --      --+-----------+-----------+-----+-----+-----------+-----------+-+--------+
79
            --                                      |                               | 
80
            --   (as wrdata on mrs) pctrl.data1:    +-------------------------------+    
81
            --   (as wrdata on msr[spsr]) 
82
 
83
            -- msr CPSR_[cxsf],#<imm>
84
            -- msr CPSR_[cxsf],<rm>  
85
            -- msr SPSR_[cxsf],#<imm>
86
            -- msr SPSR_[cxsf],<rm>  
87
 
88
            t.o.ctrlo.nextinsn := '0';
89
 
90
            t.o.rd_src  := acm_rdnone;
91
            t.o.rsop_op2_src := apc_opsrc_through;
92
 
93
            if i.ctrli.insn.insn(APM_MSR_F) = '1' or
94
              i.ctrli.insn.insn(APM_MSR_X) = '1' or
95
              i.ctrli.insn.insn(APM_MSR_S) = '1' then
96
              t.o.exop_setcpsr := '1';
97
            end if;
98
 
99
            if i.ctrli.insn.insn(ADE_MSR_IMM) = '1' then
100
              t.o.r2_src    := acm_none;
101
              t.o.rsop_styp := ash_styp_immrot;
102
              t.o.rsop_sdir := ash_sdir_snone;
103
            else
104
              t.o.r2_src    := acm_rrm;
105
              t.o.rsop_styp := ash_styp_none;
106
              t.o.rsop_sdir := ash_sdir_snone;
107
            end if;
108
 
109
          when others =>
110
            t.o.ctrlo.nextinsn := '0';
111
            t.o.ctrlo.hold := '1';
112
 
113
            -- wait until cmd commits
114
            if i.ctrli.insn.insn(ADE_MSR_R) = '1' then
115
              if (i.wrvalid = '1') and
116
                 (i.wrid = i.deid) then
117
                t.o.ctrlo.nextinsn := '1';
118
                t.o.ctrlo.hold := '0';
119
              end if;
120
            else
121
              if (i.exvalid = '1') and
122
                 (i.exid = i.deid) then
123
                t.o.ctrlo.nextinsn := '1';
124
                t.o.ctrlo.hold := '0';
125
              end if;
126
            end if;
127
        end case;
128
      when others       =>
129
    end case;
130
 
131
    -- reset
132
    if ( rst = '0' ) then
133
    end if;
134
 
135
    c <= v;
136
 
137
    o <= t.o;
138
 
139
 
140
    -- pragma translate_off
141
    vdbg := rdbg;
142
    vdbg.dbg := t;
143
    cdbg <= vdbg;
144
    -- pragma translate_on  
145
 
146
  end process p0;
147
 
148
  pregs : process (clk, c)
149
  begin
150
    if rising_edge(clk) then
151
      r <= c;
152
      -- pragma translate_off
153
      rdbg <= cdbg;
154
      -- pragma translate_on
155
    end if;
156
  end process;
157
 
158
end rtl;

powered by: WebSVN 2.1.0

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