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

Subversion Repositories 802154phycore

[/] [802154phycore/] [trunk/] [rtl/] [rx_core.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 rx_core is
24
        port (clk_1_mhz: in std_logic;
25
              clk_8_mhz: in std_logic;
26
 
27
              rx_core_start: in std_logic;
28
              rx_core_rst:  in std_logic;
29
 
30
              rx_core_input_i: in std_logic_vector(9 downto 0);
31
              rx_core_input_q: in std_logic_vector(9 downto 0);
32
              rx_sym_out : out std_logic_vector(3 downto 0));
33
end rx_core;
34
 
35
architecture Behavioral of rx_core is
36
  signal rx_core_input_i_delayed : std_logic_vector(9 downto 0);
37
  signal mfilter_ch_i, mfilter_ch_q : std_logic_vector(9 downto 0);
38
  signal down_ch_i, down_ch_q : std_logic_vector(9 downto 0);
39
  signal rz_ch_i, rz_ch_q : std_logic;
40
  signal corr_s_1, corr_s_2 : std_logic;
41
 
42
  constant N : integer := 5;
43
 
44
  type delay_buffer_t is array(N-1 downto 0) of
45
   std_logic_vector(9 downto 0);
46
 
47
  signal delay_buffer_ch_i : delay_buffer_t;
48
 
49
  signal corr_sym : std_logic_vector(3 downto 0);
50
  signal corr_start_delayed : std_logic_vector(2 downto 0);
51
begin
52
 
53
  FIR_RX_CH_I : entity work.rx_fir(Behavioral) port map (rx_core_input_i_delayed,
54
                                                         clk_8_mhz,
55
                                                         rx_core_rst,
56
                                                         mfilter_ch_i);
57
 
58
  FIR_RX_CH_Q : entity work.rx_fir(Behavioral) port map (rx_core_input_q,
59
                                                         clk_8_mhz,
60
                                                         rx_core_rst,
61
                                                         mfilter_ch_q);
62
 
63
  DOWNSAMPLER_CH_I : entity work.downsampler(Behavioral) port map (clk_1_mhz,
64
                                                                   rx_core_start,
65
                                                                   mfilter_ch_i,
66
                                                                   down_ch_i);
67
 
68
 
69
  DOWNSAMPLER_CH_Q : entity work.downsampler(Behavioral) port map (clk_1_mhz,
70
                                                                   rx_core_start,
71
                                                                   mfilter_ch_q,
72
                                                                   down_ch_q);
73
 
74
  RZ_ENCODER_CH_I : entity work.rz_enc(Behavioral) port map (down_ch_i,
75
                                                        rz_ch_i);
76
 
77
  RZ_ENCODER_CH_Q : entity work.rz_enc(Behavioral) port map (down_ch_q,
78
                                                        rz_ch_q);
79
 
80
  SYM_CORR : entity work.sym_corr(Behavioral) port map (corr_start_delayed(2),
81
                                                        clk_1_mhz,
82
                                                        rx_core_rst,
83
                                                        rz_ch_q,
84
                                                        rx_sym_out);
85
 
86
  -- Symbol correlator start signal is delayed by 2 us
87
  -- before it can start detecting symbols.                                                                 
88
 
89
  corr_start_delayed(0) <= rx_core_start;
90
 
91
  gen_delay_corr: for i in 1 to 2 generate
92
   corr_delay: process(clk_1_mhz)
93
   begin
94
    if rising_edge(clk_1_mhz) then
95
     corr_start_delayed(i) <= corr_start_delayed(i-1);
96
    end if;
97
   end process corr_delay;
98
  end generate gen_delay_corr;
99
 
100
  -- I Channel is delayed to perform demodulation at the same
101
  -- time that Q Channel (delayed by Tx) arrives.
102
 
103
  delay_buffer_ch_i(0) <= rx_core_input_i;
104
 
105
  gen_delay_ch_i: for i in 1 to N-1 generate
106
   i_ch_delay: process(clk_8_mhz)
107
   begin
108
    if rising_edge(clk_8_mhz) then
109
     delay_buffer_ch_i(i) <= delay_buffer_ch_i(i-1);
110
    end if;
111
   end process i_ch_delay;
112
  end generate gen_delay_ch_i;
113
 
114
  rx_core_input_i_delayed <= delay_buffer_ch_i(N-1);
115
 
116
 
117
end Behavioral;
118
 

powered by: WebSVN 2.1.0

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