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/] [tags/] [INITIAL/] [source/] [ext_val.vhdl] - Blame information for rev 12

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

powered by: WebSVN 2.1.0

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