| 1 |
2 |
dimamali |
------------------------------------------------------------------------------
|
| 2 |
|
|
-- This file is a part of the GRLIB VHDL IP LIBRARY
|
| 3 |
|
|
-- Copyright (C) 2003, Gaisler Research
|
| 4 |
|
|
--
|
| 5 |
|
|
-- This program is free software; you can redistribute it and/or modify
|
| 6 |
|
|
-- it under the terms of the GNU General Public License as published by
|
| 7 |
|
|
-- the Free Software Foundation; either version 2 of the License, or
|
| 8 |
|
|
-- (at your option) any later version.
|
| 9 |
|
|
--
|
| 10 |
|
|
-- This program is distributed in the hope that it will be useful,
|
| 11 |
|
|
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 12 |
|
|
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 13 |
|
|
-- GNU General Public License for more details.
|
| 14 |
|
|
--
|
| 15 |
|
|
-- You should have received a copy of the GNU General Public License
|
| 16 |
|
|
-- along with this program; if not, write to the Free Software
|
| 17 |
|
|
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
| 18 |
|
|
-----------------------------------------------------------------------------
|
| 19 |
|
|
-- Entity: cpu_disas
|
| 20 |
|
|
-- File: cpu_disas.vhd
|
| 21 |
|
|
-- Author: Jiri Gaisler, Gaisler Research
|
| 22 |
|
|
-- Description: Module for disassembly
|
| 23 |
|
|
------------------------------------------------------------------------------
|
| 24 |
|
|
|
| 25 |
|
|
library ieee;
|
| 26 |
|
|
use ieee.std_logic_1164.all;
|
| 27 |
|
|
use ieee.numeric_std.all;
|
| 28 |
|
|
-- pragma translate_off
|
| 29 |
|
|
library grlib;
|
| 30 |
|
|
use grlib.stdlib.all;
|
| 31 |
|
|
use grlib.sparc.all;
|
| 32 |
|
|
use std.textio.all;
|
| 33 |
|
|
use grlib.sparc_disas.all;
|
| 34 |
|
|
-- pragma translate_on
|
| 35 |
|
|
entity cpu_disas is
|
| 36 |
|
|
port (
|
| 37 |
|
|
clk : in std_ulogic;
|
| 38 |
|
|
rstn : in std_ulogic;
|
| 39 |
|
|
dummy : out std_ulogic;
|
| 40 |
|
|
inst : in std_logic_vector(31 downto 0);
|
| 41 |
|
|
pc : in std_logic_vector(31 downto 2);
|
| 42 |
|
|
result: in std_logic_vector(31 downto 0);
|
| 43 |
|
|
index : in std_logic_vector(3 downto 0);
|
| 44 |
|
|
wreg : in std_ulogic;
|
| 45 |
|
|
annul : in std_ulogic;
|
| 46 |
|
|
holdn : in std_ulogic;
|
| 47 |
|
|
pv : in std_ulogic;
|
| 48 |
|
|
trap : in std_ulogic);
|
| 49 |
|
|
end;
|
| 50 |
|
|
|
| 51 |
|
|
architecture behav of cpu_disas is
|
| 52 |
|
|
begin
|
| 53 |
|
|
|
| 54 |
|
|
dummy <= '1';
|
| 55 |
|
|
-- pragma translate_off
|
| 56 |
|
|
trc : process(clk)
|
| 57 |
|
|
variable valid : boolean;
|
| 58 |
|
|
variable op : std_logic_vector(1 downto 0);
|
| 59 |
|
|
variable op3 : std_logic_vector(5 downto 0);
|
| 60 |
|
|
variable fpins, fpld : boolean;
|
| 61 |
|
|
begin
|
| 62 |
|
|
op := inst(31 downto 30); op3 := inst(24 downto 19);
|
| 63 |
|
|
fpins := (op = FMT3) and ((op3 = FPOP1) or (op3 = FPOP2));
|
| 64 |
|
|
fpld := (op = LDST) and ((op3 = LDF) or (op3 = LDDF) or (op3 = LDFSR));
|
| 65 |
|
|
valid := (((not annul) and pv) = '1') and (not ((fpins or fpld) and (trap = '0')));
|
| 66 |
|
|
valid := valid and (holdn = '1');
|
| 67 |
|
|
if rising_edge(clk) and (rstn = '1') then
|
| 68 |
|
|
print_insn (conv_integer(index), pc(31 downto 2) & "00", inst,
|
| 69 |
|
|
result, valid, trap = '1', wreg = '1', false);
|
| 70 |
|
|
end if;
|
| 71 |
|
|
end process;
|
| 72 |
|
|
-- pragma translate_on
|
| 73 |
|
|
|
| 74 |
|
|
end;
|
| 75 |
|
|
|
| 76 |
|
|
|
| 77 |
|
|
|
| 78 |
|
|
library ieee;
|
| 79 |
|
|
use ieee.std_logic_1164.all;
|
| 80 |
|
|
use ieee.numeric_std.all;
|
| 81 |
|
|
-- pragma translate_off
|
| 82 |
|
|
library grlib;
|
| 83 |
|
|
use grlib.stdlib.all;
|
| 84 |
|
|
use grlib.sparc.all;
|
| 85 |
|
|
use std.textio.all;
|
| 86 |
|
|
use grlib.sparc_disas.all;
|
| 87 |
|
|
-- pragma translate_on
|
| 88 |
|
|
entity gaisler_cpu_disas is
|
| 89 |
|
|
port (
|
| 90 |
|
|
clk : in std_ulogic;
|
| 91 |
|
|
rstn : in std_ulogic;
|
| 92 |
|
|
dummy : out std_ulogic;
|
| 93 |
|
|
inst : in std_logic_vector(31 downto 0);
|
| 94 |
|
|
pc : in std_logic_vector(31 downto 2);
|
| 95 |
|
|
result: in std_logic_vector(31 downto 0);
|
| 96 |
|
|
index : in std_logic_vector(3 downto 0);
|
| 97 |
|
|
wreg : in std_ulogic;
|
| 98 |
|
|
annul : in std_ulogic;
|
| 99 |
|
|
holdn : in std_ulogic;
|
| 100 |
|
|
pv : in std_ulogic;
|
| 101 |
|
|
trap : in std_ulogic);
|
| 102 |
|
|
end;
|
| 103 |
|
|
|
| 104 |
|
|
architecture behav of gaisler_cpu_disas is
|
| 105 |
|
|
begin
|
| 106 |
|
|
|
| 107 |
|
|
dummy <= '1';
|
| 108 |
|
|
-- pragma translate_off
|
| 109 |
|
|
trc : process(clk)
|
| 110 |
|
|
variable valid : boolean;
|
| 111 |
|
|
variable op : std_logic_vector(1 downto 0);
|
| 112 |
|
|
variable op3 : std_logic_vector(5 downto 0);
|
| 113 |
|
|
variable fpins, fpld : boolean;
|
| 114 |
|
|
begin
|
| 115 |
|
|
op := inst(31 downto 30); op3 := inst(24 downto 19);
|
| 116 |
|
|
fpins := (op = FMT3) and ((op3 = FPOP1) or (op3 = FPOP2));
|
| 117 |
|
|
fpld := (op = LDST) and ((op3 = LDF) or (op3 = LDDF) or (op3 = LDFSR));
|
| 118 |
|
|
valid := (((not annul) and pv) = '1') and (not ((fpins or fpld) and (trap = '0')));
|
| 119 |
|
|
valid := valid and (holdn = '1');
|
| 120 |
|
|
if rising_edge(clk) and (rstn = '1') then
|
| 121 |
|
|
print_insn (conv_integer(index), pc(31 downto 2) & "00", inst,
|
| 122 |
|
|
result, valid, trap = '1', wreg = '1', false);
|
| 123 |
|
|
end if;
|
| 124 |
|
|
end process;
|
| 125 |
|
|
-- pragma translate_on
|
| 126 |
|
|
|
| 127 |
|
|
end;
|
| 128 |
|
|
|
| 129 |
|
|
|