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

Subversion Repositories rv01_riscv_core

[/] [rv01_riscv_core/] [trunk/] [VHDL/] [RV01_cdcomux.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) 2016 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 Control/Debug Common Output mux
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_IDEC_PKG.all;
40
 
41
entity RV01_CDCOMUX is
42
  generic(
43
    DMP : std_logic := '0'
44
  );
45
  port(
46
    CLK_i : in std_logic;
47
    HCSR_i : in std_logic;
48
    HCSRQ_i : in SDWORD_T;
49
    CSRQ_i : in SDWORD_T;
50
    HILLG_i : in std_logic;
51
    ILLG_i : in std_logic;
52
    CP_ADR_MSB_i : in std_logic;
53
    HCP_i : in std_logic;
54
    HCPQ_i : in std_logic_vector(SDLEN-1 downto 0);
55
    CPQ_i : in std_logic_vector(SDLEN-1 downto 0);
56
    DCPQ_i : in std_logic_vector(SDLEN-1 downto 0);
57
    STRT_i : in std_logic;
58
    DRSM_i : in std_logic;
59
    DPC_i : in ADR_T;
60
    STRTPC_i : in ADR_T;
61
 
62
    ILLG_o : out std_logic;
63
    CSRU_RES_o : out SDWORD_T;
64
    CP_Q_o : out std_logic_vector(SDLEN-1 downto 0);
65
    STRT_o : out std_logic;
66
    STRTPC_o : out ADR_T
67
  );
68
end RV01_CDCOMUX;
69
 
70
architecture ARC of RV01_CDCOMUX is
71
 
72
  signal CSRQ_q : SDWORD_T;
73
  signal ILLG_q : std_logic;
74
  signal CP_ADR_MSB_q : std_logic;
75
  signal CPQ_q : std_logic_vector(SDLEN-1 downto 0);
76
 
77
begin
78
 
79
  -- Mux CSR output data and illegal CSR
80
  -- instruction flags from CSRU and HLTU.
81
 
82
  process(CLK_i)
83
  begin
84
    if(CLK_i = '1' and CLK_i'event) then
85
      if(HCSR_i = '1') then
86
        CSRQ_q <= HCSRQ_i;
87
      else
88
        CSRQ_q <= CSRQ_i;
89
      end if;
90
      ILLG_q <= HILLG_i and ILLG_i;
91
    end if;
92
  end process;
93
 
94
  ILLG_o <= ILLG_q;
95
  CSRU_RES_o <= CSRQ_q;
96
 
97
  -- Mux control port output data from
98
  -- CSRU, HLTU and DBGU.
99
 
100
  process(CLK_i)
101
  begin
102
    if(CLK_i = '1' and CLK_i'event) then
103
      CP_ADR_MSB_q <= CP_ADR_MSB_i;
104
    end if;
105
  end process;
106
 
107
  process(CLK_i)
108
  begin
109
    if(CLK_i = '1' and CLK_i'event) then
110
      if(CP_ADR_MSB_q = '1') then
111
        if(HCP_i = '1') then
112
          CPQ_q <= HCPQ_i;
113
        else
114
          CPQ_q <= CPQ_i;
115
        end if;
116
      else
117
        CPQ_q <= DCPQ_i;
118
      end if;
119
    end if;
120
  end process;
121
 
122
  CP_Q_o <= CPQ_q;
123
 
124
  STRT_o <= STRT_i or DRSM_i;
125
 
126
  STRTPC_o <= DPC_i when (DMP = '1') else STRTPC_i;
127
 
128
end ARC;

powered by: WebSVN 2.1.0

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