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

Subversion Repositories microprocessor

[/] [microprocessor/] [trunk/] [bench/] [VHDL/] [Compar.vhd] - Blame information for rev 4

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 yacinenet
-------------------------------------------------------------------------------
2
-- Unit comparison
3
-- 
4
-- 
5
-------------------------------------------------------------------------------
6
 
7
library IEEE;
8
 
9
use IEEE.STD_LOGIC_1164.all;
10
 
11
entity compar is
12
        port (
13
        d_in1 :   in  std_logic_vector (8 downto 1);
14
        d_in2 :   in  std_logic_vector (8 downto 1);
15
        selec_f : in  std_logic_vector (1 downto 0);
16
        clk :     in std_logic ;
17
        d_out :   out std_logic
18
             );
19
end compar ;
20
 
21
architecture archi_compar  of compar is
22
 
23
component compar1
24
port (
25
      x :     in  std_logic ;
26
          y :     in  std_logic ;
27
          ck :    in  std_logic ;
28
          Sin0 :  in  std_logic ;
29
          Sin1 :  in  std_logic ;
30
          Sout0 : out std_logic ;
31
          Sout1 : out std_logic ;
32
          Sout2 : out std_logic
33
          );
34
end component ;
35
 
36
signal cc1_compar : std_logic_vector (8 downto 0) ;
37
signal cc2_compar : std_logic_vector (8 downto 0) ;
38
signal cc3_compar : std_logic_vector (8 downto 1) ;
39
signal ck : std_logic_vector (8 downto 1) ;
40
signal res1 : std_logic ;
41
signal res2 : std_logic ;
42
signal res3 : std_logic ;
43
 
44
begin
45
 
46
cc1_compar(8)<= '0' ;
47
cc2_compar(8)<= '0' ;
48
 
49
compar_unit : for k in 1 to 8 generate
50
                    cmp : compar1 port map (d_in1(k),d_in2(k),ck(k),cc1_compar(k),cc2_compar(k),cc1_compar(k-1),cc2_compar(k-1),cc3_compar(k));
51
                    ck(k)<=clk  ;
52
                  end generate ;
53
 
54
res1 <= cc1_compar(1)or cc1_compar(2)or cc1_compar(3)or cc1_compar(4)or cc1_compar(5)or cc1_compar(6)or cc1_compar(7)or cc1_compar(8);
55
res2 <= cc2_compar(1)or cc2_compar(2)or cc2_compar(3)or cc2_compar(4)or cc2_compar(5)or cc2_compar(6)or cc2_compar(7)or cc2_compar(8);
56
res3 <= cc3_compar(1)and cc3_compar(2)and cc3_compar(3)and cc3_compar(4)and cc3_compar(5)and cc3_compar(6)and cc3_compar(7)and cc3_compar(8);
57
 
58
process (clk)
59
begin
60
 
61
        if (clk'event and clk='1')then
62
          case selec_f is
63
          when "01"=>
64
            if (res1='1') then
65
              d_out <= '1';         --in1<in2
66
            end if ;
67
          ---------
68
          when "10"=>
69
            if (res2='1') then
70
              d_out <= '1';             --in1>in2
71
            end if ;
72
          --------- 
73
          when "11"=>
74
            if (res3='1') then
75
              d_out <= '1';             --in1=in2
76
            end if ;
77
          ---------
78
          when "00"=>
79
            d_out <= '0';
80
          when others =>
81
          end case;
82
        end if;
83
 
84
end process ;
85
end archi_compar ;

powered by: WebSVN 2.1.0

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