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

Subversion Repositories product_code_iterative_decoder

[/] [product_code_iterative_decoder/] [trunk/] [source/] [ext_val.vhdl] - Blame information for rev 18

Details | Compare with Previous | View Log

Line No. Rev Author Line
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 ext_val is
34
   port (
35
   ext_a_i     : in  bit_vector (07 downto 00);
36
   ext_b_i     : in  bit_vector (07 downto 00);
37
   ext_r_o     : out bit_vector (07 downto 00)
38
   );
39
end ext_val;
40
 
41
architecture structural of ext_val is
42
 
43
   component twos_c_8bit
44
      port (
45
        twos_c_i : in  bit_vector (07 downto 00);
46
        twos_c_o : out bit_vector (07 downto 00)
47
        );
48
   end component;
49
 
50
   component comparator_7bit
51
      port (
52
         a_7bit_i   : in  bit_vector (06 downto 00);
53
         b_7bit_i   : in  bit_vector (06 downto 00);
54
         a_eq_b     : out bit;
55
         a_gt_b     : out bit;
56
         a_lt_b     : out bit
57
         );
58
   end component;
59
 
60
signal twos_c_a_i     : bit_vector (07 downto 00);
61
signal twos_c_a_o     : bit_vector (07 downto 00);
62
signal twos_c_b_i     : bit_vector (07 downto 00);
63
signal twos_c_b_o     : bit_vector (07 downto 00);
64
signal twos_c_r_i     : bit_vector (07 downto 00);
65
signal twos_c_r_o     : bit_vector (07 downto 00);
66
signal a_8bit_i   : bit_vector (07 downto 00);
67
signal b_8bit_i   : bit_vector (07 downto 00);
68
signal ext_r      : bit_vector (07 downto 00);
69
signal a_eq_b     : bit;
70
signal a_gt_b     : bit;
71
signal a_lt_b     : bit;
72
signal sgn_a_b    : bit;
73
 
74
begin
75
 
76
twos_c_a_i   <= ext_a_i;
77
twos_c_b_i   <= ext_b_i;
78
twos_c_r_i   <= ext_r;
79
 
80
sgn_a_b  <= ext_a_i (07) xor ext_b_i (07);
81
 
82
a_8bit_i <= ext_a_i     (07 downto 00) when ( ext_a_i (07) = '0' ) else
83
            twos_c_a_o  (07 downto 00) when ( ext_a_i (07) = '1' ) else
84
            B"0000_0000";
85
 
86
b_8bit_i <= ext_b_i     (07 downto 00) when ( ext_b_i (07) = '0' ) else
87
            twos_c_b_o  (07 downto 00) when ( ext_b_i (07) = '1' ) else
88
            B"0000_0000";
89
 
90
ext_r    <= a_8bit_i when ( a_lt_b = '1' ) else
91
            b_8bit_i when ( a_lt_b = '0' ) else
92
            B"0000_0000";
93
 
94
ext_r_o  <= ext_r       when ( sgn_a_b = '0' ) else
95
            twos_c_r_o  when ( sgn_a_b = '1' ) else
96
            B"0000_0000";
97
 
98
compare : comparator_7bit
99
   port map (
100
      a_7bit_i => a_8bit_i (06 downto 00),
101
      b_7bit_i => b_8bit_i (06 downto 00),
102
      a_eq_b   => a_eq_b,
103
      a_gt_b   => a_gt_b,
104
      a_lt_b   => a_lt_b
105
      );
106
 
107
complement_a : twos_c_8bit
108
   port map (
109
      twos_c_i => twos_c_a_i,
110
      twos_c_o => twos_c_a_o
111
      );
112
 
113
complement_b : twos_c_8bit
114
   port map (
115
      twos_c_i => twos_c_b_i,
116
      twos_c_o => twos_c_b_o
117
      );
118
 
119
complement_r : twos_c_8bit
120
   port map (
121
      twos_c_i => twos_c_r_i,
122
      twos_c_o => twos_c_r_o
123
      );
124
 
125
end structural;

powered by: WebSVN 2.1.0

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