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

Subversion Repositories ofdm

[/] [ofdm/] [branches/] [avendor/] [input.vhd] - Blame information for rev 13

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 4 tmsiqueira
library IEEE;
2
use IEEE.STD_LOGIC_1164.ALL;
3
use IEEE.STD_LOGIC_ARITH.ALL;
4
use IEEE.STD_LOGIC_UNSIGNED.ALL;
5
 
6
--  Uncomment the following lines to use the declarations that are
7
--  provided for instantiating Xilinx primitive components.
8
--library UNISIM;
9
--use UNISIM.VComponents.all;
10
 
11
entity input is
12
    Port ( clk : in std_logic;
13
           rst : in std_logic;
14
           serial : in std_logic;
15
           mem_block : in std_logic;
16
           mem_ready : out std_logic;
17
           wen : out std_logic;
18
           address : out std_logic_vector (5 downto 0);
19
           i : out std_logic_vector(11 downto 0);
20
           q : out std_logic_vector(11 downto 0)
21
           );
22
end input;
23
 
24
architecture input of input is
25
 
26
type state is (s0, s1, s2, s3, s4, s5, s6, s7);
27
signal st: state;
28
signal meta, sync : std_logic;
29
signal addr : std_logic_vector(5 downto 0);
30
begin
31
 
32
process(clk,rst)
33
    --constant mais1  : std_logic_vector(11 downto 0) := "001100000000";
34
    constant mais1  : std_logic_vector(11 downto 0) := x"080";
35
    constant menos1 : std_logic_vector(11 downto 0) := "110100000000";
36
begin
37
--      0123.45678901 bits
38
--      0011.00000000 = +1
39
--      1101.00000000 = -1
40
 
41
--                Q
42
--        o       |       o 
43
--        01      |       00
44
--                |
45
--        ----------------- I
46
--                |
47
--        11      |       10
48
--        o       |        o
49
 
50
   if rst = '1' then
51
      st <= s0;
52
      mem_ready <= '0';
53
      wen <= '0';
54
      addr <= (others => '0');
55
      address <= (others => '0');
56
      i <= mais1;
57
      q <= mais1;
58
   elsif clk'event and clk='1' then
59
      case st is
60
         when s0 =>
61
            st <= s1;
62
            meta <= serial;
63
            wen <= '0';
64
         when s1 =>
65
            st <= s2;
66
            sync <= meta;
67
         when s2 =>
68
            st <= s3;
69
            if sync='0' then
70
               i <= mais1;
71
            else
72
               i <= menos1;
73
            end if;
74
         when s3 =>
75
            st <= s4;
76
         when s4 =>
77
            st <= s5;
78
            meta <= serial;
79
            addr <= addr +1;
80
         when s5 =>
81
            st <= s6;
82
            sync <= meta;
83
            if unsigned(addr) = 32 then
84
               addr <= conv_std_logic_vector(1,6);
85
               mem_ready <= '1';
86
            end if;
87
         when s6 =>
88
            st <= s7;
89
            mem_ready <= '0';
90
            if sync='0' then
91
               q <= mais1;
92
            else
93
               q <= menos1;
94
            end if;
95
         when s7 =>
96
            st <= s0;
97
            if mem_block = '0' then
98
               address <= addr+32;
99
            else
100
               address <= addr;
101
            end if;
102
            wen <= '1';
103
      end case;
104
   end if;
105
end process;
106
 
107
end input;

powered by: WebSVN 2.1.0

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