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 3

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

powered by: WebSVN 2.1.0

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