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

Subversion Repositories epc_rfid_transponder

[/] [epc_rfid_transponder/] [trunk/] [transmitter.vhd] - Blame information for rev 2

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 erwing
-------------------------------------------------------------------------------
2
-------------------------------------------------------------------------------
3
--     Politecnico di Torino                                              
4
--     Dipartimento di Automatica e Informatica       
5
-------------------------------------------------------------------------------
6
-------------------------------------------------------------------------------     
7
--
8
--     File name      : transmitter.vhd 
9
--
10
--     Description    : Tag transmitter.
11
--                      Currently is reduced to simple Parallel-Serial
12
--                      converter.
13
--
14
--     Author         : Erwing R. Sanchez Sanchez <erwing.sanchezsanchez@polito.it>
15
-- 
16
--     Last change    : 17 Oct 06 - Erwing Sanchez          
17
--            
18
-------------------------------------------------------------------------------            
19
-------------------------------------------------------------------------------
20
library IEEE;
21
use IEEE.STD_LOGIC_1164.all;
22
use IEEE.std_logic_unsigned.all;
23
use IEEE.STD_LOGIC_ARITH.all;
24
library work;
25
use work.epc_tag.all;
26
 
27
entity transmitter is
28
 
29
  port (
30
    clk     : in  std_logic;
31
    rst_n   : in  std_logic;
32
    trm_cmd : in  std_logic_vector(2 downto 0);
33
    trm_buf : in  std_logic_vector(15 downto 0);
34
    tdo     : out std_logic);
35
 
36
end transmitter;
37
 
38
 
39
architecture trans of transmitter is
40
 
41
  constant buffer_depth : integer := 3;
42
 
43
  type   BuffBlock_t is array (buffer_depth-1 downto 0) of std_logic_vector(15 downto 0);
44
  signal buffblock : BuffBlock_t;
45
  signal sendflag  : std_logic_vector(buffer_depth-1 downto 0);
46
 
47
  signal buffout_busy : std_logic;
48
  signal buffout      : std_logic_vector(15 downto 0);
49
 
50
  signal counter : std_logic_vector(3 downto 0);
51
 
52
begin  -- trans
53
 
54
  buffer_shift : process (clk, rst_n)
55
  begin  -- process serial_conv
56
    if rst_n = '0' then                 -- asynchronous reset (active low)
57
      sendflag <= (others => '0');
58
    elsif clk'event and clk = '1' then  -- rising clock edge
59
      if trm_cmd /= trmcmd_Null then
60
        buffblock(buffer_depth-2 downto 0) <= buffblock(buffer_depth-1 downto 1);
61
        sendflag(buffer_depth-2 downto 0)  <= sendflag(buffer_depth-1 downto 1);
62
        buffblock(buffer_depth-1)          <= trm_buf;
63
        sendflag(buffer_depth-1)           <= '1';
64
      elsif buffout_busy = '0' then
65
        buffblock(buffer_depth-2 downto 0) <= buffblock(buffer_depth-1 downto 1);
66
        sendflag(buffer_depth-2 downto 0)  <= sendflag(buffer_depth-1 downto 1);
67
        buffblock(buffer_depth-1)          <= (others => '0');
68
        sendflag(buffer_depth-1)           <= '0';
69
      end if;
70
    end if;
71
  end process buffer_shift;
72
 
73
 
74
  buffout_shift : process (clk, rst_n)
75
  begin  -- process buffout_shift
76
    if rst_n = '0' then                 -- asynchronous reset (active low)
77
      buffout      <= (others => '0');
78
      buffout_busy <= '0';
79
      counter      <= (others => '0');
80
    elsif clk'event and clk = '1' then  -- rising clock edge
81
      if buffout_busy = '1' then
82
        if counter = X"F" then
83
          counter      <= (others => '0');
84
          buffout_busy <= '0';
85
        else
86
          counter <= counter + '1';
87
        end if;
88
        buffout(14 downto 0) <= buffout(15 downto 1);
89
        buffout(15)          <= '0';
90
      elsif sendflag(0) = '1' then
91
        buffout      <= buffblock(0);
92
        buffout_busy <= '1';
93
      end if;
94
    end if;
95
  end process buffout_shift;
96
 
97
 
98
  tdo <= buffout(0);
99
 
100
 
101
end trans;

powered by: WebSVN 2.1.0

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