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 14

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 arif_endro
-- $Id: ext_val.vhdl,v 1.1.1.1 2005-11-15 01:52:30 arif_endro Exp $
2
-------------------------------------------------------------------------------
3
-- Title       : External Values
4
-- Project     : 
5
-------------------------------------------------------------------------------
6
-- File        : ext_val.vhdl
7
-- Author      : "Arif E. Nugroho" <arif_endro@yahoo.com>
8
-- Created     : 2005/11/01
9
-- Last update : 
10
-- Simulators  :
11
-- Synthesizers: 
12
-- Target      : 
13
-------------------------------------------------------------------------------
14
-- Description : External Values calculations
15
-------------------------------------------------------------------------------
16 14 arif_endro
-- Copyright (C) 2005 Arif Endro Nugroho
17 2 arif_endro
-------------------------------------------------------------------------------
18
-- 
19
--      THIS SOURCE FILE MAY BE USED AND DISTRIBUTED WITHOUT RESTRICTION
20
-- PROVIDED THAT THIS COPYRIGHT STATEMENT IS NOT REMOVED FROM THE FILE AND THAT
21
-- ANY DERIVATIVE WORK CONTAINS THE ORIGINAL COPYRIGHT NOTICE AND THE
22
-- ASSOCIATED DISCLAIMER.
23
-- 
24
-------------------------------------------------------------------------------
25
-- 
26
--      THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
27
-- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
28
-- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO
29
-- EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31
-- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
32
-- OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
33
-- WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
34
-- OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
35
-- ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36
-- 
37
-------------------------------------------------------------------------------
38
 
39
library IEEE;
40
use IEEE.std_logic_1164.all;
41
 
42
entity ext_val is
43
   port (
44
   ext_a_i     : in  bit_vector (07 downto 00);
45
   ext_b_i     : in  bit_vector (07 downto 00);
46
   ext_r_o     : out bit_vector (07 downto 00)
47
   );
48
end ext_val;
49
 
50
architecture structural of ext_val is
51
 
52
   component twos_c_8bit
53
      port (
54
        twos_c_i : in  bit_vector (07 downto 00);
55
        twos_c_o : out bit_vector (07 downto 00)
56
        );
57
   end component;
58
 
59
   component comparator_7bit
60
      port (
61
         a_7bit_i   : in  bit_vector (06 downto 00);
62
         b_7bit_i   : in  bit_vector (06 downto 00);
63
         a_eq_b     : out bit;
64
         a_gt_b     : out bit;
65
         a_lt_b     : out bit
66
         );
67
   end component;
68
 
69
signal twos_c_a_i     : bit_vector (07 downto 00);
70
signal twos_c_a_o     : bit_vector (07 downto 00);
71
signal twos_c_b_i     : bit_vector (07 downto 00);
72
signal twos_c_b_o     : bit_vector (07 downto 00);
73
signal twos_c_r_i     : bit_vector (07 downto 00);
74
signal twos_c_r_o     : bit_vector (07 downto 00);
75
signal a_8bit_i   : bit_vector (07 downto 00);
76
signal b_8bit_i   : bit_vector (07 downto 00);
77
signal ext_r      : bit_vector (07 downto 00);
78
signal a_eq_b     : bit;
79
signal a_gt_b     : bit;
80
signal a_lt_b     : bit;
81
signal sgn_a_b    : bit;
82
 
83
begin
84
 
85
twos_c_a_i   <= ext_a_i;
86
twos_c_b_i   <= ext_b_i;
87
twos_c_r_i   <= ext_r;
88
 
89
sgn_a_b  <= ext_a_i (07) xor ext_b_i (07);
90
 
91
a_8bit_i <= ext_a_i     (07 downto 00) when ( ext_a_i (07) = '0' ) else
92
            twos_c_a_o  (07 downto 00) when ( ext_a_i (07) = '1' ) else
93
            B"0000_0000";
94
 
95
b_8bit_i <= ext_b_i     (07 downto 00) when ( ext_b_i (07) = '0' ) else
96
            twos_c_b_o  (07 downto 00) when ( ext_b_i (07) = '1' ) else
97
            B"0000_0000";
98
 
99
ext_r    <= a_8bit_i when ( a_lt_b = '1' ) else
100
            b_8bit_i when ( a_lt_b = '0' ) else
101
            B"0000_0000";
102
 
103
ext_r_o  <= ext_r       when ( sgn_a_b = '0' ) else
104
            twos_c_r_o  when ( sgn_a_b = '1' ) else
105
            B"0000_0000";
106
 
107
compare : comparator_7bit
108
   port map (
109
      a_7bit_i => a_8bit_i (06 downto 00),
110
      b_7bit_i => b_8bit_i (06 downto 00),
111
      a_eq_b   => a_eq_b,
112
      a_gt_b   => a_gt_b,
113
      a_lt_b   => a_lt_b
114
      );
115
 
116
complement_a : twos_c_8bit
117
   port map (
118
      twos_c_i => twos_c_a_i,
119
      twos_c_o => twos_c_a_o
120
      );
121
 
122
complement_b : twos_c_8bit
123
   port map (
124
      twos_c_i => twos_c_b_i,
125
      twos_c_o => twos_c_b_o
126
      );
127
 
128
complement_r : twos_c_8bit
129
   port map (
130
      twos_c_i => twos_c_r_i,
131
      twos_c_o => twos_c_r_o
132
      );
133
 
134
end structural;

powered by: WebSVN 2.1.0

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