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

Subversion Repositories rv01_riscv_core

[/] [rv01_riscv_core/] [trunk/] [VHDL/] [RV01_jrpu.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 madsilicon
-----------------------------------------------------------------
2
--                                                             --
3
-----------------------------------------------------------------
4
--                                                             --
5
-- Copyright (C) 2017 Stefano Tonello                          --
6
--                                                             --
7
-- This source file may be used and distributed without        --
8
-- restriction provided that this copyright statement is not   --
9
-- removed from the file and that any derivative work contains --
10
-- the original copyright notice and the associated disclaimer.--
11
--                                                             --
12
-- THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY         --
13
-- EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED   --
14
-- TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS   --
15
-- FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR      --
16
-- OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,         --
17
-- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES    --
18
-- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE   --
19
-- GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR        --
20
-- BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF  --
21
-- LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT  --
22
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT  --
23
-- OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE         --
24
-- POSSIBILITY OF SUCH DAMAGE.                                 --
25
--                                                             --
26
-----------------------------------------------------------------
27
 
28
---------------------------------------------------------------
29
-- RV01 JALR Prediction Unit
30
---------------------------------------------------------------
31
 
32
library IEEE;
33
use IEEE.std_logic_1164.all;
34
use IEEE.numeric_std.all;
35
 
36
library work;
37
use work.RV01_CONSTS_PKG.all;
38
use work.RV01_TYPES_PKG.all;
39
use work.RV01_FUNCS_PKG.all;
40
use work.RV01_IDEC_PKG.all;
41
use work.RV01_OP_PKG.all;
42
 
43
entity RV01_JRPU is
44
  generic(
45
    RAS_DEPTH : natural := 4;
46
    JRVQ_DEPTH : natural := 2;
47
    PXE : std_logic := '1';
48
    NW : natural := 2
49
  );
50
  port(
51
    CLK_i : in std_logic;
52
    RST_i : in std_logic;
53
    CLR_i : in std_logic;
54
    KLL1_i : in std_logic;
55
    FSTLL_i : in std_logic;
56
    BJX_i : in std_logic;
57
    -- prediction inputs
58
    INSTR_i : in std_logic_vector(ILEN*2-1 downto 0);
59
    IF2_V_i : in std_logic_vector(NW-1 downto 0);
60
    IF2_INSTR_i : in DEC_INSTR_VEC_T(NW-1 downto 0);
61
    IF2_PC_i : in ADR_VEC_T(NW-1 downto 0);
62
    -- verification inputs
63
    IX1_V_i : in std_logic_vector(NW-1 downto 0);
64
    IX1_INSTR_i : in DEC_INSTR_VEC_T(NW-1 downto 0);
65
    IX1_OPA0_i : SDWORD_T;
66
    IX1_OPA1_i : SDWORD_T;
67
    IX1_PCP4_i : ADR_VEC_T(NW-1 downto 0);
68
    -- RAS management
69
    IX3_V_i : in std_logic_vector(NW-1 downto 0);
70
    IX3_INSTR_i : in DEC_INSTR_VEC_T(NW-1 downto 0);
71
    IX3_PCP4_i : ADR_VEC_T(NW-1 downto 0);
72
 
73
 
74
    KLL1_o : out std_logic;
75
    PJRX_o : out std_logic;
76
    PJRTA_o : out ADR_T;
77
    MPJRX_o : out std_logic_vector(NW-1 downto 0)
78
  );
79
end RV01_JRPU;
80
 
81
architecture ARC of RV01_JRPU is
82
 
83
  component RV01_STACK is
84
    generic(
85
      DEPTH : natural := 4;
86
      WIDTH : natural := 32
87
    );
88
    port(
89
      CLK_i : in std_logic;
90
      RST_i : in std_logic;
91
      CLR_i : in std_logic;
92
      PUSH_i : in std_logic;
93
      POP_i : in std_logic;
94
      D_i : in std_logic_vector(WIDTH-1 downto 0);
95
 
96
      SE_o : out std_logic;
97
      SF_o : out std_logic;
98
      Q_o : out std_logic_vector(WIDTH-1 downto 0)
99
    );
100
  end component;
101
 
102
  component RV01_QUEUE is
103
    generic(
104
      DEPTH : natural := 2;
105
      WIDTH : natural := 32
106
    );
107
    port(
108
      CLK_i : in std_logic;
109
      RST_i : in std_logic;
110
      CLR_i : in std_logic;
111
      RE_i : in std_logic;
112
      WE_i : in std_logic;
113
      D_i : in std_logic_vector(WIDTH-1 downto 0);
114
 
115
      QE_o : out std_logic;
116
      QF_o : out std_logic;
117
      Q_o : out std_logic_vector(WIDTH-1 downto 0)
118
    );
119
  end component;
120
 
121
   signal CLRS : std_logic := '0';
122
   signal RAS_PUSH,RAS_POP,RAS_FPOP_q : std_logic;
123
   signal RAS_SE,RAS_SF : std_logic;
124
   signal RAS_D,RAS_Q : std_logic_vector(SDLEN-1 downto 0);
125
   signal IX1_JRTA,PJRTA : ADR_T;
126
   signal RAS_RE,RAS_RF : std_logic;
127
   signal IF2_JAL : std_logic_vector(NW-1 downto 0);
128
   signal IF2_PJALR : std_logic_vector(NW-1 downto 0);
129
   signal IX1_JAL : std_logic_vector(NW-1 downto 0);
130
   signal IX1_NORA_JAL : std_logic_vector(NW-1 downto 0);
131
   signal IX1_JALR : std_logic_vector(NW-1 downto 0);
132
   signal IX3_JAL : std_logic_vector(NW-1 downto 0);
133
   signal IX3_NORA_JAL : std_logic_vector(NW-1 downto 0);
134
   signal IX3_JALR : std_logic_vector(NW-1 downto 0);
135
   signal VJALR : std_logic_vector(NW-1 downto 0);
136
   signal VQ_RE,VQ_WE : std_logic;
137
   signal VQ_QE,VQ_QF : std_logic;
138
   signal VQ_D,VQ_Q : std_logic_vector(SDLEN-1 downto 0);
139
   signal VJRTA : ADR_T;
140
   signal IF2_PJRX,IF2_NK_PJRX,IX1_JRX,IX3_JRX,PJRVX : std_logic;
141
   signal MPJRX : std_logic_vector(NW-1 downto 0);
142
   signal VJRX : std_logic;
143
   signal MTCH : std_logic_vector(NW-1 downto 0);
144
   signal SJC_q : natural range 0 to 2;
145
 
146
   signal INSTR0,INSTR1: std_logic_vector(ILEN-1 downto 0);
147
   signal OPCODE0,OPCODE1: std_logic_vector(7-1 downto 0);
148
   signal RD0,RD1 : RID_T;
149
   signal IMM0,IMM1: unsigned(12-1 downto 0);
150
 
151
   signal IF2_JAL_X : std_logic_vector(NW-1 downto 0);
152
   signal IF2_PJALR_X : std_logic_vector(NW-1 downto 0);
153
 
154
begin
155
 
156
  ------------------------------------
157
  -- Note
158
  ------------------------------------
159
 
160
  -- Predicted JALR are only those used
161
  -- to return from a function call, which
162
  -- have r0 as rd (and zero immediate
163
  -- operand).
164
 
165
  -- JAL and JALR instructions supplying
166
  -- prediction info are those used in
167
  -- starting a function call, which have
168
  -- rd different from r0 (and zero
169
  -- immediate operand).
170
 
171
  -- Jalr instructions involved in the 
172
  -- prediction mechanism are those used to
173
  -- return from a function call and therefore
174
  -- always have immediate field set to zero
175
  -- and write return address to r0.
176
  -- In other words, only instruction of the
177
  -- type jalr r0,rn,0 are predicted using
178
  -- the RAS.
179
 
180
  -- *** Prediction ***
181
  -- When a jalr instruction of the type of
182
  -- above reaches IF2, a jump is executed at
183
  -- address output by the RAS, unless the RAS
184
  -- is empty (in such case no jump is
185
  -- performed). 
186
 
187
  -- *** RAS push ***
188
  -- When a jalr instruction of the type
189
  -- jalr rm,rn,0, or a jal instruction of the
190
  -- type jal rn,0, reaches IX1,it's return
191
  -- address (PC+4) is pushed on the RAS. 
192
 
193
  -- *** RAS pop ***
194
  -- Every prediction triggers a RAS pop.
195
 
196
  -- Idea: push RAS in IX1 and remove speculative
197
  -- entries when a B-J mis-prediction occurs or
198
  -- when clearing pipe. VQ must be emptied in the
199
  -- same events.
200
 
201
  ------------------------------------
202
  -- RAS
203
  ------------------------------------
204
 
205
  U_RAS : RV01_STACK
206
    generic map(
207
      DEPTH => RAS_DEPTH,
208
      WIDTH => SDLEN
209
    )
210
    port map(
211
      CLK_i => CLK_i,
212
      RST_i => RST_i,
213
      CLR_i => CLRS,
214
      PUSH_i => RAS_PUSH,
215
      POP_i => RAS_POP,
216
      D_i => RAS_D,
217
 
218
      SE_o => RAS_SE,
219
      SF_o => RAS_SF,
220
      Q_o => RAS_Q
221
    );
222
 
223
  -- RAS is popped when a prediction occurs.
224
  RAS_POP <= (IF2_NK_PJRX and not(FSTLL_i) and not(IF2_JAL(0))) or RAS_FPOP_q;
225
 
226
  -- RAS data output is jalr predicted TA 
227
  PJRTA <= to_unsigned(RAS_Q);
228
 
229
  -- RAS is pushed when a suitable jal or
230
  -- jalr instruction reaches IX1 stage.
231
  RAS_PUSH <= IX1_JRX;
232
 
233
  -- RAS data input is a TA supplied by a
234
  -- jal or jalr instruction.
235
  RAS_D <= to_std_logic_vector(IX1_JRTA);
236
 
237
  ------------------------------------
238
  -- JR Verification queue
239
  ------------------------------------
240
 
241
  U_JRVQ : RV01_QUEUE
242
    generic map(
243
      DEPTH => JRVQ_DEPTH,
244
      WIDTH => SDLEN
245
    )
246
    port map(
247
      CLK_i => CLK_i,
248
      RST_i => RST_i,
249
      CLR_i => CLR_i,
250
      RE_i => VQ_RE,
251
      WE_i => VQ_WE,
252
      D_i => VQ_D,
253
 
254
      QE_o => VQ_QE,
255
      QF_o => VQ_QF,
256
      Q_o => VQ_Q
257
    );
258
 
259
  -- VQ is written when a jalr prediction occurs.
260
  VQ_WE <= IF2_NK_PJRX and not(FSTLL_i) and not(IF2_JAL(0));
261
 
262
  -- VQ data input is RAS data output
263
  VQ_D <= RAS_Q;
264
 
265
  -- VQ is read when a prediction is verified.
266
  VQ_RE <= PJRVX and not(VQ_QE);
267
 
268
  -- VQ data output is the TA to compared with
269
  -- the actual TA.
270
  VJRTA <= to_unsigned(VQ_Q);
271
 
272
  ------------------------------------
273
  -- Speculative Jump Count
274
  ------------------------------------
275
 
276
  -- RAS is pushed speculatively, as 
277
  -- instructions in IX1 may be nullified
278
  -- later (because of a mis-prediction
279
  -- detected in IX2 or an interrupt-like
280
  -- event raised in IX3).
281
  -- A count of speculative entries is kept
282
  -- in order to force-pop them from RAS
283
  -- in case the related instructions get
284
  -- nullified.
285
  -- Every entry is treated as speculative
286
  -- when it's pushed on RAS, thus incrementing
287
  -- the count.
288
  -- The count is decremented when:
289
  -- 1) a predictable jalr reaches IX3 stage.
290
  -- 2) a jalr prediction occurs.
291
  -- 3) a forced pop occurs.
292
 
293
  process(CLK_i)
294
  begin
295
    if(CLK_i = '1' and CLK_i'event) then
296
      if(RST_i = '1' or CLR_i = '1') then
297
        SJC_q <= 0;
298
      elsif(RAS_PUSH = '1') then
299
        SJC_q <= SJC_q + 1;
300
      elsif(
301
        (SJC_q > 0) and
302
        (
303
         IX3_JRX = '1' or
304
         (IF2_NK_PJRX = '1' and FSTLL_i = '0' and IF2_JAL(0) = '0') or
305
         RAS_FPOP_q = '1'
306
        )
307
      ) then
308
        SJC_q <= SJC_q - 1;
309
      end if;
310
    end if;
311
  end process;
312
 
313
  ------------------------------------
314
  -- RAS recovery
315
  ------------------------------------
316
 
317
  process(CLK_i)
318
  begin
319
    if(CLK_i = '1' and CLK_i'event) then
320
      if(RST_i = '1') then
321
        RAS_FPOP_q <= '0';
322
      elsif((BJX_i = '1' or not(MPJRX = "00")) and SJC_q > 0) then
323
        RAS_FPOP_q <= '1';
324
      elsif(RAS_FPOP_q = '1' and SJC_q <= 1) then
325
        RAS_FPOP_q <= '0';
326
      end if;
327
    end if;
328
  end process;
329
 
330
  ------------------------------------
331
  -- IF2 stage logic (prediction)
332
  ------------------------------------
333
 
334
  -- Note: only predictable JALR instructions
335
  -- are considered here!
336
 
337
  INSTR0 <= INSTR_i(ILEN-1 downto 0);
338
  INSTR1 <= INSTR_i(ILEN*2-1 downto ILEN);
339
 
340
  OPCODE0 <= INSTR0(6 downto 0);
341
  OPCODE1 <= INSTR1(6 downto 0);
342
 
343
  RD0 <= to_integer(to_unsigned(INSTR0(11 downto 7)));
344
  RD1 <= to_integer(to_unsigned(INSTR1(11 downto 7)));
345
 
346
  IMM0 <= to_unsigned(INSTR0(31 downto 20));
347
  IMM1 <= to_unsigned(INSTR1(31 downto 20));
348
 
349
  -- slot #0 jalr instruction flag
350
  IF2_PJALR(0) <= IF2_V_i(0) when (
351
    OPCODE0 = OP_JALR and
352
    RD0 = 0 and
353
    IMM0 = 0
354
  ) else '0';
355
 
356
  -- slot #1 jalr instruction flag
357
  IF2_PJALR(1) <= (IF2_V_i(1) and PXE) when (
358
    OPCODE1 = OP_JALR and
359
    RD1 = 0 and
360
    IMM1 = 0
361
  ) else '0';
362
 
363
  -- slot #0 jal instruction flag
364
  IF2_JAL(0) <= IF2_V_i(0) when (
365
    OPCODE0 = OP_JAL
366
  ) else '0';
367
 
368
  -- slot #1 jal instruction flag
369
  IF2_JAL(1) <= (IF2_V_i(1) and PXE) when (
370
    OPCODE1 = OP_JAL
371
  ) else '0';
372
 
373
  ---- slot #0 jalr instruction flag
374
  --IF2_PJALR_X(0) <= IF2_V_i(0) when (
375
  --  IF2_INSTR_i(0).BJ_OP = BJ_JALR and
376
  --  IF2_INSTR_i(0).WRD = '0' and
377
  --  IF2_INSTR_i(0).IMM = 0
378
  --) else '0';
379
 
380
  ---- slot #0 jal instruction flag
381
  --IF2_JAL_X(0) <= IF2_V_i(0) when (
382
  --  IF2_INSTR_i(0).BJ_OP = BJ_JAL
383
  --) else '0';
384
 
385
  --GPXE0_1 : if(PXE = '1') generate
386
  ---- slot #1 jalr instruction flag
387
  --IF2_PJALR_X(1) <= IF2_V_i(1) when (
388
  --  IF2_INSTR_i(1).BJ_OP = BJ_JALR and
389
  --  IF2_INSTR_i(1).WRD = '0' and
390
  --  IF2_INSTR_i(1).IMM = 0
391
  --) else '0';
392
 
393
  -- slot #1 jal instruction flag
394
  --IF2_JAL_X(1) <= IF2_V_i(1) when (
395
  --  IF2_INSTR_i(1).BJ_OP = BJ_JAL
396
  --) else '0';
397
 
398
  --end generate;
399
 
400
  --GPXE0_0 : if(PXE = '0') generate
401
  --IF2_PJALR_X(1) <= '0';
402
  --IF2_JAL_X(1) <= '0'; 
403
  --end generate;
404
 
405
  -- A jump is actually predicted if:
406
  -- 1) RAS is not empty, AND
407
  --   2.a) instruction #0 is a valid
408
  --   P-JALR, OR
409
  --   2.b) instruction #0 is not a 
410
  --   valid JAL (which would nullify
411
  --   instruction #1 and instruction
412
  --   #1 is a valid P-JALR
413
  -- AND
414
  -- 3) fetching is not stalled, AND
415
  -- 4) instruction #0 is not a taken branch.
416
 
417
  IF2_NK_PJRX <= not(RAS_SE) and
418
    (IF2_PJALR(0) or (IF2_PJALR(1) and not(KLL1_i)));
419
 
420
  IF2_PJRX <= not(RAS_SE) and
421
    (IF2_PJALR(0) or IF2_PJALR(1));
422
 
423
  -- Predicted Jump-register execute flag
424
  PJRX_o <= IF2_PJRX;
425
 
426
  -- predicted  JALR target address
427
  PJRTA_o <= PJRTA;
428
 
429
  -- If instruction #0 is predicted jump
430
  -- instruction #1 must be nullified.
431
 
432
  KLL1_o <= IF2_PJALR(0); -- not actually used?
433
 
434
  ------------------------------------
435
  -- IX1 stage logic (Verification)
436
  ------------------------------------
437
 
438
  -- Note: the JALR instructions subject to
439
  -- verification are the same candidate
440
  -- for prediction.
441
 
442
  -- slot #0 jalr instruction flag
443
  VJALR(0) <= IX1_V_i(0) when (
444
    IX1_INSTR_i(0).BJ_OP = BJ_JALR and
445
    IX1_INSTR_i(0).WRD = '0' and
446
    IX1_INSTR_i(0).IMM = 0
447
  ) else '0';
448
 
449
  -- Check if instruction #0 return address
450
  -- matches VQ output.
451
 
452
  MTCH(0) <= not(VQ_QE) when (IX1_OPA0_i = to_signed(VQ_Q)) else '0';
453
 
454
  GPXE1_1 : if(PXE = '1') generate
455
  -- slot #1 jalr instruction flag
456
  VJALR(1) <= IX1_V_i(1) when (
457
    IX1_INSTR_i(1).BJ_OP = BJ_JALR and
458
    IX1_INSTR_i(1).WRD = '0' and
459
    IX1_INSTR_i(1).IMM = 0
460
  ) else '0';
461
 
462
  -- Check if instruction #1 return address
463
  -- matches VQ output.
464
 
465
  MTCH(1) <= not(VQ_QE) when (IX1_OPA1_i = to_signed(VQ_Q)) else '0';
466
  end generate;
467
 
468
  GPXE1_0 : if(PXE = '0') generate
469
  VJALR(1) <= '0';
470
  MTCH(1) <=  '0';
471
  end generate;
472
 
473
  -- A mis-prediction occurs if:
474
  -- 1) instr. #0 is a P-JALR but RA doesn't
475
  -- match, OR
476
  -- 2) instr. #0 is NOT a P-JALR, and instr.
477
  -- #1 is a P-JALR but RA doesn't match.
478
 
479
  MPJRX(0) <= '1' when (
480
    (VJALR(0) = '1' and MTCH(0) = '0') or
481
    (IX1_V_i(0) = '1' and IX1_INSTR_i(0).BJ_OP = BJ_JALR and
482
      (IX1_INSTR_i(0).WRD = '1' or IX1_INSTR_i(0).IMM /= 0)
483
    )
484
  ) else '0';
485
 
486
  MPJRX(1) <= '1' when (
487
    --(IX1_NORA_JAL(0) = '0' and VJALR(0) = '0' and VJALR(1) = '1' and MTCH(1) = '0') or
488
    (VJALR(0) = '0' and VJALR(1) = '1' and MTCH(1) = '0') or
489
    (IX1_V_i(1) = '1' and IX1_INSTR_i(1).BJ_OP = BJ_JALR and
490
      (IX1_INSTR_i(1).WRD = '1' or IX1_INSTR_i(1).IMM /= 0)
491
    )
492
  ) else '0';
493
 
494
  -- This signal is used to remove VQ oldest entry.
495
  PJRVX <= '1' when (
496
    VJALR(0) = '1' or VJALR(1) = '1'
497
  ) else '0';
498
 
499
  -- Mis-predicted JALR flag
500
  MPJRX_o <= MPJRX;
501
 
502
  ------------------------------------
503
  -- IX3 stage logic (RAS pushing)
504
  ------------------------------------
505
 
506
  -- Note: JALR instructions used to
507
  -- supply prediction info are of type
508
  -- different from those used for
509
  -- prediction, as they have rd != r0.
510
 
511
  -- JAL instructions with rd = r0
512
  -- are detected by IX1_NORA_JAL()
513
  -- flags.
514
 
515
  -- slot #0 jalr instruction flag
516
  IX3_JALR(0) <= IX3_V_i(0) when (
517
    IX3_INSTR_i(0).BJ_OP = BJ_JALR and
518
    IX3_INSTR_i(0).WRD = '1'
519
  ) else '0';
520
 
521
  -- slot #0 jal instruction flag
522
  IX3_JAL(0) <= IX3_V_i(0) when (
523
    IX3_INSTR_i(0).BJ_OP = BJ_JAL and
524
    IX3_INSTR_i(0).WRD = '1'
525
  ) else '0';
526
 
527
  -- slot #0 no-RA jal instruction flag
528
  IX3_NORA_JAL(0) <= IX3_V_i(0) when (
529
    IX3_INSTR_i(0).BJ_OP = BJ_JAL and
530
    IX3_INSTR_i(0).WRD = '0'
531
  ) else '0';
532
 
533
  -- slot #1 jalr instruction flag
534
  IX3_JALR(1) <= (IX3_V_i(1) and PXE) when (
535
    IX3_INSTR_i(1).BJ_OP = BJ_JALR and
536
    IX3_INSTR_i(1).WRD = '1'
537
  ) else '0';
538
 
539
  -- slot #1 jal instruction flag
540
  IX3_JAL(1) <= (IX3_V_i(1) and PXE) when (
541
    IX3_INSTR_i(1).BJ_OP = BJ_JAL and
542
    IX3_INSTR_i(1).WRD = '1'
543
  ) else '0';
544
 
545
  -- slot #1 no-RA jal instruction flag
546
  IX3_NORA_JAL(1) <= (IX3_V_i(1) and PXE) when (
547
    IX3_INSTR_i(1).BJ_OP = BJ_JAL and
548
    IX3_INSTR_i(1).WRD = '0'
549
  ) else '0';
550
 
551
  ------------------------------------
552
 
553
  -- slot #0 jalr instruction flag
554
  IX1_JALR(0) <= IX1_V_i(0) when (
555
    IX1_INSTR_i(0).BJ_OP = BJ_JALR and
556
    IX1_INSTR_i(0).WRD = '1'
557
  ) else '0';
558
 
559
  -- slot #0 jal instruction flag
560
  IX1_JAL(0) <= IX1_V_i(0) when (
561
    IX1_INSTR_i(0).BJ_OP = BJ_JAL and
562
    IX1_INSTR_i(0).WRD = '1'
563
  ) else '0';
564
 
565
  -- slot #0 no-RA jal instruction flag
566
  IX1_NORA_JAL(0) <= IX1_V_i(0) when (
567
    IX1_INSTR_i(0).BJ_OP = BJ_JAL and
568
    IX1_INSTR_i(0).WRD = '0'
569
  ) else '0';
570
 
571
  -- slot #1 jalr instruction flag
572
  IX1_JALR(1) <= (IX1_V_i(1) and PXE) when (
573
    IX1_INSTR_i(1).BJ_OP = BJ_JALR and
574
    IX1_INSTR_i(1).WRD = '1'
575
  ) else '0';
576
 
577
  -- slot #1 jal instruction flag
578
  IX1_JAL(1) <= (IX1_V_i(1) and PXE) when (
579
    IX1_INSTR_i(1).BJ_OP = BJ_JAL and
580
    IX1_INSTR_i(1).WRD = '1'
581
  ) else '0';
582
 
583
  -- slot #1 no-RA jal instruction flag
584
  IX1_NORA_JAL(1) <= (IX1_V_i(1) and PXE) when (
585
    IX1_INSTR_i(1).BJ_OP = BJ_JAL and
586
    IX1_INSTR_i(1).WRD = '0'
587
  ) else '0';
588
 
589
  -- IX1 JALR execute flag
590
  IX1_JRX <=
591
    (IX1_JALR(0) or IX1_JAL(0)) or
592
    (not(IX1_NORA_JAL(0)) and(IX1_JALR(1) or IX1_JAL(1)));
593
 
594
  -- JALR return address
595
  IX1_JRTA <= IX1_PCP4_i(0) when (
596
    IX1_JALR(0) = '1' or IX1_JAL(0) = '1'
597
  ) else IX1_PCP4_i(1);
598
 
599
  -- IX3 JALR execute flag
600
  IX3_JRX <=
601
    (IX3_JALR(0) or IX3_JAL(0)) or
602
    (not(IX3_NORA_JAL(0)) and(IX3_JALR(1) or IX3_JAL(1)));
603
 
604
end ARC;

powered by: WebSVN 2.1.0

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