1 |
2 |
unicore |
---------------------------------------------------------------------
|
2 |
|
|
---- ----
|
3 |
|
|
---- Reed Solomon decoder/encoder IP core ----
|
4 |
|
|
---- ----
|
5 |
|
|
---- Authors: Anatoliy Sergienko, Volodya Lepeha ----
|
6 |
|
|
---- Company: Unicore Systems http://unicore.co.ua ----
|
7 |
|
|
---- ----
|
8 |
|
|
---- Downloaded from: http://www.opencores.org ----
|
9 |
|
|
---- ----
|
10 |
|
|
---------------------------------------------------------------------
|
11 |
|
|
---- ----
|
12 |
|
|
---- Copyright (C) 2006-2010 Unicore Systems LTD ----
|
13 |
|
|
---- www.unicore.co.ua ----
|
14 |
|
|
---- o.uzenkov@unicore.co.ua ----
|
15 |
|
|
---- ----
|
16 |
|
|
---- This source file may be used and distributed without ----
|
17 |
|
|
---- restriction provided that this copyright statement is not ----
|
18 |
|
|
---- removed from the file and that any derivative work contains ----
|
19 |
|
|
---- the original copyright notice and the associated disclaimer.----
|
20 |
|
|
---- ----
|
21 |
|
|
---- THIS SOFTWARE IS PROVIDED "AS IS" ----
|
22 |
|
|
---- AND ANY EXPRESSED OR IMPLIED WARRANTIES, ----
|
23 |
|
|
---- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ----
|
24 |
|
|
---- WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT ----
|
25 |
|
|
---- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ----
|
26 |
|
|
---- IN NO EVENT SHALL THE UNICORE SYSTEMS OR ITS ----
|
27 |
|
|
---- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, ----
|
28 |
|
|
---- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL ----
|
29 |
|
|
---- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT ----
|
30 |
|
|
---- OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ----
|
31 |
|
|
---- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ----
|
32 |
|
|
---- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ----
|
33 |
|
|
---- WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ----
|
34 |
|
|
---- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING ----
|
35 |
|
|
---- IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, ----
|
36 |
|
|
---- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ----
|
37 |
|
|
---- ----
|
38 |
|
|
---------------------------------------------------------------------
|
39 |
|
|
|
40 |
|
|
--{{ Section below this comment is automatically maintained
|
41 |
|
|
-- and may be overwritten
|
42 |
|
|
--{entity {reed_sol_mull_div} architecture {reed_sol_mull_div}}
|
43 |
|
|
|
44 |
|
|
library IEEE;
|
45 |
|
|
use IEEE.STD_LOGIC_1164.all;
|
46 |
|
|
use ieee.std_logic_arith.all;
|
47 |
|
|
use ieee.std_logic_unsigned.all;
|
48 |
|
|
|
49 |
|
|
entity reed_sol_mull_div is
|
50 |
|
|
port(
|
51 |
|
|
clk : in STD_LOGIC;
|
52 |
|
|
rst : in STD_LOGIC;
|
53 |
|
|
a : in STD_LOGIC_VECTOR(7 downto 0);
|
54 |
|
|
b : in STD_LOGIC_VECTOR(7 downto 0);
|
55 |
|
|
m_d : in STD_LOGIC; -- '0' - mull, '1' - div
|
56 |
|
|
tabla0 : in STD_LOGIC_VECTOR(7 downto 0);
|
57 |
|
|
tablb0 : in STD_LOGIC_VECTOR(7 downto 0);
|
58 |
|
|
tabl1 : in STD_LOGIC_VECTOR(7 downto 0);
|
59 |
|
|
addra : out STD_LOGIC_VECTOR(7 downto 0);
|
60 |
|
|
addrb : out STD_LOGIC_VECTOR(7 downto 0);
|
61 |
|
|
addr1 : out STD_LOGIC_VECTOR(7 downto 0);
|
62 |
|
|
error : out STD_LOGIC;
|
63 |
|
|
res : out STD_LOGIC_VECTOR(7 downto 0)
|
64 |
|
|
);
|
65 |
|
|
end reed_sol_mull_div;
|
66 |
|
|
|
67 |
|
|
--}} End of automatically maintained section
|
68 |
|
|
|
69 |
|
|
architecture reed_sol_mull_div of reed_sol_mull_div is
|
70 |
|
|
signal sm,sm1 : STD_LOGIC_VECTOR(8 downto 0) := (others => '0');
|
71 |
|
|
signal md1 : std_logic;
|
72 |
|
|
signal z0,e0 :std_logic;
|
73 |
|
|
begin
|
74 |
|
|
addra <= a;
|
75 |
|
|
addrb <= b;
|
76 |
|
|
process(clk,rst)
|
77 |
|
|
begin
|
78 |
|
|
if rst = '1' then
|
79 |
|
|
sm1 <= (others => '0');
|
80 |
|
|
md1 <= '0';
|
81 |
|
|
elsif clk = '1' and clk'event then
|
82 |
|
|
if m_d = '0' then sm1 <= ext(tabla0,9) + ext(tablb0,9) + 1;
|
83 |
|
|
else sm1 <= ext(tabla0,9) - ext(tablb0,9);
|
84 |
|
|
end if;
|
85 |
|
|
md1 <= m_d;
|
86 |
|
|
if a = x"00" or b = "00" then z0 <= '1'; else z0 <= '0'; end if;
|
87 |
|
|
if m_d = '1' and b = "00" then e0 <= '1'; else e0 <= '0'; end if;
|
88 |
|
|
end if;
|
89 |
|
|
end process;
|
90 |
|
|
sm <= sm1 + 0 when (md1 = '0' and sm1(8) = '1')else
|
91 |
|
|
sm1 - 1 when (md1 = '0' or (md1 = '1' and sm1(8) = '1')) else sm1 + 0;
|
92 |
|
|
addr1 <= sm(7 downto 0);
|
93 |
|
|
res <= x"00" when (z0 = '1') else tabl1;
|
94 |
|
|
error <= e0;
|
95 |
|
|
|
96 |
|
|
-- enter your statements here --
|
97 |
|
|
|
98 |
|
|
end reed_sol_mull_div;
|
99 |
|
|
|