OpenCores
URL https://opencores.org/ocsvn/802154phycore/802154phycore/trunk

Subversion Repositories 802154phycore

[/] [802154phycore/] [trunk/] [rtl/] [chip_gen.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 entactogen
-- Copyright (c) 2010 Antonio de la Piedra
2
 
3
-- This program is free software: you can redistribute it and/or modify
4
-- it under the terms of the GNU General Public License as published by
5
-- the Free Software Foundation, either version 3 of the License, or
6
-- (at your option) any later version.
7
 
8
-- This program is distributed in the hope that it will be useful,
9
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
10
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
-- GNU General Public License for more details.
12
 
13
-- You should have received a copy of the GNU General Public License
14
-- along with this program.  If not, see <http://www.gnu.org/licenses/>.
15
 
16
-- A VHDL model of the IEEE 802.15.4 physical layer.
17
 
18
library IEEE;
19
use IEEE.STD_LOGIC_1164.ALL;
20
use IEEE.STD_LOGIC_UNSIGNED.ALL;
21
use IEEE.numeric_std.ALL;
22
 
23
entity chip_gen is
24
 
25
        Port( chip_gen_rst : IN STD_LOGIC;
26
                        chip_gen_clk : IN STD_LOGIC;
27
                        chip_gen_symbol: IN STD_LOGIC_VECTOR(3 downto 0);
28
                        chip_gen_iOut: OUT STD_LOGIC;
29
                        chip_gen_qOut: OUT STD_LOGIC);
30
 
31
end chip_gen;
32
 
33
architecture Behavioral of chip_gen is
34
        TYPE symbol_array is ARRAY (7 downto 0) OF STD_LOGIC_VECTOR (3 downto 0);
35
 
36
        CONSTANT symbols: symbol_array := ( "0111",
37
                                                                                                        "0110",
38
                                                                                                        "0101",
39
                                                                                                        "0100",
40
                                                                                                        "0011",
41
                                                                                                        "0010",
42
                                                                                                        "0001",
43
                                                                                                        "0000");
44
 
45
 
46
        CONSTANT symbol_zero_i : STD_LOGIC_VECTOR (15 downto 0) := "1010100100010111";
47
        CONSTANT symbol_zero_q : STD_LOGIC_VECTOR (15 downto 0) := "1101100111000010";
48
 
49
 
50
        SIGNAL muxIout, muxQout: STD_LOGIC;
51
        SIGNAL sr1, sr2 : STD_LOGIC_VECTOR(15 downto 0);
52
 
53
begin
54
 
55
        shr: process(chip_gen_clk, chip_gen_rst)
56
 
57
        begin
58
 
59
                IF (chip_gen_rst = '1') then
60
                        sr1 <= symbol_zero_i;
61
                        sr2 <= symbol_zero_q;
62
 
63
                elsif rising_edge(chip_gen_clk) then
64
 
65
                        sr1 <= std_logic_vector(unsigned(sr1) rol 1);
66
                        sr2 <= std_logic_vector(unsigned(sr2) rol 1);
67
 
68
                end if;
69
 
70
        end process;
71
 
72
        muxI: process(chip_gen_symbol, sr1)
73
        begin
74
 
75
                IF (chip_gen_symbol(2 downto 0) = symbols(0)(2 downto 0)) then
76
                        muxIout <= sr1(0);
77
                elsif (chip_gen_symbol(2 downto 0) = symbols(1)(2 downto 0)) then
78
                        muxIout <= sr1(2);
79
                elsif (chip_gen_symbol(2 downto 0) = symbols(2)(2 downto 0)) then
80
                        muxIout <= sr1(4);
81
                elsif (chip_gen_symbol(2 downto 0) = symbols(3)(2 downto 0)) then
82
                        muxIout <= sr1(6);
83
                elsif (chip_gen_symbol(2 downto 0) = symbols(4)(2 downto 0)) then
84
                        muxIout <= sr1(8);
85
                elsif (chip_gen_symbol(2 downto 0) = symbols(5)(2 downto 0)) then
86
                        muxIout <= sr1(10);
87
                elsif (chip_gen_symbol(2 downto 0) = symbols(6)(2 downto 0)) then
88
                        muxIout <= sr1(12);
89
                elsif (chip_gen_symbol(2 downto 0) = symbols(7)(2 downto 0)) then
90
                        muxIout <= sr1(14);
91
                end if;
92
        end process;
93
 
94
        muxQ: process(chip_gen_symbol, sr2)
95
        begin
96
 
97
                IF (chip_gen_symbol(2 downto 0) = symbols(0)(2 downto 0)) then
98
                        muxQout <= sr2(0) xor chip_gen_symbol(3);
99
                elsif (chip_gen_symbol(2 downto 0) = symbols(1)(2 downto 0)) then
100
                        muxQout <= sr2(2) xor chip_gen_symbol(3);
101
                elsif (chip_gen_symbol(2 downto 0) = symbols(2)(2 downto 0)) then
102
                        muxQout <= sr2(4) xor chip_gen_symbol(3);
103
                elsif (chip_gen_symbol(2 downto 0) = symbols(3)(2 downto 0)) then
104
                        muxQout <= sr2(6) xor chip_gen_symbol(3);
105
                elsif (chip_gen_symbol(2 downto 0) = symbols(4)(2 downto 0)) then
106
                        muxQout <= sr2(8) xor chip_gen_symbol(3);
107
                elsif (chip_gen_symbol(2 downto 0) = symbols(5)(2 downto 0)) then
108
                        muxQout <= sr2(10) xor chip_gen_symbol(3);
109
                elsif (chip_gen_symbol(2 downto 0) = symbols(6)(2 downto 0)) then
110
                        muxQout <= sr2(12) xor chip_gen_symbol(3);
111
                elsif (chip_gen_symbol(2 downto 0) = symbols(7)(2 downto 0)) then
112
                        muxQout <= sr2(14) xor chip_gen_symbol(3);
113
                end if;
114
        end process;
115
 
116
        chip_gen_iOut <= muxIout;
117
        chip_gen_qOut <= muxQout;
118
 
119
end Behavioral;
120
 
121
 
122
 

powered by: WebSVN 2.1.0

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