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

Subversion Repositories t48

[/] [t48/] [tags/] [rel_0_2_beta/] [rtl/] [vhdl/] [opc_decoder.vhd] - Blame information for rev 294

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 4 arniml
-------------------------------------------------------------------------------
2
--
3
-- The Opcode Decoder.
4
-- Derives instruction mnemonics and multicycle information
5
-- using the OPC table unit.
6
--
7
-- $Id: opc_decoder.vhd,v 1.1 2004-03-23 21:31:52 arniml Exp $
8
--
9
-- All rights reserved
10
--
11
-- Redistribution and use in source and synthezised forms, with or without
12
-- modification, are permitted provided that the following conditions are met:
13
--
14
-- Redistributions of source code must retain the above copyright notice,
15
-- this list of conditions and the following disclaimer.
16
--
17
-- Redistributions in synthesized form must reproduce the above copyright
18
-- notice, this list of conditions and the following disclaimer in the
19
-- documentation and/or other materials provided with the distribution.
20
--
21
-- Neither the name of the author nor the names of other contributors may
22
-- be used to endorse or promote products derived from this software without
23
-- specific prior written permission.
24
--
25
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
27
-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28
-- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE
29
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35
-- POSSIBILITY OF SUCH DAMAGE.
36
--
37
-- Please report bugs to the author, but before you do so, please
38
-- make sure that this is not a derivative work and that
39
-- you have the latest version of this file.
40
--
41
-- The latest version of this file can be found at:
42
--      http://www.opencores.org/cvsweb.shtml/t48/
43
--
44
-------------------------------------------------------------------------------
45
 
46
library ieee;
47
use ieee.std_logic_1164.all;
48
 
49
use work.t48_pack.word_t;
50
use work.decoder_pack.mnemonic_t;
51
 
52
entity opc_decoder is
53
 
54
  generic (
55
    -- store mnemonic in flip-flops (registered-out)
56
    register_mnemonic_g : integer := 1
57
  );
58
 
59
  port (
60
    -- Global Interface -------------------------------------------------------
61
    clk_i         : in  std_logic;
62
    res_i         : in  std_logic;
63
    en_clk_i      : in  boolean;
64
    -- T48 Bus Interface ------------------------------------------------------
65
    data_i        : in  word_t;
66
    read_bus_i    : in  boolean;
67
    -- Decoder Interface ------------------------------------------------------
68
    inj_int_i     : in  boolean;
69
    opcode_o      : out word_t;
70
    mnemonic_o    : out mnemonic_t;
71
    multi_cycle_o : out boolean
72
  );
73
 
74
end opc_decoder;
75
 
76
 
77
use work.t48_pack.clk_active_c;
78
use work.t48_pack.res_active_c;
79
use work.t48_pack.to_boolean;
80
--use work.decoder_pack.MN_NOP;
81
use work.decoder_pack.all;
82
 
83
use work.t48_comp_pack.opc_table;
84
 
85
architecture rtl of opc_decoder is
86
 
87
  -- the opcode register
88
  signal opcode_q : word_t;
89
 
90
  -- the mnemonic
91
  signal mnemonic_s,
92
         mnemonic_q  : mnemonic_t;
93
 
94
  signal multi_cycle_s : std_logic;
95
 
96
begin
97
 
98
  -----------------------------------------------------------------------------
99
  -- Verify the generics
100
  -----------------------------------------------------------------------------
101
 
102
  -- pragma translate_off
103
 
104
  -- Register Mnemonic --------------------------------------------------------
105
  assert (register_mnemonic_g = 1) or (register_mnemonic_g = 0)
106
    report "register_mnemonic_g must be either 1 or 0!"
107
    severity failure;
108
 
109
  -- pragma translate_on
110
 
111
 
112
  -----------------------------------------------------------------------------
113
  -- Opcode Decoder Table
114
  -----------------------------------------------------------------------------
115
  opc_table_b : opc_table
116
    port map (
117
      opcode_i      => opcode_q,
118
      multi_cycle_o => multi_cycle_s,
119
      mnemonic_o    => mnemonic_s
120
    );
121
 
122
 
123
  -----------------------------------------------------------------------------
124
  -- Process regs
125
  --
126
  -- Purpose:
127
  --   Implements the opcode and mnemonic registers.
128
  --
129
  regs: process (res_i, clk_i)
130
  begin
131
    if res_i = res_active_c then
132
      opcode_q     <= (others => '0');      -- NOP
133
      mnemonic_q   <= MN_NOP;
134
 
135
    elsif clk_i'event and clk_i = clk_active_c then
136
      if en_clk_i then
137
 
138
        if read_bus_i then
139
          opcode_q   <= data_i;
140
        elsif inj_int_i then
141
          opcode_q   <= "00010100";
142
        else
143
          mnemonic_q <= mnemonic_s;
144
        end if;
145
 
146
      end if;
147
 
148
    end if;
149
 
150
  end process regs;
151
  --
152
  -----------------------------------------------------------------------------
153
 
154
 
155
  -----------------------------------------------------------------------------
156
  -- Output Mapping.
157
  -----------------------------------------------------------------------------
158
  opcode_o      <= opcode_q;
159
  multi_cycle_o <= to_boolean(multi_cycle_s);
160
  mnemonic_o    <=   mnemonic_q
161
                   when register_mnemonic_g = 1 else
162
                     mnemonic_s;
163
 
164
end rtl;
165
 
166
 
167
-------------------------------------------------------------------------------
168
-- File History:
169
--
170
-- $Log: not supported by cvs2svn $
171
--
172
-------------------------------------------------------------------------------

powered by: WebSVN 2.1.0

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