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

Subversion Repositories noekeoncore

[/] [noekeoncore/] [trunk/] [rtl/] [rc_gen.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 entactogen
 
2
-- Copyright (c) 2013 Antonio de la Piedra
3
 
4
-- This program is free software: you can redistribute it and/or modify
5
-- it under the terms of the GNU General Public License as published by
6
-- the Free Software Foundation, either version 3 of the License, or
7
-- (at your option) any later version.
8
 
9
-- This program is distributed in the hope that it will be useful,
10
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
11
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
-- GNU General Public License for more details.
13
 
14
-- You should have received a copy of the GNU General Public License
15
-- along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
 
17
library IEEE;
18
use IEEE.STD_LOGIC_1164.ALL;
19
 
20
entity rc_gen is
21
        port(clk : in std_logic;
22
             rst : in std_logic;
23
                  enc : in std_logic; -- 0 (enc), 1 (dec)
24
                  rc_out : out std_logic_vector(7 downto 0));
25
end rc_gen;
26
 
27
architecture Behavioral of rc_gen is
28
        signal rc_s : std_logic_vector(7 downto 0);
29
begin
30
 
31
        pr_gen: process(clk, rst, enc)
32
        begin
33
                if rising_edge(clk) then
34
                        if rst = '1' then
35
                                if enc = '0' then
36
                                        rc_s <= X"80";
37
                                else
38
                                        rc_s <= X"D4";
39
                                end if;
40
                        else
41
                                if enc = '0' then
42
                                        if ((rc_s and X"80") = X"00") then
43
                                                rc_s <= rc_s(6 downto 0) & '0';
44
                                        else
45
                                                rc_s <= (rc_s(6 downto 0) & '0') xor X"1B";
46
                                        end if;
47
                                else
48
                                        if ((rc_s and X"01") = X"00") then
49
                                                rc_s <= '0' & rc_s(7 downto 1);
50
                                        else
51
                                                rc_s <= ('0' & rc_s(7 downto 1)) xor X"8D";
52
                                        end if;
53
                                end if;
54
                        end if;
55
                end if;
56
        end process;
57
 
58
        rc_out <= rc_s;
59
 
60
end Behavioral;
61
 

powered by: WebSVN 2.1.0

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