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

Subversion Repositories epc_rfid_transponder

[/] [epc_rfid_transponder/] [trunk/] [InvSelFlagsCtrl.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
--     Politecnico di Torino                                              
3
--     Dipartimento di Automatica e Informatica             
4
-------------------------------------------------------------------------------
5
-------------------------------------------------------------------------------     
6
--
7
--     Title          : EPC Class1 Gen2 RFID Tag - Inventoried and Selected Flags Controller
8
--
9
--     File name      : InvSelFlagsCtrl.vhd 
10
--
11
--     Description    : Inventoried and Selected flag controller. It provides a
12
--                      suitable interface with the flag model and deals with
13
--                      refreshing procedures.
14
--                      
15
--     Authors        : Erwing R. Sanchez <erwing.sanchezsanchez@polito.it>
16
--
17
--     Rev. History   : 29 June 06 
18
--                                 
19
-------------------------------------------------------------------------------            
20
-------------------------------------------------------------------------------
21
 
22
library IEEE;
23
use IEEE.STD_LOGIC_1164.all;
24
use IEEE.std_logic_unsigned.all;
25
 
26
 
27
entity InvSelFlagCtrl is
28
  generic (
29
    REFRESHING_CLK_CYC     : integer := 255);  -- Number of clock cycles to refresh flags
30
  port (
31
    clk   : in  std_logic;
32
    rst_n : in  std_logic;
33
    S0in  : in  std_logic;
34
    S1in  : in  std_logic;
35
    S2in  : in  std_logic;
36
    S3in  : in  std_logic;
37
    SLin  : in  std_logic;
38
    S0en  : in  std_logic;
39
    S1en  : in  std_logic;
40
    S2en  : in  std_logic;
41
    S3en  : in  std_logic;
42
    SLen  : in  std_logic;
43
    S0out : out std_logic;
44
    S1out : out std_logic;
45
    S2out : out std_logic;
46
    S3out : out std_logic;
47
    SLout : out std_logic);
48
 
49
end InvSelFlagCtrl;
50
 
51
 
52
architecture FlagController1 of InvSelFlagCtrl is
53
 
54
  component InvSelFlag
55
    port (
56
      S1i : in  std_logic;
57
      S2i : in  std_logic;
58
      S3i : in  std_logic;
59
      SLi : in  std_logic;
60
      S1o : out std_logic;
61
      S2o : out std_logic;
62
      S3o : out std_logic;
63
      SLo : out std_logic);
64
  end component;
65
-- synopsys synthesis_off
66
  signal S0out_i, S1out_i, S2out_i, S3out_i, SLout_i : std_logic;
67
  signal S1i, S2i, S3i, SLi                          : std_logic;
68
  signal S1o, S2o, S3o, SLo                          : std_logic;
69
  signal RefCnt                                      : integer;
70
-- synopsys synthesis_on  
71
begin  -- FlagController1
72
-- synopsys synthesis_off
73
  -- OUTPUT WIRES
74
  S0out <= S0out_i;
75
  S1out <= S1out_i;
76
  S2out <= S2out_i;
77
  S3out <= S3out_i;
78
  SLout <= SLout_i;
79
 
80
  REGISTERS : process (clk, rst_n)
81
  begin  -- process REGISTERS
82
    if rst_n = '0' then                 -- asynchronous reset (active low)
83
      S0out_i <= '0';
84
      S1out_i <= '0';
85
      S2out_i <= '0';
86
      S3out_i <= '0';
87
      SLout_i <= '0';
88
    elsif clk'event and clk = '1' then  -- rising clock edge
89
      if S0en = '1' then
90
        S0out_i <= S0in;
91
      else
92
        S0out_i <= S0out_i;
93
      end if;
94
 
95
      -- Flag Model Input Registers
96
      --S1
97
      if S1en = '1' then
98
        S1i <= S1in;
99
      elsif RefCnt = REFRESHING_CLK_CYC then
100
        S1i <= S1out_i;
101
      else
102
        S1i <= 'Z';
103
      end if;
104
      --S2
105
      if S2en = '1' then
106
        S2i <= S2in;
107
      elsif RefCnt = REFRESHING_CLK_CYC then
108
        S2i <= S2out_i;
109
      else
110
        S2i <= 'Z';
111
      end if;
112
      --S3
113
      if S3en = '1' then
114
        S3i <= S3in;
115
      elsif RefCnt = REFRESHING_CLK_CYC then
116
        S3i <= S3out_i;
117
      else
118
        S3i <= 'Z';
119
      end if;
120
      --SL
121
      if SLen = '1' then
122
        SLi <= SLin;
123
      elsif RefCnt = REFRESHING_CLK_CYC then
124
        SLi <= SLout_i;
125
      else
126
        SLi <= 'Z';
127
      end if;
128
 
129
      -- Flag Model Output Registers
130
      S1out_i <= S1o;
131
      S2out_i <= S2o;
132
      S3out_i <= S3o;
133
      SLout_i <= SLo;
134
    end if;
135
  end process REGISTERS;
136
 
137
  REF_COUNTER : process (clk, rst_n)
138
  begin  -- process REF_COUNTER
139
    if rst_n = '0' then                 -- asynchronous reset (active low)
140
      RefCnt <= 0;
141
    elsif clk'event and clk = '1' then  -- rising clock edge
142
      if RefCnt = REFRESHING_CLK_CYC then
143
        RefCnt <= 0;
144
      else
145
        RefCnt <= RefCnt + 1;
146
      end if;
147
    end if;
148
  end process REF_COUNTER;
149
 
150
  InvSelFlag_i : InvSelFlag
151
    port map (
152
      S1i => S1i,
153
      S2i => S2i,
154
      S3i => S3i,
155
      SLi => SLi,
156
      S1o => S1o,
157
      S2o => S2o,
158
      S3o => S3o,
159
      SLo => SLo);
160
-- synopsys synthesis_on
161
end FlagController1;
162
 
163
 

powered by: WebSVN 2.1.0

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