SURF  1.0
SrpV3AxiLite.vhd
Go to the documentation of this file.
1 -------------------------------------------------------------------------------
2 -- File : SrpV3AxiLite.vhd
3 -- Company : SLAC National Accelerator Laboratory
4 -- Created : 2016-03-22
5 -- Last update: 2017-06-18
6 -------------------------------------------------------------------------------
7 -- Description: SLAC Register Protocol Version 3, AXI-Lite Interface
8 --
9 -- Documentation: https://confluence.slac.stanford.edu/x/cRmVD
10 --
11 -- Note: This module only supports 32-bit aligned addresses and 32-bit transactions.
12 -- For non 32-bit aligned addresses or non 32-bit transactions, use
13 -- the SrpV3Axi.vhd module with the AxiToAxiLite.vhd bridge
14 -------------------------------------------------------------------------------
15 -- This file is part of 'SLAC Firmware Standard Library'.
16 -- It is subject to the license terms in the LICENSE.txt file found in the
17 -- top-level directory of this distribution and at:
18 -- https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html.
19 -- No part of 'SLAC Firmware Standard Library', including this file,
20 -- may be copied, modified, propagated, or distributed except according to
21 -- the terms contained in the LICENSE.txt file.
22 -------------------------------------------------------------------------------
23 
24 library ieee;
25 use ieee.std_logic_1164.all;
26 use ieee.std_logic_arith.all;
27 use ieee.std_logic_unsigned.all;
28 
29 use work.StdRtlPkg.all;
30 use work.AxiStreamPkg.all;
31 use work.SsiPkg.all;
32 use work.AxiLitePkg.all;
33 
34 --! @see entity
35  --! @ingroup protocols_srp
36 entity SrpV3AxiLite is
37  generic (
38  TPD_G : time := 1 ns;
39  INT_PIPE_STAGES_G : natural range 0 to 16 := 1;
40  PIPE_STAGES_G : natural range 0 to 16 := 1;
41  FIFO_PAUSE_THRESH_G : positive range 1 to 511 := 256;
42  TX_VALID_THOLD_G : positive := 1;
43  SLAVE_READY_EN_G : boolean := false;
44  GEN_SYNC_FIFO_G : boolean := false;
45  ALTERA_SYN_G : boolean := false;
46  ALTERA_RAM_G : string := "M9K";
47  AXIL_CLK_FREQ_G : real := 156.25E+6; -- units of Hz
48  AXI_STREAM_CONFIG_G : AxiStreamConfigType := ssiAxiStreamConfig(2));
49  port (
50  -- AXIS Slave Interface (sAxisClk domain)
51  sAxisClk : in sl;
52  sAxisRst : in sl;
56  -- AXIS Master Interface (mAxisClk domain)
57  mAxisClk : in sl;
58  mAxisRst : in sl;
61  -- Master AXI-Lite Interface (axilClk domain)
62  axilClk : in sl;
63  axilRst : in sl;
68 end SrpV3AxiLite;
69 
70 architecture rtl of SrpV3AxiLite is
71 
72  constant AXIS_CONFIG_C : AxiStreamConfigType := ssiAxiStreamConfig(4, TKEEP_COMP_C, TUSER_FIRST_LAST_C, 8);
73  constant TIMEOUT_C : natural := (getTimeRatio(AXIL_CLK_FREQ_G, 10.0) - 1); -- 100 ms timeout
74 
75  constant SRP_VERSION_C : slv(7 downto 0) := x"03";
76  constant NON_POSTED_READ_C : slv(1 downto 0) := "00";
77  constant NON_POSTED_WRITE_C : slv(1 downto 0) := "01";
78  constant POSTED_WRITE_C : slv(1 downto 0) := "10";
79  constant NULL_C : slv(1 downto 0) := "11";
80 
81  type StateType is (
82  IDLE_S,
83  HDR_REQ0_S,
84  HDR_REQ1_S,
85  HDR_REQ2_S,
86  HDR_REQ3_S,
87  HDR_RESP_S,
88  FOOTER_S,
89  AXIL_RD_REQ_S,
90  AXIL_RD_RESP_S,
91  AXIL_WR_REQ_S,
92  AXIL_WR_RESP_S);
93 
94  type RegType is record
95  timer : natural range 0 to TIMEOUT_C;
96  hdrCnt : slv(3 downto 0);
97  remVer : slv(7 downto 0);
98  opCode : slv(1 downto 0);
99  timeoutSize : slv(7 downto 0);
100  timeoutCnt : slv(7 downto 0);
101  tid : slv(31 downto 0);
102  tidDly : slv(31 downto 0); -- simulation debug only
103  addr : slv(63 downto 0);
104  reqSize : slv(31 downto 0);
105  cnt : slv(29 downto 0);
106  cntSize : slv(29 downto 0);
107  memResp : slv(7 downto 0);
108  timeout : sl;
109  eofe : sl;
110  frameError : sl;
111  verMismatch : sl;
112  reqSizeError : sl;
113  ignoreMemResp : sl;
114  rxRst : sl;
115  overflowDet : sl;
116  skip : sl; -- simulation debug only
119  rxSlave : AxiStreamSlaveType;
120  txMaster : AxiStreamMasterType;
121  state : StateType;
122  end record RegType;
123  constant REG_INIT_C : RegType := (
124  timer => 0,
125  hdrCnt => (others => '0'),
126  remVer => (others => '0'),
127  opCode => (others => '0'),
128  timeoutSize => (others => '0'),
129  timeoutCnt => (others => '0'),
130  tid => (others => '0'),
131  tidDly => (others => '1'),
132  addr => (others => '0'),
133  reqSize => (others => '0'),
134  cnt => (others => '0'),
135  cntSize => (others => '0'),
136  memResp => (others => '0'),
137  timeout => '0',
138  eofe => '0',
139  frameError => '0',
140  verMismatch => '0',
141  reqSizeError => '0',
142  ignoreMemResp => '0',
143  rxRst => '0',
144  overflowDet => '0',
145  skip => '0',
148  rxSlave => AXI_STREAM_SLAVE_INIT_C,
149  txMaster => AXI_STREAM_MASTER_INIT_C,
150  state => IDLE_S);
151 
152  signal r : RegType := REG_INIT_C;
153  signal rin : RegType;
154 
155  signal axisMaster : AxiStreamMasterType;
156  signal axisSlave : AxiStreamSlaveType;
157 
158  signal sCtrl : AxiStreamCtrlType;
159 
160  signal rxMaster : AxiStreamMasterType;
161  signal rxSlave : AxiStreamSlaveType;
162  signal rxCtrl : AxiStreamCtrlType;
163  signal rxTLastTUser : slv(7 downto 0);
164  signal txSlave : AxiStreamSlaveType;
165  signal rst : sl;
166  signal sRst : sl;
167  signal rxRst : sl;
168 
169  -- attribute dont_touch : string;
170  -- attribute dont_touch of r : signal is "TRUE";
171  -- attribute dont_touch of axisMaster : signal is "TRUE";
172  -- attribute dont_touch of axisSlave : signal is "TRUE";
173  -- attribute dont_touch of sCtrl : signal is "TRUE";
174  -- attribute dont_touch of rxMaster : signal is "TRUE";
175  -- attribute dont_touch of rxSlave : signal is "TRUE";
176  -- attribute dont_touch of rxCtrl : signal is "TRUE";
177  -- attribute dont_touch of rxTLastTUser : signal is "TRUE";
178  -- attribute dont_touch of txSlave : signal is "TRUE";
179  -- attribute dont_touch of rst : signal is "TRUE";
180  -- attribute dont_touch of sRst : signal is "TRUE";
181  -- attribute dont_touch of rxRst : signal is "TRUE";
182 
183 begin
184 
185  sAxisCtrl <= sCtrl;
186  sRst <= rst or sAxisRst;
187 
188  U_Limiter : entity work.SsiFrameLimiter
189  generic map (
190  TPD_G => TPD_G,
191  EN_TIMEOUT_G => false,
192  FRAME_LIMIT_G => (4128/AXI_STREAM_CONFIG_G.TDATA_BYTES_C), -- (2^12+4*8)/TDATA_BYTES_C
193  COMMON_CLK_G => true,
194  SLAVE_FIFO_G => false,
195  MASTER_FIFO_G => false,
199  port map (
200  -- Slave Port
201  sAxisClk => sAxisClk,
202  sAxisRst => sRst,
205  -- Master Port
206  mAxisClk => sAxisClk,
207  mAxisRst => sRst,
208  mAxisMaster => axisMaster,
209  mAxisSlave => axisSlave);
210 
211  RX_FIFO : entity work.AxiStreamFifoV2
212  generic map (
213  -- General Configurations
214  TPD_G => TPD_G,
218  VALID_THOLD_G => 0, -- = 0 = only when frame ready
219  -- FIFO configurations
220  BRAM_EN_G => true,
221  XIL_DEVICE_G => "7SERIES",
222  USE_BUILT_IN_G => false,
226  INT_WIDTH_SELECT_G => "CUSTOM",
227  INT_DATA_WIDTH_G => 16, -- 128-bit
228  FIFO_ADDR_WIDTH_G => 9, -- 8kB/FIFO = 128-bits x 512 entries
229  FIFO_FIXED_THRESH_G => true,
231  -- AXI Stream Port Configurations
233  MASTER_AXI_CONFIG_G => AXIS_CONFIG_C)
234  port map (
235  -- Slave Port
236  sAxisClk => sAxisClk,
237  sAxisRst => sRst,
238  sAxisMaster => axisMaster,
239  sAxisSlave => axisSlave,
240  sAxisCtrl => sCtrl,
241  -- Master Port
242  mAxisClk => axilClk,
243  mAxisRst => rxRst,
244  mAxisMaster => rxMaster,
245  mAxisSlave => rxSlave,
246  mTLastTUser => rxTLastTUser);
247 
248  GEN_SYNC_SLAVE : if (GEN_SYNC_FIFO_G = true) generate
249  rxCtrl <= sCtrl;
250  rst <= rxRst;
251  end generate;
252 
253  GEN_ASYNC_SLAVE : if (GEN_SYNC_FIFO_G = false) generate
254  Sync_Ctrl : entity work.SynchronizerVector
255  generic map (
256  TPD_G => TPD_G,
257  WIDTH_G => 2,
258  INIT_G => "11")
259  port map (
260  clk => axilClk,
261  rst => axilRst,
262  dataIn(0) => sCtrl.pause,
263  dataIn(1) => sCtrl.idle,
264  dataOut(0) => rxCtrl.pause,
265  dataOut(1) => rxCtrl.idle);
266  Sync_Overflow : entity work.SynchronizerOneShot
267  generic map (
268  TPD_G => TPD_G)
269  port map (
270  clk => axilClk,
271  rst => axilRst,
272  dataIn => sCtrl.overflow,
273  dataOut => rxCtrl.overflow);
274  Sync_Rst : entity work.RstSync
275  generic map (
276  TPD_G => TPD_G)
277  port map (
278  clk => sAxisClk,
279  asyncRst => rxRst,
280  syncRst => rst);
281  end generate;
282 
283  comb : process (axilRst, mAxilReadSlave, mAxilWriteSlave, r, rxCtrl,
284  rxMaster, rxTLastTUser, txSlave) is
285  variable v : RegType;
286  begin
287  -- Latch the current value
288  v := r;
289 
290  -- Reset the flags
291  v.rxRst := '0';
292  v.skip := '0';
293  v.rxSlave := AXI_STREAM_SLAVE_INIT_C;
294  if txSlave.tReady = '1' then
295  v.txMaster.tValid := '0';
296  v.txMaster.tLast := '0';
297  v.txMaster.tUser := (others => '0');
298  end if;
299 
300  -- Check the timer
301  if r.timer = TIMEOUT_C then
302  -- Reset the timer
303  v.timer := 0;
304  else
305  -- Increment the timer
306  v.timer := r.timer + 1;
307  end if;
308 
309  -- Check for overflow
310  if (rxCtrl.overflow = '1') and (r.rxRst = '0') then
311  -- Set the flag
312  v.overflowDet := '1';
313  end if;
314 
315  -- State Machine
316  case r.state is
317  ----------------------------------------------------------------------
318  when IDLE_S =>
319  -- Reset error flags
320  v.memResp := (others => '0');
321  v.timeout := '0';
322  v.eofe := '0';
323  v.frameError := '0';
324  v.verMismatch := '0';
325  v.reqSizeError := '0';
326  -- Reset all AXI-Lite flags
327  v.mAxilReadMaster.arvalid := '0';
328  v.mAxilReadMaster.rready := '0';
329  v.mAxilWriteMaster.awvalid := '0';
330  v.mAxilWriteMaster.wvalid := '0';
331  v.mAxilWriteMaster.bready := '0';
332  v.cnt := (others => '0');
333  -- Check for overflow
334  if r.overflowDet = '1' then
335  -- Reset the flag
336  v.overflowDet := '0';
337  -- Reset the FIFO
338  v.rxRst := '1';
339  -- Check for valid data
340  elsif (rxMaster.tValid = '1') and (r.rxRst = '0') then
341  -- Accept the data
342  v.rxSlave.tReady := '1';
343  -- Check for SOF and no EOFE
344  if (ssiGetUserSof(AXIS_CONFIG_C, rxMaster) = '1') and (rxTLastTUser(SSI_EOFE_C) = '0') then
345  -- Latch the AXIS TDEST
346  v.txMaster.tDest := rxMaster.tDest;
347  -- Latch the header information
348  v.remVer := rxMaster.tData(7 downto 0);
349  v.opCode := rxMaster.tData(9 downto 8);
350  v.ignoreMemResp := rxMaster.tData(14);
351  v.timeoutSize := rxMaster.tData(31 downto 24);
352  -- Reset other header fields
353  v.tid := (others => '0');
354  v.addr := (others => '0');
355  v.reqSize := (others => '0');
356  -- Check for tLast
357  if (rxMaster.tLast = '1') then
358  -- Set the flags
359  v.frameError := '1';
360  -- Next State
361  v.state := HDR_RESP_S;
362  else
363  -- Next State
364  v.state := HDR_REQ0_S;
365  end if;
366  end if;
367  end if;
368  ----------------------------------------------------------------------
369  when HDR_REQ0_S =>
370  -- Check for valid data
371  if rxMaster.tValid = '1' then
372  -- Accept the data
373  v.rxSlave.tReady := '1';
374  -- Latch the request header field
375  v.tid(31 downto 0) := rxMaster.tData(31 downto 0);
376  -- Check for tLast
377  if rxMaster.tLast = '1' then
378  -- Set the flags
379  v.frameError := '1';
380  -- Next State
381  v.state := HDR_RESP_S;
382  else
383  -- Next State
384  v.state := HDR_REQ1_S;
385  end if;
386  end if;
387  ----------------------------------------------------------------------
388  when HDR_REQ1_S =>
389  -- Check for valid data
390  if rxMaster.tValid = '1' then
391  -- Accept the data
392  v.rxSlave.tReady := '1';
393  -- Latch the request header field
394  v.addr(31 downto 0) := rxMaster.tData(31 downto 0);
395  -- Check for tLast
396  if rxMaster.tLast = '1' then
397  -- Set the flags
398  v.frameError := '1';
399  -- Next State
400  v.state := HDR_RESP_S;
401  else
402  -- Next State
403  v.state := HDR_REQ2_S;
404  end if;
405  end if;
406  ----------------------------------------------------------------------
407  when HDR_REQ2_S =>
408  -- Check for valid data
409  if rxMaster.tValid = '1' then
410  -- Accept the data
411  v.rxSlave.tReady := '1';
412  -- Latch the request header field
413  v.addr(63 downto 32) := rxMaster.tData(31 downto 0);
414  -- Check for tLast
415  if rxMaster.tLast = '1' then
416  -- Set the flags
417  v.frameError := '1';
418  -- Next State
419  v.state := HDR_RESP_S;
420  else
421  -- Next State
422  v.state := HDR_REQ3_S;
423  end if;
424  end if;
425  ----------------------------------------------------------------------
426  when HDR_REQ3_S =>
427  -- Check for valid data
428  if rxMaster.tValid = '1' then
429  -- Accept the data
430  v.rxSlave.tReady := '1';
431  -- Latch the request header field
432  v.reqSize(31 downto 0) := rxMaster.tData(31 downto 0);
433  -- Check for no tLast
434  if (rxMaster.tLast = '0') then
435  -- Check for OP-codes that should have tLast
436  if (r.opCode = NULL_C) or (r.opCode = NON_POSTED_READ_C) then
437  -- Set the flags
438  v.frameError := '1';
439  end if;
440  else
441  -- Check for OP-codes that should NOT have tLast
442  if (r.opCode = POSTED_WRITE_C) or (r.opCode = NON_POSTED_WRITE_C) then
443  -- Set the flags
444  v.frameError := '1';
445  end if;
446  end if;
447  -- Next State
448  v.state := HDR_RESP_S;
449  end if;
450  ----------------------------------------------------------------------
451  when HDR_RESP_S =>
452  -- Check if ready to move data
453  if (v.txMaster.tValid = '0') then
454  -- Check for posted write
455  if r.opCode /= POSTED_WRITE_C then
456  -- Set the flag
457  v.txMaster.tValid := '1';
458  end if;
459  -- Increment the counter
460  v.hdrCnt := r.hdrCnt + 1;
461  -- Check the counter
462  case (r.hdrCnt) is
463  when x"0" =>
464  -- Set SOF
465  ssiSetUserSof(AXIS_CONFIG_C, v.txMaster, '1');
466  -- Set data bus
467  v.txMaster.tData(7 downto 0) := SRP_VERSION_C;
468  v.txMaster.tData(9 downto 8) := r.opCode;
469  v.txMaster.tData(10) := '0'; -- UnalignedAccess: 0 = not supported (only 32-bit alignment)
470  v.txMaster.tData(11) := '0'; -- MinAccessSize: 0 = 32-bit (4 byte) transactions only
471  v.txMaster.tData(12) := '0'; -- WriteEn: 0 = write operations are not supported
472  v.txMaster.tData(13) := '0'; -- ReadEn: 0 = read operations are not supported
473  v.txMaster.tData(14) := r.ignoreMemResp;
474  v.txMaster.tData(23 downto 15) := (others => '0'); -- Reserved
475  v.txMaster.tData(31 downto 24) := r.timeoutSize;
476  when x"1" => v.txMaster.tData(31 downto 0) := r.tid(31 downto 0);
477  when x"2" => v.txMaster.tData(31 downto 0) := r.addr(31 downto 0);
478  when x"3" => v.txMaster.tData(31 downto 0) := r.addr(63 downto 32);
479  when others =>
480  v.txMaster.tData(31 downto 0) := r.reqSize(31 downto 0);
481  -- Reset the counter
482  v.hdrCnt := x"0";
483  -- Check for NULL
484  if r.opCode = NULL_C then
485  -- Next State
486  v.state := FOOTER_S;
487  end if;
488  -- Check for framing error or EOFE
489  if (r.frameError = '1') or (r.eofe = '1') then
490  -- Next State
491  v.state := FOOTER_S;
492  end if;
493  -- Check for version mismatch
494  if r.remVer /= SRP_VERSION_C then
495  -- Set the flags
496  v.verMismatch := '1';
497  -- Next State
498  v.state := FOOTER_S;
499  end if;
500  -- Check for invalid reqSize with respect to writes
501  if ((r.opCode = NON_POSTED_WRITE_C) or (r.opCode = POSTED_WRITE_C)) and (r.reqSize(31 downto 12) /= 0) then
502  -- Set the flags
503  v.reqSizeError := '1';
504  -- Next State
505  v.state := FOOTER_S;
506  end if;
507  -- Check for invalid address size (AXI-Lite only support 32-bit address space)
508  if (r.addr(63 downto 32) /= 0) then
509  -- Set the flags
510  v.memResp(7) := '1';
511  -- Next State
512  v.state := FOOTER_S;
513  end if;
514  -- Check for non 32-bit address alignment
515  if r.addr(1 downto 0) /= 0 then
516  -- Set the flags
517  v.memResp(6) := '1';
518  -- Next State
519  v.state := FOOTER_S;
520  end if;
521  -- Check for non 32-bit transaction request
522  if r.reqSize(1 downto 0) /= "11" then
523  -- Set the flags
524  v.memResp(5) := '1';
525  -- Next State
526  v.state := FOOTER_S;
527  end if;
528  -- If no error or NULL found above, then proceed with read or write request
529  if (v.state /= FOOTER_S) then
530  -- Set the counter size
531  v.cntSize := r.reqSize(31 downto 2);
532  -- Check for read
533  if r.opCode = NON_POSTED_READ_C then
534  -- Next State
535  v.state := AXIL_RD_REQ_S;
536  -- Else it is a write
537  else
538  -- Next State
539  v.state := AXIL_WR_REQ_S;
540  end if;
541  end if;
542  end case;
543  end if;
544  ----------------------------------------------------------------------
545  when FOOTER_S =>
546  -- Check if ready to move data
547  if (v.txMaster.tValid = '0') then
548  -- Check for posted write
549  if r.opCode /= POSTED_WRITE_C then
550  -- Set the flags
551  v.txMaster.tValid := '1';
552  end if;
553  -- Set the footer data
554  v.txMaster.tLast := '1';
555  v.txMaster.tData(7 downto 0) := r.memResp;
556  v.txMaster.tData(8) := r.timeout;
557  v.txMaster.tData(9) := r.eofe;
558  v.txMaster.tData(10) := r.frameError;
559  v.txMaster.tData(11) := r.verMismatch;
560  v.txMaster.tData(12) := r.reqSizeError;
561  v.txMaster.tData(31 downto 13) := (others => '0');
562  -- Debugging code for chipscope
563  v.tidDly := r.tid;
564  if ((r.tidDly + 1) /= r.tid) then
565  v.skip := '1';
566  end if;
567  -- Next state
568  v.state := IDLE_S;
569  end if;
570  ----------------------------------------------------------------------
571  when AXIL_RD_REQ_S =>
572  -- Check if ready to move data
573  if (v.txMaster.tValid = '0') then
574  -- Set the read address buses
575  v.mAxilReadMaster.araddr := r.addr(31 downto 0);
576  -- Start AXI-Lite transaction
577  v.mAxilReadMaster.arvalid := '1';
578  v.mAxilReadMaster.rready := '1';
579  -- Reset the timer
580  v.timer := 0;
581  v.timeoutCnt := (others => '0');
582  -- Next state
583  v.state := AXIL_RD_RESP_S;
584  end if;
585  ----------------------------------------------------------------------
586  when AXIL_RD_RESP_S =>
587  -- Check if ready to move data
588  if (v.txMaster.tValid = '0') then
589  -- Check slave.arready flag
590  if mAxilReadSlave.arready = '1' then
591  -- Reset the flag
592  v.mAxilReadMaster.arvalid := '0';
593  end if;
594  -- Check slave.rvalid flag
595  if mAxilReadSlave.rvalid = '1' then
596  -- Reset the flag
597  v.mAxilReadMaster.rready := '0';
598  -- Latch the memory bus responds
599  if (r.ignoreMemResp = '0') then
600  v.memResp(1 downto 0) := mAxilReadSlave.rresp;
601  end if;
602  -- Check for a valid responds
604  -- Move the data
605  v.txMaster.tValid := '1';
606  v.txMaster.tData(31 downto 0) := mAxilReadSlave.rdata;
607  elsif (r.ignoreMemResp = '1') then
608  -- Move the data
609  v.txMaster.tValid := '1';
610  v.txMaster.tData(31 downto 0) := (others => '1');
611  end if;
612  end if;
613  -- Check if transaction is done
614  if (v.mAxilReadMaster.arvalid = '0') and (v.mAxilReadMaster.rready = '0') then
615  -- Check for memory bus error
616  if v.memResp /= 0 then
617  -- Next State
618  v.state := FOOTER_S;
619  else
620  -- Increment the counter
621  v.cnt := r.cnt + 1;
622  -- Check the counter
623  if r.cnt = r.cntSize then
624  -- Next State
625  v.state := FOOTER_S;
626  else
627  -- Increment the address
628  v.addr(31 downto 2) := r.addr(31 downto 2) + 1;
629  -- Next state
630  v.state := AXIL_RD_REQ_S;
631  end if;
632  end if;
633  end if;
634  end if;
635  -- Check if timer enabled
636  if r.timeoutSize /= 0 then
637  -- Check 100 ms timer
638  if r.timer = TIMEOUT_C then
639  -- Increment counter
640  v.timeoutCnt := r.timeoutCnt + 1;
641  -- Check the counter
642  if v.timeoutCnt = r.timeoutSize then
643  -- Set the flags
644  v.timeout := '1';
645  -- Next State
646  v.state := FOOTER_S;
647  end if;
648  end if;
649  end if;
650  ----------------------------------------------------------------------
651  when AXIL_WR_REQ_S =>
652  -- Check for valid data and ready to move data
653  if (rxMaster.tValid = '1') and (v.txMaster.tValid = '0') then
654  -- Accept the data
655  v.rxSlave.tReady := '1';
656  -- Check for framing error
657  if (rxMaster.tLast = '1') and (r.cnt /= r.cntSize) then
658  -- Set the flags
659  v.frameError := '1';
660  -- Next State
661  v.state := FOOTER_S;
662  -- Check for framing error
663  elsif (rxMaster.tLast = '0') and (r.cnt = r.cntSize) then
664  -- Set the flags
665  v.frameError := '1';
666  -- Next State
667  v.state := FOOTER_S;
668  else
669  -- Check for posted write
670  if r.opCode /= POSTED_WRITE_C then
671  -- Set the flags
672  v.txMaster.tValid := '1';
673  end if;
674  -- Echo the write data back
675  v.txMaster.tData(31 downto 0) := rxMaster.tData(31 downto 0);
676  -- Set the write address buses
677  v.mAxilWriteMaster.awaddr := r.addr(31 downto 0);
678  -- Set the write data bus
679  v.mAxilWriteMaster.wdata := rxMaster.tData(31 downto 0);
680  -- Start AXI-Lite transaction
681  v.mAxilWriteMaster.awvalid := '1';
682  v.mAxilWriteMaster.wvalid := '1';
683  v.mAxilWriteMaster.bready := '1';
684  -- Reset the timer
685  v.timer := 0;
686  v.timeoutCnt := (others => '0');
687  -- Next state
688  v.state := AXIL_WR_RESP_S;
689  end if;
690  end if;
691  ----------------------------------------------------------------------
692  when AXIL_WR_RESP_S =>
693  -- Check the slave.awready flag
694  if mAxilWriteSlave.awready = '1' then
695  -- Reset the flag
696  v.mAxilWriteMaster.awvalid := '0';
697  end if;
698  -- Check the slave.wready flag
699  if mAxilWriteSlave.wready = '1' then
700  -- Reset the flag
701  v.mAxilWriteMaster.wvalid := '0';
702  end if;
703  -- Check the slave.bvalid flag
704  if mAxilWriteSlave.bvalid = '1' then
705  -- Reset the flag
706  v.mAxilWriteMaster.bready := '0';
707  -- Latch the memory bus responds
708  if (r.ignoreMemResp = '0') then
709  v.memResp(1 downto 0) := mAxilWriteSlave.bresp;
710  end if;
711  end if;
712  -- Check if transaction is done
713  if (v.mAxilWriteMaster.awvalid = '0') and(v.mAxilWriteMaster.wvalid = '0') and (v.mAxilWriteMaster.bready = '0') then
714  -- Check for memory bus error
715  if v.memResp /= 0 then
716  -- Next State
717  v.state := FOOTER_S;
718  else
719  -- Increment the counter
720  v.cnt := r.cnt + 1;
721  -- Check the counter
722  if r.cnt = r.cntSize then
723  -- Next State
724  v.state := FOOTER_S;
725  else
726  -- Increment the address
727  v.addr(31 downto 2) := r.addr(31 downto 2) + 1;
728  -- Next state
729  v.state := AXIL_WR_REQ_S;
730  end if;
731  end if;
732  end if;
733  -- Check if timer enabled
734  if r.timeoutSize /= 0 then
735  -- Check 100 ms timer
736  if r.timer = TIMEOUT_C then
737  -- Increment counter
738  v.timeoutCnt := r.timeoutCnt + 1;
739  -- Check the counter
740  if v.timeoutCnt = r.timeoutSize then
741  -- Set the flags
742  v.timeout := '1';
743  -- Next State
744  v.state := FOOTER_S;
745  end if;
746  end if;
747  end if;
748  ----------------------------------------------------------------------
749  end case;
750 
751  -- Update the EOFE flag
752  if (rxMaster.tLast = '1') and (v.rxSlave.tReady = '1') then
753  v.eofe := ssiGetUserEofe(AXIS_CONFIG_C, rxMaster);
754  end if;
755 
756  -- Reset
757  if (axilRst = '1') then
758  v := REG_INIT_C;
759  end if;
760 
761  -- Register the variable for next clock cycle
762  rin <= v;
763 
764  -- Outputs
765  rxSlave <= v.rxSlave;
768  rxRst <= r.rxRst or axilRst;
769 
770  end process comb;
771 
772  seq : process (axilClk) is
773  begin
774  if (rising_edge(axilClk)) then
775  r <= rin after TPD_G;
776  end if;
777  end process seq;
778 
779  TX_FIFO : entity work.AxiStreamFifoV2
780  generic map (
781  -- General Configurations
782  TPD_G => TPD_G,
785  SLAVE_READY_EN_G => true,
787  -- FIFO configurations
788  BRAM_EN_G => true,
789  XIL_DEVICE_G => "7SERIES",
790  USE_BUILT_IN_G => false,
794  CASCADE_SIZE_G => 1,
795  FIFO_ADDR_WIDTH_G => 9,
796  -- AXI Stream Port Configurations
797  SLAVE_AXI_CONFIG_G => AXIS_CONFIG_C,
799  port map (
800  -- Slave Port
801  sAxisClk => axilClk,
802  sAxisRst => axilRst,
803  sAxisMaster => r.txMaster,
804  sAxisSlave => txSlave,
805  -- Master Port
806  mAxisClk => mAxisClk,
807  mAxisRst => mAxisRst,
810 
811 end rtl;
FIFO_ADDR_WIDTH_Ginteger range 4 to 48:= 9
FRAME_LIMIT_Gpositive := 1024
GEN_SYNC_FIFO_Gboolean := false
out sAxisCtrlAxiStreamCtrlType
in mAxisSlaveAxiStreamSlaveType
ALTERA_RAM_Gstring := "M9K"
AXI_STREAM_CONFIG_GAxiStreamConfigType := ssiAxiStreamConfig( 2)
SLAVE_FIFO_Gboolean := false
slv( 1 downto 0) rresp
Definition: AxiLitePkg.vhd:90
INT_PIPE_STAGES_Gnatural range 0 to 16:= 1
out syncRstsl
Definition: RstSync.vhd:36
out mAxisMasterAxiStreamMasterType
PIPE_STAGES_Gnatural range 0 to 16:= 1
AxiLiteWriteMasterType
Definition: AxiLitePkg.vhd:111
std_logic sl
Definition: StdRtlPkg.vhd:28
out sAxisSlaveAxiStreamSlaveType
SLAVE_AXI_CONFIG_GAxiStreamConfigType := AXI_STREAM_CONFIG_INIT_C
integer := 0 SSI_EOFE_C
Definition: SsiPkg.vhd:30
AxiStreamMasterType :=(tValid => '0',tData =>( others => '0'),tStrb =>( others => '1'),tKeep =>( others => '1'),tLast => '0',tDest =>( others => '0'),tId =>( others => '0'),tUser =>( others => '0')) AXI_STREAM_MASTER_INIT_C
sl eofe
Definition: SsiPkg.vhd:74
SLAVE_AXI_CONFIG_GAxiStreamConfigType := AXI_STREAM_CONFIG_INIT_C
slv( 31 downto 0) rdata
Definition: AxiLitePkg.vhd:89
AXIL_CLK_FREQ_Greal := 156.25E+6
SLAVE_READY_EN_Gboolean := true
FIFO_FIXED_THRESH_Gboolean := true
FIFO_PAUSE_THRESH_Gpositive range 1 to 511:= 256
TPD_Gtime := 1 ns
COMMON_CLK_Gboolean := false
natural range 1 to 16 TDATA_BYTES_C
out mAxisMasterAxiStreamMasterType
INT_DATA_WIDTH_Gnatural range 1 to 16:= 16
GEN_SYNC_FIFO_Gboolean := false
in asyncRstsl
Definition: RstSync.vhd:35
in mAxisSlaveAxiStreamSlaveType
out mAxilReadMasterAxiLiteReadMasterType
XIL_DEVICE_Gstring := "7SERIES"
slv( 31 downto 0) wdata
Definition: AxiLitePkg.vhd:117
in clksl
Definition: RstSync.vhd:34
PIPE_STAGES_Gnatural range 0 to 16:= 1
in rstsl :=not RST_POLARITY_G
INT_WIDTH_SELECT_Gstring := "WIDE"
slv( 127 downto 0) tData
INT_PIPE_STAGES_Gnatural range 0 to 16:= 0
in sAxisMasterAxiStreamMasterType
AxiStreamSlaveType :=(tReady => '0') AXI_STREAM_SLAVE_INIT_C
SLAVE_READY_EN_Gboolean := true
AxiLiteReadMasterType
Definition: AxiLitePkg.vhd:59
BRAM_EN_Gboolean := true
slv( 31 downto 0) awaddr
Definition: AxiLitePkg.vhd:113
ALTERA_SYN_Gboolean := false
TPD_Gtime := 1 ns
Definition: RstSync.vhd:27
slv( 127 downto 0) tUser
in mAxilReadSlaveAxiLiteReadSlaveType
TPD_Gtime := 1 ns
slv( 1 downto 0) bresp
Definition: AxiLitePkg.vhd:150
out sAxisSlaveAxiStreamSlaveType
out sAxisSlaveAxiStreamSlaveType
ALTERA_SYN_Gboolean := false
in sAxisMasterAxiStreamMasterType
AxiLiteReadMasterType :=(araddr =>( others => '0'),arprot =>( others => '0'),arvalid => '0',rready => '1') AXI_LITE_READ_MASTER_INIT_C
Definition: AxiLitePkg.vhd:69
_library_ ieeeieee
Definition: SrpV3Axi.vhd:21
ALTERA_RAM_Gstring := "M9K"
slv( 7 downto 0) tDest
AxiLiteReadSlaveType
Definition: AxiLitePkg.vhd:85
out mTLastTUserslv( 7 downto 0)
AxiLiteWriteMasterType :=(awaddr =>( others => '0'),awprot =>( others => '0'),awvalid => '0',wdata =>( others => '0'),wstrb =>( others => '1'),wvalid => '0',bready => '1') AXI_LITE_WRITE_MASTER_INIT_C
Definition: AxiLitePkg.vhd:125
in sAxisMasterAxiStreamMasterType
out mAxisMasterAxiStreamMasterType
slv( 1 downto 0) := "00" AXI_RESP_OK_C
Definition: AxiLitePkg.vhd:31
MASTER_AXI_CONFIG_GAxiStreamConfigType := AXI_STREAM_CONFIG_INIT_C
slv( 31 downto 0) araddr
Definition: AxiLitePkg.vhd:61
TX_VALID_THOLD_Gpositive := 1
in mAxisSlaveAxiStreamSlaveType
CASCADE_SIZE_Ginteger range 1 to ( 2** 24):= 1
USE_BUILT_IN_Gboolean := false
in rstsl :=not RST_POLARITY_G
EN_TIMEOUT_Gboolean := true
FIFO_PAUSE_THRESH_Ginteger range 1 to ( 2** 24):= 1
VALID_THOLD_Ginteger range 0 to ( 2** 24):= 1
out mAxilWriteMasterAxiLiteWriteMasterType
TPD_Gtime := 1 ns
MASTER_FIFO_Gboolean := false
in mAxilWriteSlaveAxiLiteWriteSlaveType
MASTER_AXI_CONFIG_GAxiStreamConfigType := AXI_STREAM_CONFIG_INIT_C
out sAxisCtrlAxiStreamCtrlType
SLAVE_READY_EN_Gboolean := false
std_logic_vector slv
Definition: StdRtlPkg.vhd:29