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

Subversion Repositories tiny64

[/] [tiny64/] [trunk/] [cctest.vhd] - Blame information for rev 4

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 riedelx
library IEEE;
2
use IEEE.STD_LOGIC_1164.ALL;
3
use IEEE.STD_LOGIC_ARITH.ALL;
4
use IEEE.STD_LOGIC_UNSIGNED.ALL;
5
 
6
--  Uncomment the following lines to use the declarations that are
7
--  provided for instantiating Xilinx primitive components.
8
--library UNISIM;
9
--use UNISIM.VComponents.all;
10
 
11
entity cctest is
12
    Port ( fN : in std_logic;
13
           fV : in std_logic;
14
           fC : in std_logic;
15
           fZ : in std_logic;
16
           what : in std_logic_vector(3 downto 0);
17
           result : out std_logic);
18
end cctest;
19
 
20
architecture Behavioral of cctest is
21
 
22
begin
23
  process(what, fN, fV, fC, fZ)
24
  begin
25
  case what is
26
    when "0000" =>     -- ever true
27
      result <= '1';
28
    when "0001" =>     -- carry clear
29
      result <= not fC;
30
    when "0010" =>     -- carry set
31
      result <= fC;
32
    when "0011" =>     -- zero set
33
      result <= fZ;
34
    when "0100" =>     -- greater equal
35
      result <= (fN and fV) or (not fN and not fV);
36
    when "0101" =>     -- greater than
37
      result <= (fN and fV and not fZ) or (not fN and not fV and not fZ);
38
    when "0110" =>     -- higher
39
      result <= not fC and not fZ;
40
    when "0111" =>     -- less equal
41
      result <= fZ or (fN and not fV) or (not fN and fV);
42
    when "1000" =>     -- less
43
      result <= fC or fZ;
44
    when "1001" =>     -- less than
45
      result <= (fN and not fV) or (not fN and fV);
46
    when "1010" =>     -- minus
47
      result <= fN;
48
    when "1011" =>     -- zero clear
49
      result <= not fZ;
50
    when "1100" =>     -- plus
51
      result <= not fN;
52
    when "1101" =>     -- overflow clear
53
      result <= not fV;
54
    when "1110" =>     -- overflow set
55
      result <= fV;
56
    when "1111" =>     -- ever false
57
      result <= '0';
58
    when others =>
59
      result <= '0';
60
  end case;
61
  end process;
62
end Behavioral;

powered by: WebSVN 2.1.0

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