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

Subversion Repositories t48

[/] [t48/] [tags/] [rel_0_3_beta/] [rtl/] [vhdl/] [opc_decoder.vhd] - Blame information for rev 329

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

powered by: WebSVN 2.1.0

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