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

Subversion Repositories core_arm

[/] [core_arm/] [trunk/] [vhdl/] [arm/] [armiu_imstg.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.int.all;
8
use work.arm_comp.all;
9
 
10
entity armiu_imstg is
11
  port (
12
    rst     : in  std_logic;
13
    clk     : in  std_logic;
14
    i       : in  armiu_imstg_typ_in;
15
    o       : out armiu_imstg_typ_out
16
    );
17
end armiu_imstg;
18
 
19
architecture rtl of armiu_imstg is
20
 
21
  type armiu_imstg_tmp_type is record
22
    o       : armiu_imstg_typ_out;
23
    valid      : std_logic;
24
    addrvir_4  : std_logic_vector(31 downto 0); -- virtual pc+4
25
    addrphy    : std_logic_vector(31 downto 0); -- pc after translation
26
  end record;
27
  type armiu_imstg_reg_type is record
28
    branch     : std_logic;
29
    valid      : std_logic;
30
    addrvir    : std_logic_vector(31 downto 0);  -- virtual pc
31
  end record;
32
  type armiu_imstg_dbg_type is record
33
     dummy : std_logic;
34
     -- pragma translate_off
35
     dbg : armiu_imstg_tmp_type;
36
     -- pragma translate_on
37
  end record;
38
  signal r, c       : armiu_imstg_reg_type;
39
  signal rdbg, cdbg : armiu_imstg_dbg_type;
40
 
41
begin
42
 
43
  p0: process (clk, rst, r, i  )
44
    variable v    : armiu_imstg_reg_type;
45
    variable t    : armiu_imstg_tmp_type;
46
    variable vdbg : armiu_imstg_dbg_type;
47
  begin
48
 
49
    -- $(init(t:armiu_imstg_tmp_type))
50
 
51
    v := r;
52
 
53
    t.addrvir_4 := r.addrvir;
54
    t.valid := r.valid;
55
 
56
    lin_incdec(r.addrvir(31 downto 2),t.addrvir_4(31 downto 2),'1','1');
57
 
58
    if i.pstate.hold_r.hold = '0' and i.pstate.nextinsn_v = '1' then
59
      v.addrvir := t.addrvir_4;
60
    end if;
61
 
62
    if i.flush_v = '1' then
63
      v.valid := '0';
64
      t.valid := '0';
65
    end if;
66
 
67
    if i.branch_v = '1' then
68
      v.addrvir := i.addrvir_v;
69
      v.valid := '1';
70
    end if;
71
 
72
    -- reset
73
    if ( rst = '0' ) then
74
      v.addrvir := (others => '0');
75
      v.valid := '1';
76
    end if;
77
 
78
    -- do some mmu translation later:    
79
 
80
    t.o.toFE_addrphy_v := r.addrvir;
81
    t.o.toFE_addrvir_v := r.addrvir;
82
    t.o.toFE_branch_v := r.branch;
83
    t.o.toFE_addrvalid_v := t.valid;
84
    t.o.toFE_trap_v := '0';
85
 
86
    c <= v;
87
 
88
    o <= t.o;
89
 
90
    -- pragma translate_off
91
    vdbg := rdbg;
92
    vdbg.dbg := t;
93
    cdbg <= vdbg;
94
    -- pragma translate_on  
95
 
96
  end process p0;
97
 
98
  pregs : process (clk, c)
99
  begin
100
    if rising_edge(clk) then
101
      r <= c;
102
      -- pragma translate_off
103
      rdbg <= cdbg;
104
      -- pragma translate_on
105
    end if;
106
  end process;
107
 
108
end rtl;

powered by: WebSVN 2.1.0

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