1 |
7 |
dbrochart |
----------------------------------------------------------------------
|
2 |
|
|
---- ----
|
3 |
|
|
---- partDistance_synth.vhd ----
|
4 |
|
|
---- ----
|
5 |
|
|
---- This file is part of the turbo decoder IP core project ----
|
6 |
|
|
---- http://www.opencores.org/projects/turbocodes/ ----
|
7 |
|
|
---- ----
|
8 |
|
|
---- Author(s): ----
|
9 |
|
|
---- - David Brochart(dbrochart@opencores.org) ----
|
10 |
|
|
---- ----
|
11 |
|
|
---- All additional information is available in the README.txt ----
|
12 |
|
|
---- file. ----
|
13 |
|
|
---- ----
|
14 |
|
|
----------------------------------------------------------------------
|
15 |
|
|
---- ----
|
16 |
|
|
---- Copyright (C) 2005 Authors ----
|
17 |
|
|
---- ----
|
18 |
|
|
---- This source file may be used and distributed without ----
|
19 |
|
|
---- restriction provided that this copyright statement is not ----
|
20 |
|
|
---- removed from the file and that any derivative work contains ----
|
21 |
|
|
---- the original copyright notice and the associated disclaimer. ----
|
22 |
|
|
---- ----
|
23 |
|
|
---- This source file is free software; you can redistribute it ----
|
24 |
|
|
---- and/or modify it under the terms of the GNU Lesser General ----
|
25 |
|
|
---- Public License as published by the Free Software Foundation; ----
|
26 |
|
|
---- either version 2.1 of the License, or (at your option) any ----
|
27 |
|
|
---- later version. ----
|
28 |
|
|
---- ----
|
29 |
|
|
---- This source is distributed in the hope that it will be ----
|
30 |
|
|
---- useful, but WITHOUT ANY WARRANTY; without even the implied ----
|
31 |
|
|
---- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ----
|
32 |
|
|
---- PURPOSE. See the GNU Lesser General Public License for more ----
|
33 |
|
|
---- details. ----
|
34 |
|
|
---- ----
|
35 |
|
|
---- You should have received a copy of the GNU Lesser General ----
|
36 |
|
|
---- Public License along with this source; if not, download it ----
|
37 |
|
|
---- from http://www.opencores.org/lgpl.shtml ----
|
38 |
|
|
---- ----
|
39 |
|
|
----------------------------------------------------------------------
|
40 |
|
|
|
41 |
|
|
|
42 |
|
|
|
43 |
|
|
architecture synth of partDistance is
|
44 |
|
|
signal bSigned : std_logic_vector(SIG_WIDTH - 1 downto 0);
|
45 |
|
|
signal ySigned : std_logic_vector(SIG_WIDTH - 1 downto 0);
|
46 |
|
|
signal wSigned : std_logic_vector(SIG_WIDTH - 1 downto 0);
|
47 |
|
|
begin
|
48 |
|
|
bPos_g : if std_logic_vector(conv_unsigned(ref, 3))(2) = '0' generate
|
49 |
|
|
bSigned <= b;
|
50 |
|
|
end generate;
|
51 |
|
|
bNeg_g : if std_logic_vector(conv_unsigned(ref, 3))(2) = '1' generate
|
52 |
|
|
bSigned <= std_logic_vector(conv_signed(-conv_integer(signed(b)), SIG_WIDTH));
|
53 |
|
|
end generate;
|
54 |
|
|
yPos_g : if std_logic_vector(conv_unsigned(ref, 3))(1) = '0' generate
|
55 |
|
|
ySigned <= y;
|
56 |
|
|
end generate;
|
57 |
|
|
yNeg_g : if std_logic_vector(conv_unsigned(ref, 3))(1) = '1' generate
|
58 |
|
|
ySigned <= std_logic_vector(conv_signed(-conv_integer(signed(y)), SIG_WIDTH));
|
59 |
|
|
end generate;
|
60 |
|
|
wPos_g : if std_logic_vector(conv_unsigned(ref, 3))(0) = '0' generate
|
61 |
|
|
wSigned <= w;
|
62 |
|
|
end generate;
|
63 |
|
|
wNeg_g : if std_logic_vector(conv_unsigned(ref, 3))(0) = '1' generate
|
64 |
|
|
wSigned <= std_logic_vector(conv_signed(-conv_integer(signed(w)), SIG_WIDTH));
|
65 |
|
|
end generate;
|
66 |
|
|
res <= std_logic_vector(conv_signed(conv_integer(signed(a)) + conv_integer(signed(bSigned)) + conv_integer(signed(ySigned)) + conv_integer(signed(wSigned)), SIG_WIDTH + 2));
|
67 |
|
|
end;
|