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.armdecode.all;
|
10 |
|
|
use work.armshiefter.all;
|
11 |
|
|
use work.armcmd.all;
|
12 |
|
|
use work.gendc_lib.all;
|
13 |
|
|
use work.armcmd_comp.all;
|
14 |
|
|
|
15 |
|
|
entity armcmd_st is
|
16 |
|
|
port (
|
17 |
|
|
rst : in std_logic;
|
18 |
|
|
clk : in std_logic;
|
19 |
|
|
i : in armcmd_st_typ_in;
|
20 |
|
|
o : out armcmd_st_typ_out
|
21 |
|
|
);
|
22 |
|
|
end armcmd_st;
|
23 |
|
|
|
24 |
|
|
architecture rtl of armcmd_st is
|
25 |
|
|
|
26 |
|
|
type armcmd_st_tmp_type is record
|
27 |
|
|
o : armcmd_st_typ_out;
|
28 |
|
|
ctrlmemo : acm_ctrlmemout;
|
29 |
|
|
off12 : std_logic_vector(31 downto 0);
|
30 |
|
|
off8 : std_logic_vector(31 downto 0);
|
31 |
|
|
am : ade_LDSTAMxLSV4AM;
|
32 |
|
|
end record;
|
33 |
|
|
|
34 |
|
|
type armcmd_st_reg_type is record
|
35 |
|
|
dummy : std_logic;
|
36 |
|
|
end record;
|
37 |
|
|
type armcmd_st_dbg_type is record
|
38 |
|
|
dummy : std_logic;
|
39 |
|
|
-- pragma translate_off
|
40 |
|
|
dbg : armcmd_st_tmp_type;
|
41 |
|
|
-- pragma translate_on
|
42 |
|
|
end record;
|
43 |
|
|
signal r, c : armcmd_st_reg_type;
|
44 |
|
|
signal rdbg, cdbg : armcmd_st_dbg_type;
|
45 |
|
|
|
46 |
|
|
begin
|
47 |
|
|
|
48 |
|
|
p0: process (clk, rst, r, i )
|
49 |
|
|
variable v : armcmd_st_reg_type;
|
50 |
|
|
variable t : armcmd_st_tmp_type;
|
51 |
|
|
variable vdbg : armcmd_st_dbg_type;
|
52 |
|
|
begin
|
53 |
|
|
|
54 |
|
|
-- $(init(t:armcmd_st_tmp_type))
|
55 |
|
|
|
56 |
|
|
v := r;
|
57 |
|
|
|
58 |
|
|
t.o.ctrlo := i.ctrli.ctrlo;
|
59 |
|
|
|
60 |
|
|
t.off8 := (others => '0');
|
61 |
|
|
t.off8(7 downto 0) := i.ctrli.insn.insn(ADE_LSV4AM_OFF8_HU downto ADE_LSV4AM_OFF8_HD) & i.ctrli.insn.insn(ADE_LSV4AM_OFF8_LU downto ADE_LSV4AM_OFF8_LD);
|
62 |
|
|
t.off12 := (others => '0');
|
63 |
|
|
t.off12(11 downto 0) := i.ctrli.insn.insn(ADE_LDSTAM_OFF_U downto ADE_LDSTAM_OFF_D); -- LDSTAM <offset12>
|
64 |
|
|
|
65 |
|
|
-- todo:
|
66 |
|
|
-- load user access memory access :am.LDSTAMxLSV4AM_uacc
|
67 |
|
|
|
68 |
|
|
-- switch str v1/v4
|
69 |
|
|
t.am := i.ctrli.insn.am.LDSTAM_typ;
|
70 |
|
|
t.ctrlmemo.data2 := t.off12; -- <offset12>
|
71 |
|
|
t.ctrlmemo := i.ctrlmemo;
|
72 |
|
|
t.o.rsop_styp := ash_styp_none;
|
73 |
|
|
t.o.rsop_sdir := i.ctrli.insn.am.DAPRAMxLDSTAM_sdir;
|
74 |
|
|
case i.ctrli.insn.decinsn is
|
75 |
|
|
when type_arm_str1 |
|
76 |
|
|
type_arm_str2 |
|
77 |
|
|
type_arm_str3 =>
|
78 |
|
|
t.am := i.ctrli.insn.am.LDSTAM_typ;
|
79 |
|
|
case t.am is
|
80 |
|
|
when ade_LDSTAMxLSV4AM_reg => t.o.rsop_styp := ash_styp_simm;
|
81 |
|
|
when others => null;
|
82 |
|
|
end case;
|
83 |
|
|
t.ctrlmemo.data2 := t.off12; -- <offset12>
|
84 |
|
|
when type_arm_strhb =>
|
85 |
|
|
t.am := i.ctrli.insn.am.LSV4AM_typ;
|
86 |
|
|
t.ctrlmemo.data2 := t.off8; -- <offset12>
|
87 |
|
|
when others => null;
|
88 |
|
|
end case;
|
89 |
|
|
|
90 |
|
|
-- addressing modes
|
91 |
|
|
case i.ctrli.cnt is
|
92 |
|
|
when ACM_CNT_ZERO =>
|
93 |
|
|
|
94 |
|
|
t.ctrlmemo.meop_param.read := '0'; -- MESTG: dcache inputs
|
95 |
|
|
t.ctrlmemo.meop_param.addrin := '1'; -- MESTG: dcache inputs (tag cmp)
|
96 |
|
|
t.ctrlmemo.meop_enable := '1'; -- MESTG: dcache inputs
|
97 |
|
|
|
98 |
|
|
t.ctrlmemo.exop_data_src := apc_datasrc_aluout;
|
99 |
|
|
case i.ctrli.insn.am.LDSTAMxLSV4AM_pos is
|
100 |
|
|
when ade_pre => t.ctrlmemo.exop_data_src := apc_datasrc_aluout;
|
101 |
|
|
when ade_post => t.ctrlmemo.exop_data_src := apc_datasrc_none;
|
102 |
|
|
when others =>
|
103 |
|
|
end case;
|
104 |
|
|
|
105 |
|
|
case t.am is
|
106 |
|
|
when ade_LDSTAMxLSV4AM_reg =>
|
107 |
|
|
-- L/S W/UB: Register Offset : [<rn>, +/-<rm>]
|
108 |
|
|
-- L/S W/UB: Register Offset pre-indexed : [<rn>, +/-<rm>]!
|
109 |
|
|
-- L/S W/UB: Register Offset post-indexed : [<rn>], +/-<rm>
|
110 |
|
|
-- L/S W/UB: Scaled Register Offset : [<rn>, +/-<rm>, <LSAMscale>]
|
111 |
|
|
-- L/S W/UB: Scaled Register Offset pre-indexed : [<rn>, +/-<rm>, <LSAMscale>]!
|
112 |
|
|
-- L/S W/UB: Scaled Register Offset post-indexed : [<rn>], +/-<rm>, <LSAMscale>
|
113 |
|
|
-- <LSAMscale>: {LSL #<imm>}|{LSR #<imm>}|{ASR #<imm>}|{ROR #<imm>}|{RRX}
|
114 |
|
|
-- adm_atyp_LSV4AM.adm_LSV4AM_reg:
|
115 |
|
|
-- - L/S MISC: Register offset : [<rn>, #+/-<rm>]
|
116 |
|
|
-- - L/S MISC: Register offset pre-index : [<rn>, #+/-<rm>] !
|
117 |
|
|
-- - L/S MISC: Register offset post-index : [<rn>], #+/-<rm>
|
118 |
|
|
|
119 |
|
|
-- [ctrli.cnt = 0:] address calculation (rn+/-rm <LSAMscale>)
|
120 |
|
|
--
|
121 |
|
|
-- RRSTG RSSTG EXSTG DMSTG MESTG WRSTG
|
122 |
|
|
-- --+-----------+-----------+-----------+-----------+-----------+----------+
|
123 |
|
|
-- <rn> ->+-----------+----------op1 | | |
|
124 |
|
|
-- | | | \ | | |
|
125 |
|
|
-- | (regread)| <imm>+ | +(aluop) | +(trans) | +>(dcache)| (write)
|
126 |
|
|
-- | | V | / | | | | | | |
|
127 |
|
|
-- <rm> ->+-----------+-(shift)--op2 | | | | | | |
|
128 |
|
|
-- --+-----------+-----------+-----+-----+--+---+----+-+---------+----------+
|
129 |
|
|
-- | | | |
|
130 |
|
|
-- pctrl.data1 (as address) : +--------+ +------+
|
131 |
|
|
-- cyc0:pctrl.me.param: o-----------------------------+
|
132 |
|
|
|
133 |
|
|
t.ctrlmemo.r1_src := acm_rrn; -- fetch <rn> (addrbase)
|
134 |
|
|
t.ctrlmemo.r2_src := acm_rrm; -- fetch <rm> (roff)
|
135 |
|
|
t.ctrlmemo.rsop_op1_src := apc_opsrc_through; -- route <rn> to EXSTG op1
|
136 |
|
|
t.ctrlmemo.rsop_op2_src := apc_opsrc_through; -- route <rm> to EXSTG op2
|
137 |
|
|
|
138 |
|
|
when ade_LDSTAMxLSV4AM_imm =>
|
139 |
|
|
-- L/S W/UB: Immediate Offset : [<rn>, #+/-<offset12>]
|
140 |
|
|
-- L/S W/UB: Immediate Offset pre-indexed : [<rn>, #+/-<offset12>]!
|
141 |
|
|
-- L/S W/UB: Immediate Offset post-indexed : [<rn>], #+/-<offset12>
|
142 |
|
|
-- - L/S MISC: Immediate offset : [<rn>, #+/-<off>]
|
143 |
|
|
-- - L/S MISC: Immediate offset pre-index : [<rn>, #+/-<off>] !
|
144 |
|
|
-- - L/S MISC: Immediate offset post-index : [<rn>], #+/-<off>
|
145 |
|
|
|
146 |
|
|
-- [ctrli.cnt = 0:] address calculation (rn+/-off)
|
147 |
|
|
--
|
148 |
|
|
-- RRSTG RSSTG EXSTG DMSTG MESTG WRSTG
|
149 |
|
|
-- --+-----------+-----------+-----------+-----------+-----------+----------+
|
150 |
|
|
-- <rn> ->+-----------+----------op1 | | |
|
151 |
|
|
-- | | | \ | | |
|
152 |
|
|
-- | (regread)| (noshift) | +(aluop) | +(trans) | +>(dcache)| (write)
|
153 |
|
|
-- | | | / | | | | | | |
|
154 |
|
|
-- | |<offset12>op2 | | | | | | |
|
155 |
|
|
-- --+-----------+-----------+-----+-----+-+---+-----+-+---------+----------+
|
156 |
|
|
-- | | | |
|
157 |
|
|
-- pctrl.data1 (as address) : +-------+ +-------+
|
158 |
|
|
-- cyc0:pctrl.me.param: o------------------------------+
|
159 |
|
|
|
160 |
|
|
t.ctrlmemo.r1_src := acm_rrn; -- fetch <rn> (addrbase)
|
161 |
|
|
t.ctrlmemo.data2 := t.off12; -- <offset12>
|
162 |
|
|
t.ctrlmemo.rsop_op1_src := apc_opsrc_through; -- route <rn> to exestg op1
|
163 |
|
|
t.ctrlmemo.rsop_op2_src := apc_opsrc_none; -- route <offset12> to exestg op2
|
164 |
|
|
when others => null;
|
165 |
|
|
end case;
|
166 |
|
|
|
167 |
|
|
t.o.ctrlo.nextinsn := '0';
|
168 |
|
|
|
169 |
|
|
when ACM_CNT_ONE =>
|
170 |
|
|
-- [ctrli.cnt = 1:] send writedata
|
171 |
|
|
--
|
172 |
|
|
-- RRSTG RSSTG EXSTG DMSTG MESTG WRSTG
|
173 |
|
|
-- --+-----------+-----------+-----------+-----------+-----------+-----------
|
174 |
|
|
-- <rd>->|-+ |(alulast) | | | |
|
175 |
|
|
-- | | | V | | | |
|
176 |
|
|
-- | | | [buf] | | +-+->(dcache) |
|
177 |
|
|
-- | | | | | | | /\ |
|
178 |
|
|
-- | | | | | | | | |
|
179 |
|
|
-- --+-+---------+-----------+-----------+---------+-+-----+-----+-----------
|
180 |
|
|
-- | | |
|
181 |
|
|
-- +->pctrl.data2 (as memwritedata): ----------+ |
|
182 |
|
|
-- cyc1:pctrl.me.param: o----------------------+ |
|
183 |
|
|
-- cyc0:pctrl.data1: o------------------------------+
|
184 |
|
|
|
185 |
|
|
t.ctrlmemo.rsop_buf1_src := apc_bufsrc_alures; -- save for writeback
|
186 |
|
|
|
187 |
|
|
t.ctrlmemo.r2_src := acm_rrd; -- fetch <rd> write data
|
188 |
|
|
--t.ctrlmemo.rrop_data_src := apc_datasrc_r2; -- save <rd> as MESTG_data
|
189 |
|
|
t.ctrlmemo.meop_param.read := '0'; -- MESTG: dcache inputs
|
190 |
|
|
t.ctrlmemo.meop_param.writedata := '1'; -- MESTG: dcache inputs (wr data)
|
191 |
|
|
t.ctrlmemo.meop_enable := '1'; -- MESTG: dcache inputs
|
192 |
|
|
|
193 |
|
|
if i.ctrli.insn.am.LDSTAMxLSV4AM_wb = '1' then
|
194 |
|
|
|
195 |
|
|
-- update baseregister
|
196 |
|
|
--
|
197 |
|
|
-- RRSTG RSSTG EXSTG DMSTG MESTG WRSTG
|
198 |
|
|
-- --+-----------+-----------+-----------+-----------+-----------+-----------
|
199 |
|
|
-- | | [buf]-+ | | |
|
200 |
|
|
-- | | | \ | | |
|
201 |
|
|
-- | | | +(aluop) | | (dcache) | +>(write)
|
202 |
|
|
-- | | | / | | | | |
|
203 |
|
|
-- | | (0) -+ | | | | |
|
204 |
|
|
-- --+-----------+-----------+-----+-----+-----------+-----------+-+---------
|
205 |
|
|
-- | |
|
206 |
|
|
-- pctrl.data1 (as rddata): +-------------------------------+
|
207 |
|
|
-- pctrl.wr.rd (<rn>): o----------------------------------------+
|
208 |
|
|
|
209 |
|
|
t.ctrlmemo.rsop_op1_src := apc_opsrc_buf; -- route buf (former alures) to exestg op1
|
210 |
|
|
t.ctrlmemo.rsop_op2_src := apc_opsrc_none; -- route 0 to exestg op2
|
211 |
|
|
t.ctrlmemo.data2 := (others => '0'); -- imm 0
|
212 |
|
|
t.ctrlmemo.exop_data_src := apc_datasrc_aluout; -- save aluresult as WRSTG_data
|
213 |
|
|
t.ctrlmemo.rd_src := acm_rdrrn; -- <rn>
|
214 |
|
|
|
215 |
|
|
end if;
|
216 |
|
|
|
217 |
|
|
when others =>
|
218 |
|
|
|
219 |
|
|
|
220 |
|
|
end case;
|
221 |
|
|
|
222 |
|
|
t.o.ctrlmemo := t.ctrlmemo;
|
223 |
|
|
|
224 |
|
|
-- reset
|
225 |
|
|
if ( rst = '0' ) then
|
226 |
|
|
end if;
|
227 |
|
|
|
228 |
|
|
c <= v;
|
229 |
|
|
|
230 |
|
|
o <= t.o;
|
231 |
|
|
|
232 |
|
|
-- pragma translate_off
|
233 |
|
|
vdbg := rdbg;
|
234 |
|
|
vdbg.dbg := t;
|
235 |
|
|
cdbg <= vdbg;
|
236 |
|
|
-- pragma translate_on
|
237 |
|
|
|
238 |
|
|
end process p0;
|
239 |
|
|
|
240 |
|
|
pregs : process (clk, c)
|
241 |
|
|
begin
|
242 |
|
|
if rising_edge(clk) then
|
243 |
|
|
r <= c;
|
244 |
|
|
-- pragma translate_off
|
245 |
|
|
rdbg <= cdbg;
|
246 |
|
|
-- pragma translate_on
|
247 |
|
|
end if;
|
248 |
|
|
end process;
|
249 |
|
|
|
250 |
|
|
end rtl;
|