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

Subversion Repositories plasma_fpu

[/] [plasma_fpu/] [trunk/] [src/] [subunits/] [plasma_comparator.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 __alexs__
-- --------------------------------------------------------------------------
2
-- >>>>>>>>>>>>>>>>>>>>>>>>>>>> COPYRIGHT NOTICE <<<<<<<<<<<<<<<<<<<<<<<<<<<<
3
-- --------------------------------------------------------------------------
4
-- TITLE:       Plasma COMPARATOR
5
-- AUTHOR:      Alex Schoenberger (Alex.Schoenberger@ies.tu-darmstadt.de)
6
-- COMMENT:     This project is based on Plasma CPU core by Steve Rhoads
7
--
8
-- www.ies.tu-darmstadt.de
9
-- TU Darmstadt
10
-- Institute for Integrated Systems
11
-- Merckstr. 25
12
-- 
13
-- 64283 Darmstadt - GERMANY
14
-- --------------------------------------------------------------------------
15
-- PROJECT:       Plasma CPU core with FPU
16
-- FILENAME:      plasma_comparator.vhd
17
-- --------------------------------------------------------------------------
18
-- COPYRIGHT: 
19
--  This project is distributed by GPLv2.0
20
--  Software placed into the public domain by the author.
21
--  Software 'as is' without warranty.  Author liable for nothing.
22
-- --------------------------------------------------------------------------
23
-- DESCRIPTION:
24
--    compares input values depeding on operation code
25
--
26
--    SYNTHESIZABLE
27
--
28
----------------------------------------------------------------------------
29
-- Revision History
30
-- --------------------------------------------------------------------------
31
-- Revision   Date    Author     CHANGES
32
-- 1.0      4/2014    AS         initial
33
-- 2.0      5/2015    AS         works with MIPS I commands directly
34
-- --------------------------------------------------------------------------
35
library IEEE;
36
   use IEEE.std_logic_1164.ALL;
37
 
38
library PLASMA;
39
  use PLASMA.mips_instruction_set.ALL;
40
  use PLASMA.plasma_pack.ALL;
41
 
42
 
43
entity plasma_comparator is
44
    port(
45
      comp_a_in               : in  t_plasma_word;
46
      comp_b_in               : in  t_plasma_word;
47
      comp_func               : in  t_mips_opcode;
48
      comp_out                : out std_logic
49
    );
50
end entity plasma_comparator;
51
 
52
 
53
architecture structure_comparator of plasma_comparator is
54
 
55
  alias  func           : std_logic_vector(2 downto 0) is comp_func(2 downto 0);
56
 
57
  signal comp_eq        : std_logic;            -- input values are equal
58
 
59
  signal comp_eq_z      : std_logic;            -- input = 0
60
  signal comp_neg       : std_logic;            -- input < 0
61
 
62
begin
63
 
64
  comp_eq       <= '1' when comp_a_in = comp_b_in         else '0';
65
  comp_eq_z     <= '1' when comp_a_in = PLASMA_ZERO_WORD  else '0';
66
  comp_neg      <= comp_a_in(PLASMA_DATA_WIDTH - 1);                    -- check MSB
67
 
68
  -- COMPARATOR MUX
69
  with func select
70
    comp_out    <=  comp_eq                     when "100",   -- BEQ
71
                    not comp_eq                 when "101",   -- BNE
72
                    comp_neg or comp_eq_z       when "110",   -- BLEZ
73
                    not(comp_neg or comp_eq_z)  when "111",   -- BGTZ
74
                    comp_neg                    when "000",   -- BLTZ
75
                    not comp_neg                when "001",   -- BGEZ
76
                    '0'                         when others;
77
 
78
end architecture structure_comparator;

powered by: WebSVN 2.1.0

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