1 |
18 |
arif_endro |
-- ------------------------------------------------------------------------
|
2 |
14 |
arif_endro |
-- Copyright (C) 2005 Arif Endro Nugroho
|
3 |
18 |
arif_endro |
-- All rights reserved.
|
4 |
2 |
arif_endro |
--
|
5 |
18 |
arif_endro |
-- Redistribution and use in source and binary forms, with or without
|
6 |
|
|
-- modification, are permitted provided that the following conditions
|
7 |
|
|
-- are met:
|
8 |
2 |
arif_endro |
--
|
9 |
18 |
arif_endro |
-- 1. Redistributions of source code must retain the above copyright
|
10 |
|
|
-- notice, this list of conditions and the following disclaimer.
|
11 |
|
|
-- 2. Redistributions in binary form must reproduce the above copyright
|
12 |
|
|
-- notice, this list of conditions and the following disclaimer in the
|
13 |
|
|
-- documentation and/or other materials provided with the distribution.
|
14 |
2 |
arif_endro |
--
|
15 |
18 |
arif_endro |
-- THIS SOFTWARE IS PROVIDED BY ARIF ENDRO NUGROHO "AS IS" AND ANY EXPRESS
|
16 |
|
|
-- OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
17 |
|
|
-- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
18 |
|
|
-- DISCLAIMED. IN NO EVENT SHALL ARIF ENDRO NUGROHO BE LIABLE FOR ANY
|
19 |
|
|
-- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
20 |
|
|
-- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
21 |
|
|
-- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
22 |
|
|
-- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
23 |
|
|
-- STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
24 |
|
|
-- ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
25 |
|
|
-- POSSIBILITY OF SUCH DAMAGE.
|
26 |
2 |
arif_endro |
--
|
27 |
18 |
arif_endro |
-- End Of License.
|
28 |
|
|
-- ------------------------------------------------------------------------
|
29 |
2 |
arif_endro |
|
30 |
|
|
library IEEE;
|
31 |
|
|
use IEEE.std_logic_1164.all;
|
32 |
|
|
|
33 |
|
|
entity twos_c_8bit is
|
34 |
|
|
port (
|
35 |
|
|
twos_c_i : in bit_vector (07 downto 00);
|
36 |
|
|
twos_c_o : out bit_vector (07 downto 00)
|
37 |
|
|
);
|
38 |
|
|
end twos_c_8bit;
|
39 |
|
|
|
40 |
|
|
architecture data_flow of twos_c_8bit is
|
41 |
|
|
|
42 |
|
|
begin
|
43 |
|
|
|
44 |
|
|
twos_c_o(00) <= (twos_c_i(00));
|
45 |
|
|
twos_c_o(01) <= (not(twos_c_i(01)) xor (not(twos_c_i(00))));
|
46 |
|
|
twos_c_o(02) <= (not(twos_c_i(02)) xor (not(twos_c_i(00)) and not(twos_c_i(01))));
|
47 |
|
|
twos_c_o(03) <= (not(twos_c_i(03)) xor ((not(twos_c_i(00)) and not(twos_c_i(01))) and not(twos_c_i(02))));
|
48 |
|
|
twos_c_o(04) <= (not(twos_c_i(04)) xor ((not(twos_c_i(00)) and not(twos_c_i(01))) and (not(twos_c_i(02)) and not(twos_c_i(03)))));
|
49 |
|
|
twos_c_o(05) <= (not(twos_c_i(05)) xor (((not(twos_c_i(00)) and not(twos_c_i(01))) and (not(twos_c_i(02)) and not(twos_c_i(03)))) and not(twos_c_i(04))));
|
50 |
|
|
twos_c_o(06) <= (not(twos_c_i(06)) xor (((not(twos_c_i(00)) and not(twos_c_i(01))) and (not(twos_c_i(02)) and not(twos_c_i(03)))) and (not(twos_c_i(04)) and not(twos_c_i(05)))));
|
51 |
|
|
twos_c_o(07) <= (not(twos_c_i(07)) xor (((not(twos_c_i(00)) and not(twos_c_i(01))) and (not(twos_c_i(02)) and not(twos_c_i(03)))) and ((not(twos_c_i(04)) and not(twos_c_i(05))) and not(twos_c_i(06)))));
|
52 |
|
|
|
53 |
|
|
end data_flow;
|