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 3

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

powered by: WebSVN 2.1.0

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