wf_production.vhd 17.8 KB
Newer Older
1 2
--_________________________________________________________________________________________________
--                                                                                                |
3
--                                         |The nanoFIP|                                          |
4
--                                                                                                |
5
--                                         CERN,BE/CO-HT                                          |
6 7 8
--________________________________________________________________________________________________|

---------------------------------------------------------------------------------------------------
9
--                                                                                                |
10
--                                         wf_production                                          |
11
--                                                                                                |
12
---------------------------------------------------------------------------------------------------
13
-- File         wf_production.vhd                                                                 |
14 15 16 17
--                                                                                                |
-- Description  The unit groups the main actions that regard data production.                     |
--              It instantiates the units:                                                        |
--                                                                                                |
18 19 20 21 22
--              o wf_prod_bytes_retriever: that retrieves                                         |
--                                         o user-data bytes from :                               |
--                                           - the Produced RAM or                                |
--                                           - or the"nanoFIP User Interface,NON-WISHBONE"bus DAT_I
--                                           - or the wf_jtag_controller unit                     |
23
--                                         o PDU,CTRL bytes : from the WF_PACKAGE                 |
24 25
--                                         o MPS,nFIP status: from the wf_status_bytes_gen        |
--                                         o LGTH byte      : from the wf_prod_data_lgth_calc     |
26
--                                        and following the signals from the external unit,       |
27
--                                        wf_engine_control,forwards them to the wf_fd_transmitter|
28
--                                                                                                |
29
--               o wf_status_bytes_gen   : that receives information from the wf_consumption unit,|
30 31 32 33
--                                         the "FIELDRIVE" & "User Interface,NON-WISHBONE" inputs |
--                                         and outputs, and generates the nanoFIP and the MPS     |
--                                         status bytes                                           |
--                                                                                                |
34
--               o wf_prod_permit        : that signals the user that user-data bytes can safely  |
35 36 37
--                                         be written to the memory or the DAT_I bus              |
--                                                                                                |
--                      ___________________________________________________________               |
38
--                     |                       wf_production                       |              |
39 40 41
--                     |                                                           |              |
--                     |   _________________________________                       |              |
--                     |  |                                 |                      |              |
42
--                     |  |          wf_prod_permit         |                      |              |
43 44 45 46
--                     |  |_________________________________|                      |              |
--                     |                                                           |              |
--                     |   _________________________________     ________________  |              |
--                     |  |                                 |   |                | |              |
47
--                     |  |      wf_prod_bytes_retriever    | < | wf_status_bytes| |              |
48 49 50 51 52 53
--                     |  |                                 |   |      _gen      | |              |
--                     |  |_________________________________|   |________________| |              |
--                     |___________________________________________________________|              |
--                                                  \/                                            |
--                      ___________________________________________________________               |
--                     |                                                           |              |
54
--                     |                     wf_fd_transmitter                     |              |
55 56 57 58 59 60 61 62 63 64 65
--                     |___________________________________________________________|              |
--                                                  \/                                            |
--                   ___________________________________________________________________          |
--                 0_____________________________FIELDBUS______________________________O          |
--                                                                                                |
--              Note: In the entity declaration of this unit, below each input signal, we mark    |
--              which of the instantiated units needs it.                                         |
--                                                                                                |
--                                                                                                |
-- Authors      Pablo Alvarez Sanchez (Pablo.Alvarez.Sanchez@cern.ch)                             |
--              Evangelia Gousiou     (Evangelia.Gousiou@cern.ch)                                 |
66
-- Date         6/2011                                                                            |
67
---------------------------------------------------------------------------------------------------
68

69
---------------------------------------------------------------------------------------------------
70 71
--                                      SOLDERPAD LICENSE                                         |
--                                   Copyright CERN 2014-2018                                     |
72
--                              ------------------------------------                              |
73 74 75 76 77 78 79
-- Copyright and related rights are licensed under the Solderpad Hardware License, Version 2.0    |
-- (the "License"); you may not use this file except in compliance with the License.              |
-- You may obtain a copy of the License at http://solderpad.org/licenses/SHL-2.0.                 |
-- Unless required by applicable law or agreed to in writing, software, hardware and materials    |
-- distributed under this License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR       |
-- CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language   |
-- governing permissions and limitations under the License.                                       |
80 81 82 83 84 85 86 87 88 89 90 91 92 93
---------------------------------------------------------------------------------------------------



--=================================================================================================
--                                       Libraries & Packages
--=================================================================================================

-- Standard library
library IEEE;
use IEEE.STD_LOGIC_1164.all; -- std_logic definitions
use IEEE.NUMERIC_STD.all;    -- conversion functions
-- Specific library
library work;
94
use work.WF_PACKAGE.all;     -- definitions of types, constants, entities
95 96 97


--=================================================================================================
98
--                           Entity declaration for wf_production
99 100
--=================================================================================================

101
entity wf_production is port(
102
  -- INPUTS
103
	--  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --
104
    -- nanoFIP User Interface, General signals
105 106

      uclk_i                  : in std_logic;
107
      -- used by: all the units
108 109

      slone_i                 : in std_logic;
110 111
      -- used by: wf_prod_bytes_retriever for the selection of data bytes from the RAM or the DAT_I
      -- used by: wf_status_bytes_gen because the MPS status is different in memory & stand-alone
egousiou's avatar
egousiou committed
112

113
      nostat_i                : in std_logic;
114
      -- used by: wf_prod_bytes_retriever for the delivery or not of the nanoFIP status byte
egousiou's avatar
egousiou committed
115

116 117

	--  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --
118
    -- Signal from the wf_reset_unit unit
egousiou's avatar
egousiou committed
119

egousiou's avatar
egousiou committed
120
      nfip_rst_i              : in std_logic;
121
       -- used by: all the units
122

egousiou's avatar
egousiou committed
123

124
	--  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --
egousiou's avatar
egousiou committed
125 126
    -- nanoFIP User Interface, WISHBONE Slave

127
      wb_clk_i                : in std_logic;
128 129
      wb_adr_i                : in std_logic_vector (8 downto 0);
      wb_data_i               : in std_logic_vector (7 downto 0);
130
       -- used by: wf_prod_bytes_retriever for the managment of the Production RAM
egousiou's avatar
egousiou committed
131

132

egousiou's avatar
egousiou committed
133
	--  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --
134
    -- Signal from the wf_wb_controller
egousiou's avatar
egousiou committed
135

136
      wb_ack_prod_p_i         : in std_logic;
137
       -- used by: wf_prod_bytes_retriever for the latching of the wb_data_i
egousiou's avatar
egousiou committed
138

139

140
	--  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --
141
    -- nanoFIP User Interface, NON-WISHBONE
142

143
      slone_data_i            : in std_logic_vector (15 downto 0);
egousiou's avatar
egousiou committed
144
      -- used by: wf_prod_bytes_retriever for the bytes retrieval in stand-alone mode
145

146 147
      var1_acc_a_i            : in std_logic;
      var2_acc_a_i            : in std_logic;
148
      var3_acc_a_i            : in std_logic;
149
      -- used by: wf_status_bytes_gen for the nanoFIP status byte, bits 2, 3
egousiou's avatar
egousiou committed
150

151 152

	--  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --
153
    -- nanoFIP FIELDRIVE
154

155 156
      fd_txer_a_i             : in  std_logic;
      fd_wdgn_a_i             : in  std_logic;
157 158 159 160 161 162
      -- used by: wf_status_bytes_gen for the nanoFIP status byte, bits 6, 7


 	--  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --
    -- Signals from the wf_jtag_controller unit
      jc_tdo_byte_i           : in std_logic_vector (7 downto 0);
egousiou's avatar
egousiou committed
163
      -- used by: wf_prod_bytes_retriever for the bytes retrieval of a var_5
egousiou's avatar
egousiou committed
164

165 166

	--  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --
167
    -- Signals from the wf_engine_control
168 169

      byte_index_i            : in std_logic_vector (7 downto 0);
egousiou's avatar
egousiou committed
170
      data_lgth_i             : in std_logic_vector (7 downto 0);
171
      byte_request_accept_p_i : in std_logic;
172 173
      var_i                   : in t_var; -- also used by: wf_prod_permit for the VAR3_RDY generation
      -- used by: wf_prod_bytes_retriever for the definition of the bytes to be delivered
174

175 176

	--  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --
177
    -- Signals from the wf_consumption
egousiou's avatar
egousiou committed
178

179 180
      var1_rdy_i              : in std_logic;
      var2_rdy_i              : in std_logic;
181
      nfip_status_r_fcser_p_i : in std_logic;
egousiou's avatar
egousiou committed
182
      nfip_status_r_tler_p_i  : in std_logic;
183
      -- used by: wf_status_bytes_gen for the generation of the nanoFIP status byte, bits 2, 4, 5
184

egousiou's avatar
egousiou committed
185

186
 	--  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --  --
187
    -- Signals from the wf_model_constr_decoder unit
188 189

      constr_id_dec_i         : in  std_logic_vector (7 downto 0);
190
      model_id_dec_i          : in  std_logic_vector (7 downto 0);
191
      -- used by: wf_prod_bytes_retriever for the production of a var_identif
192 193


194

195 196
  -------------------------------------------------------------------------------------------------
  -- OUTPUTS
egousiou's avatar
egousiou committed
197

198
    -- Signal to the wf_FD_transmitter
199
      byte_o                  : out std_logic_vector (7 downto 0);
egousiou's avatar
egousiou committed
200

201
    -- nanoFIP User Interface, NON-WISHBONE outputs
202 203 204 205
      u_cacer_o               : out std_logic;
      r_fcser_o               : out std_logic;
      u_pacer_o               : out std_logic;
      r_tler_o                : out std_logic;
206
      var3_rdy_o              : out std_logic);
207

208
end entity wf_production;
209 210 211


--=================================================================================================
212
--                                    architecture declaration
213
--=================================================================================================
214
architecture struc of wf_production is
215

216 217 218
  signal s_var3_rdy           : std_logic;
  signal s_rst_status_bytes_p : std_logic;
  signal s_nfip_stat, s_mps   : std_logic_vector (7 downto 0);
219

220

221
--=================================================================================================
222
--                                       architecture begin
223
--=================================================================================================
224 225 226
begin


egousiou's avatar
egousiou committed
227
---------------------------------------------------------------------------------------------------
egousiou's avatar
egousiou committed
228
--                                       Production Permit                                       --
229
---------------------------------------------------------------------------------------------------
230

231
-- Instantiation of the wf_prod_permit unit
egousiou's avatar
egousiou committed
232

233
  production_VAR3_RDY_generation: wf_prod_permit
234
  port map(
235 236 237
    uclk_i                  => uclk_i,
    nfip_rst_i              => nfip_rst_i,
    var_i                   => var_i,
238
   -----------------------------------------------
239
    var3_rdy_o              => s_var3_rdy);
240
   -----------------------------------------------
241

242

egousiou's avatar
egousiou committed
243

244
---------------------------------------------------------------------------------------------------
egousiou's avatar
egousiou committed
245
--                                          Bytes retrieval                                      --
246
---------------------------------------------------------------------------------------------------
247

248
-- Instantiation of the wf_prod_bytes_retriever unit
249

250
  production_bytes_retriever : wf_prod_bytes_retriever
251
  port map(
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270
    uclk_i                  => uclk_i,
    model_id_dec_i          => model_id_dec_i,
    constr_id_dec_i         => constr_id_dec_i,
    slone_i                 => slone_i,
    nostat_i                => nostat_i,
    nfip_rst_i              => nfip_rst_i,
    wb_clk_i                => wb_clk_i,
    wb_adr_i                => wb_adr_i,
    wb_ack_prod_p_i         => wb_ack_prod_p_i,
    nFIP_status_byte_i      => s_nfip_stat,
    mps_status_byte_i       => s_mps,
    var_i                   => var_i,
    byte_index_i            => byte_index_i,
    byte_being_sent_p_i     => byte_request_accept_p_i,
    data_lgth_i             => data_lgth_i,
    wb_data_i               => wb_data_i,
    slone_data_i            => slone_data_i,
    var3_rdy_i              => s_var3_rdy,
    jc_tdo_byte_i           => jc_tdo_byte_i,
271
   -----------------------------------------------
272 273
    rst_status_bytes_p_o    => s_rst_status_bytes_p,
    byte_o                  => byte_o);
274
   -----------------------------------------------
275

egousiou's avatar
egousiou committed
276 277


278
---------------------------------------------------------------------------------------------------
egousiou's avatar
egousiou committed
279
--                                    Status Byte Generation                                     --
280
---------------------------------------------------------------------------------------------------
egousiou's avatar
egousiou committed
281

282
-- Instantiation of the wf_status_bytes_gen unit
egousiou's avatar
egousiou committed
283

284
  production_status_bytes_generator : wf_status_bytes_gen
285
  port map(
286 287 288 289 290 291 292 293 294 295 296 297
    uclk_i                  => uclk_i,
    nfip_rst_i              => nfip_rst_i,
    slone_i                 => slone_i,
    fd_wdgn_a_i             => fd_wdgn_a_i,
    fd_txer_a_i             => fd_txer_a_i,
    nfip_status_r_fcser_p_i => nfip_status_r_fcser_p_i,
    var1_rdy_i              => var1_rdy_i,
    var2_rdy_i              => var2_rdy_i,
    var3_rdy_i              => s_var3_rdy,
    var1_acc_a_i            => var1_acc_a_i,
    var2_acc_a_i            => var2_acc_a_i,
    var3_acc_a_i            => var3_acc_a_i,
egousiou's avatar
egousiou committed
298
    nfip_status_r_tler_p_i  => nfip_status_r_tler_p_i,
299
    rst_status_bytes_p_i    => s_rst_status_bytes_p,
300
    var_i                   => var_i,
301 302 303 304 305
   -----------------------------------------------
    u_cacer_o               => u_cacer_o,
    u_pacer_o               => u_pacer_o,
    r_tler_o                => r_tler_o,
    r_fcser_o               => r_fcser_o,
306
    nFIP_status_byte_o      => s_nfip_stat,
307 308
    mps_status_byte_o       => s_mps);
   -----------------------------------------------
309

310
    var3_rdy_o              <= s_var3_rdy;
311 312


egousiou's avatar
egousiou committed
313

314 315
end architecture struc;
--=================================================================================================
316
--                                        architecture end
317 318
--=================================================================================================
---------------------------------------------------------------------------------------------------
319
--                                      E N D   O F   F I L E
320
---------------------------------------------------------------------------------------------------