43 use IEEE.STD_LOGIC_1164.
ALL;
44 use IEEE.NUMERIC_STD.
ALL;
48 library XIL_DEFAULTLIB;
74 constant cTREG : time := 1.
0 ns;
77 constant cShellClkPeriod : time := 6.
40 ns;
84 signal sSHL_156_25Clk : std_logic;
85 signal sSHL_156_25Rst : std_logic;
86 signal sVoid_n : std_logic;
90 signal sSHL_Rol_Nts0_Udp_Axis_tdata : std_ulogic_vector( 63 downto 0);
91 signal sSHL_Rol_Nts0_Udp_Axis_tkeep : std_ulogic_vector( 7 downto 0);
92 signal sSHL_Rol_Nts0_Udp_Axis_tlast : std_ulogic;
93 signal sSHL_Rol_Nts0_Udp_Axis_tvalid : std_ulogic;
94 signal sROL_Shl_Nts0_Udp_Axis_tready : std_ulogic;
96 signal sSHL_Rol_Nts0_Udp_Axis_tready : std_ulogic;
97 signal sROL_Shl_Nts0_Udp_Axis_tdata : std_ulogic_vector( 63 downto 0);
98 signal sROL_Shl_Nts0_Udp_Axis_tkeep : std_ulogic_vector( 7 downto 0);
99 signal sROL_Shl_Nts0_Udp_Axis_tlast : std_ulogic;
100 signal sROL_Shl_Nts0_Udp_Axis_tvalid : std_ulogic;
104 signal sSHL_Rol_Nts0_Tcp_Axis_tdata : std_ulogic_vector( 63 downto 0);
105 signal sSHL_Rol_Nts0_Tcp_Axis_tkeep : std_ulogic_vector( 7 downto 0);
106 signal sSHL_Rol_Nts0_Tcp_Axis_tlast : std_ulogic;
107 signal sSHL_Rol_Nts0_Tcp_Axis_tvalid : std_ulogic;
108 signal sROL_Shl_Nts0_Tcp_Axis_tready : std_ulogic;
110 signal sSHL_Rol_Nts0_Tcp_Axis_tready : std_ulogic;
111 signal sROL_Shl_Nts0_Tcp_Axis_tdata : std_ulogic_vector( 63 downto 0);
112 signal sROL_Shl_Nts0_Tcp_Axis_tkeep : std_ulogic_vector( 7 downto 0);
113 signal sROL_Shl_Nts0_Tcp_Axis_tlast : std_ulogic;
114 signal sROL_Shl_Nts0_Tcp_Axis_tvalid : std_ulogic;
118 signal sSHL_Rol_Mmio_UdpEchoCtrl : std_ulogic_vector( 1 downto 0);
119 signal sSHL_Rol_Mmio_UdpPostPktEn : std_ulogic;
120 signal sSHL_Rol_Mmio_UdpCaptPktEn : std_ulogic;
121 signal sSHL_Rol_Mmio_TcpEchoCtrl : std_ulogic_vector( 1 downto 0);
122 signal sSHL_Rol_Mmio_TcpPostPktEn : std_ulogic;
123 signal sSHL_Rol_Mmio_TcpCaptPktEn : std_ulogic;
127 signal sTOP_250_00Clk : std_ulogic;
130 signal sTbRunCtrl : std_ulogic;
133 shared variable vUdpFcReq : boolean;
134 shared variable vTcpFcReq : boolean;
135 shared variable vUdpFcBegCyc, vUdpFcEndCyc: integer;
136 shared variable vTcpFcBegCyc, vTcpFcEndCyc: integer;
142 procedure pdGenClock (
143 constant cT :
in time;
144 signal sClock_n :
out std_ulogic;
145 signal sClock_p :
out std_ulogic;
146 signal sDoRun :
in std_ulogic)
is
151 while (sDoRun = '1') loop
159 end procedure pdGenClock;
164 procedure pgGenShellUdpFc (
169 vUdpFcBegCyc := begCyc;
170 vUdpFcEndCyc := endCyc;
171 end procedure pgGenShellUdpFc;
176 procedure pgGenShellTcpFc (
181 vTcpFcBegCyc := begCyc;
182 vTcpFcEndCyc := endCyc;
183 end procedure pgGenShellTcpFc;
203 ROLE:
entity work.Role_x1Udp_x1Tcp_x2Mp
209 piSHL_156_25Clk => sSHL_156_25Clk,
210 piSHL_156_25Rst => sSHL_156_25Rst,
216 piSHL_Rol_Nts0_Udp_Axis_tdata => sSHL_Rol_Nts0_Udp_Axis_tdata,
217 piSHL_Rol_Nts0_Udp_Axis_tkeep => sSHL_Rol_Nts0_Udp_Axis_tkeep,
218 piSHL_Rol_Nts0_Udp_Axis_tlast => sSHL_Rol_Nts0_Udp_Axis_tlast,
219 piSHL_Rol_Nts0_Udp_Axis_tvalid => sSHL_Rol_Nts0_Udp_Axis_tvalid,
220 poROL_Shl_Nts0_Udp_Axis_tready => sROL_Shl_Nts0_Udp_Axis_tready,
222 piSHL_Rol_Nts0_Udp_Axis_tready => sSHL_Rol_Nts0_Udp_Axis_tready,
223 poROL_Shl_Nts0_Udp_Axis_tdata => sROL_Shl_Nts0_Udp_Axis_tdata,
224 poROL_Shl_Nts0_Udp_Axis_tkeep => sROL_Shl_Nts0_Udp_Axis_tkeep,
225 poROL_Shl_Nts0_Udp_Axis_tlast => sROL_Shl_Nts0_Udp_Axis_tlast,
226 poROL_Shl_Nts0_Udp_Axis_tvalid => sROL_Shl_Nts0_Udp_Axis_tvalid,
232 piSHL_Rol_Nts0_Tcp_Axis_tdata => sSHL_Rol_Nts0_Tcp_Axis_tdata,
233 piSHL_Rol_Nts0_Tcp_Axis_tkeep => sSHL_Rol_Nts0_Tcp_Axis_tkeep,
234 piSHL_Rol_Nts0_Tcp_Axis_tlast => sSHL_Rol_Nts0_Tcp_Axis_tlast,
235 piSHL_Rol_Nts0_Tcp_Axis_tvalid => sSHL_Rol_Nts0_Tcp_Axis_tvalid,
236 poROL_Shl_Nts0_Tcp_Axis_tready => sROL_Shl_Nts0_Tcp_Axis_tready,
238 piSHL_Rol_Nts0_Tcp_Axis_tready => sSHL_Rol_Nts0_Tcp_Axis_tready,
239 poROL_Shl_Nts0_Tcp_Axis_tdata => sROL_Shl_Nts0_Tcp_Axis_tdata,
240 poROL_Shl_Nts0_Tcp_Axis_tkeep => sROL_Shl_Nts0_Tcp_Axis_tkeep,
241 poROL_Shl_Nts0_Tcp_Axis_tlast => sROL_Shl_Nts0_Tcp_Axis_tlast,
242 poROL_Shl_Nts0_Tcp_Axis_tvalid => sROL_Shl_Nts0_Tcp_Axis_tvalid,
249 piSHL_Rol_Mem_Mp0_Axis_RdCmd_tready => '0',
250 poROL_Shl_Mem_Mp0_Axis_RdCmd_tdata =>
open,
251 poROL_Shl_Mem_Mp0_Axis_RdCmd_tvalid =>
open,
253 piSHL_Rol_Mem_Mp0_Axis_RdSts_tdata =>
(others=>'0'
),
254 piSHL_Rol_Mem_Mp0_Axis_RdSts_tvalid => '0',
255 poROL_Shl_Mem_Mp0_Axis_RdSts_tready =>
open,
257 piSHL_Rol_Mem_Mp0_Axis_Read_tdata =>
(others=>'0'
),
258 piSHL_Rol_Mem_Mp0_Axis_Read_tkeep =>
(others=>'0'
),
259 piSHL_Rol_Mem_Mp0_Axis_Read_tlast => '0',
260 piSHL_Rol_Mem_Mp0_Axis_Read_tvalid => '0',
261 poROL_Shl_Mem_Mp0_Axis_Read_tready =>
open,
263 piSHL_Rol_Mem_Mp0_Axis_WrCmd_tready => '0',
264 poROL_Shl_Mem_Mp0_Axis_WrCmd_tdata =>
open,
265 poROL_Shl_Mem_Mp0_Axis_WrCmd_tvalid =>
open,
267 piSHL_Rol_Mem_Mp0_Axis_WrSts_tdata =>
(others=>'0'
),
268 piSHL_Rol_Mem_Mp0_Axis_WrSts_tvalid => '0',
269 poROL_Shl_Mem_Mp0_Axis_WrSts_tready =>
open,
271 piSHL_Rol_Mem_Mp0_Axis_Write_tready => '0',
272 poROL_Shl_Mem_Mp0_Axis_Write_tdata =>
open,
273 poROL_Shl_Mem_Mp0_Axis_Write_tkeep =>
open,
274 poROL_Shl_Mem_Mp0_Axis_Write_tlast =>
open,
275 poROL_Shl_Mem_Mp0_Axis_Write_tvalid =>
open,
282 piSHL_Rol_Mem_Mp1_Axis_RdCmd_tready => '0',
283 poROL_Shl_Mem_Mp1_Axis_RdCmd_tdata =>
open,
284 poROL_Shl_Mem_Mp1_Axis_RdCmd_tvalid =>
open,
286 piSHL_Rol_Mem_Mp1_Axis_RdSts_tdata =>
(others=>'0'
),
287 piSHL_Rol_Mem_Mp1_Axis_RdSts_tvalid => '0',
288 poROL_Shl_Mem_Mp1_Axis_RdSts_tready =>
open,
290 piSHL_Rol_Mem_Mp1_Axis_Read_tdata =>
(others=>'0'
),
291 piSHL_Rol_Mem_Mp1_Axis_Read_tkeep =>
(others=>'0'
),
292 piSHL_Rol_Mem_Mp1_Axis_Read_tlast => '0',
293 piSHL_Rol_Mem_Mp1_Axis_Read_tvalid => '0',
294 poROL_Shl_Mem_Mp1_Axis_Read_tready =>
open,
296 piSHL_Rol_Mem_Mp1_Axis_WrCmd_tready => '0',
297 poROL_Shl_Mem_Mp1_Axis_WrCmd_tdata =>
open,
298 poROL_Shl_Mem_Mp1_Axis_WrCmd_tvalid =>
open,
300 piSHL_Rol_Mem_Mp1_Axis_WrSts_tdata =>
(others=>'0'
),
301 piSHL_Rol_Mem_Mp1_Axis_WrSts_tvalid => '0',
302 poROL_Shl_Mem_Mp1_Axis_WrSts_tready =>
open,
304 piSHL_Rol_Mem_Mp1_Axis_Write_tready => '0',
305 poROL_Shl_Mem_Mp1_Axis_Write_tdata =>
open,
306 poROL_Shl_Mem_Mp1_Axis_Write_tkeep =>
open,
307 poROL_Shl_Mem_Mp1_Axis_Write_tlast =>
open,
308 poROL_Shl_Mem_Mp1_Axis_Write_tvalid =>
open,
314 piSHL_Rol_Mmio_UdpEchoCtrl => sSHL_Rol_Mmio_UdpEchoCtrl,
315 piSHL_Rol_Mmio_UdpPostPktEn => sSHL_Rol_Mmio_UdpPostPktEn,
316 piSHL_Rol_Mmio_UdpCaptPktEn => sSHL_Rol_Mmio_UdpCaptPktEn,
317 piSHL_Rol_Mmio_TcpEchoCtrl => sSHL_Rol_Mmio_TcpEchoCtrl,
318 piSHL_Rol_Mmio_TcpPostPktEn => sSHL_Rol_Mmio_TcpPostPktEn,
319 piSHL_Rol_Mmio_TcpCaptPktEn => sSHL_Rol_Mmio_TcpCaptPktEn,
324 poROL_SHL_EMIF_2B_Reg =>
open,
325 piSHL_ROL_EMIF_2B_Reg =>
(others=>'0'
),
330 piTOP_250_00Clk => sTOP_250_00Clk,
340 pGenShellClock :
process is
342 pdGenClock(cShellClkPeriod, sVoid_n, sSHL_156_25Clk, sTbRunCtrl);
343 end process pGenShellClock;
356 pGenShellUdpFc :
process (sSHL_156_25Clk)
357 variable vNow : integer;
359 if rising_edge(sSHL_156_25Clk) then
360 if (sSHL_156_25Rst = '1') then
361 sSHL_Rol_Nts0_Udp_Axis_tready <= '1';
365 if (vUdpFcReq = True) then
370 if (vNow >= vUdpFcBegCyc) then
371 sSHL_Rol_Nts0_Udp_Axis_tready <= '0';
374 if (vNow >= vUdpFcEndCyc) then
376 sSHL_Rol_Nts0_Udp_Axis_tready <= '1';
384 end process pGenShellUdpFc;
397 pGenShellTcpFc :
process (sSHL_156_25Clk)
398 variable vNow : integer;
400 if rising_edge(sSHL_156_25Clk) then
401 if (sSHL_156_25Rst = '1') then
402 sSHL_Rol_Nts0_Tcp_Axis_tready <= '1';
406 if (vTcpFcReq = True) then
411 if (vNow >= vTcpFcBegCyc) then
412 sSHL_Rol_Nts0_Tcp_Axis_tready <= '0';
415 if (vNow >= vTcpFcEndCyc) then
417 sSHL_Rol_Nts0_Tcp_Axis_tready <= '1';
425 end process pGenShellTcpFc;
431 pMainSimProc :
process is
434 variable vTbErrors : integer;
439 procedure pdReportErrors (
440 nbErrors :
in integer
442 variable myLine : line;
444 write(myLine, string'("*****************************************************************************"));
445 writeline(output, myLine);
446 if (nbErrors > 0) then
447 write(myLine, string'("** END of TESTBENCH - SIMULATION FAILED (KO): Total # error(s) = " ));
448 write(myLine, nbErrors);
449 elsif (nbErrors < 0) then
450 write(myLine, string'("** ABORTING TESTBENCH - FATAL ERROR (Please Check the Console)" ));
452 write(myLine, string'("** END of TESTBENCH - SIMULATION SUCCEEDED (OK): No Error."));
454 writeline(output, myLine);
455 write(myLine, string'("*****************************************************************************"));
456 writeline(output, myLine);
458 if (nbErrors < 0) then
459 assert FALSE Report "Aborting simulation" severity FAILURE;
461 assert FALSE Report "Successful end of simulation" severity FAILURE;
469 procedure pdAxisWrite_SHL_Rol_Nts0_Udp (
470 bitStr :
std_ulogic_vector
472 variable vVec : std_ulogic_vector(bitStr'length - 1 downto 0);
473 variable vLen : integer;
474 variable vI : integer;
475 variable myLine : line;
476 variable vErr : integer;
483 if (vLen mod 8 /= 0) then
485 pdReportErrors(vTbErrors);
486 report "[FATAL-ERROR] pdAxisWrite_SHELL_Role_Nts0_Udp() - Input parameter must be a multiple of 8 bits. ";
492 wait until rising_edge(sSHL_156_25Clk);
494 if (sROL_Shl_Nts0_Udp_Axis_tready = '1') then
497 sSHL_Rol_Nts0_Udp_Axis_tdata <= vVec(vI-1 downto vI-64);
498 sSHL_Rol_Nts0_Udp_Axis_tvalid <= '1';
499 sSHL_Rol_Nts0_Udp_Axis_tlast <= '0';
500 sSHL_Rol_Nts0_Udp_Axis_tkeep <= X"FF";
504 sSHL_Rol_Nts0_Udp_Axis_tdata(63 downto 64-vI) <= vVec(vI-1 downto 0);
505 sSHL_Rol_Nts0_Udp_Axis_tvalid <= '1';
506 sSHL_Rol_Nts0_Udp_Axis_tlast <= '1';
508 when 1*8 => sSHL_Rol_Nts0_Udp_Axis_tkeep <= X"80";
509 when 2*8 => sSHL_Rol_Nts0_Udp_Axis_tkeep <= X"C0";
510 when 3*8 => sSHL_Rol_Nts0_Udp_Axis_tkeep <= X"E0";
511 when 4*8 => sSHL_Rol_Nts0_Udp_Axis_tkeep <= X"F0";
512 when 5*8 => sSHL_Rol_Nts0_Udp_Axis_tkeep <= X"F8";
513 when 6*8 => sSHL_Rol_Nts0_Udp_Axis_tkeep <= X"FC";
514 when 7*8 => sSHL_Rol_Nts0_Udp_Axis_tkeep <= X"FE";
515 when 8*8 => sSHL_Rol_Nts0_Udp_Axis_tkeep <= X"FF";
520 sSHL_Rol_Nts0_Udp_Axis_tdata <= (others=>'X');
521 sSHL_Rol_Nts0_Udp_Axis_tkeep <= (others=>'X');
522 sSHL_Rol_Nts0_Udp_Axis_tlast <= '0';
523 sSHL_Rol_Nts0_Udp_Axis_tvalid <= '0';
527 write(myLine, string'("[INFO] Cannot write to ROLE/UDP/Axis (sROL_Shl_Nts0_Udp_Axis_tready =0"));
528 writeline(output, myLine);
534 end procedure pdAxisWrite_SHL_Rol_Nts0_Udp;
540 procedure pdAxisWrite_SHL_Rol_Nts0_Tcp (
541 bitStr :
std_ulogic_vector
543 variable vVec : std_ulogic_vector(bitStr'length - 1 downto 0);
544 variable vLen : integer;
545 variable vI : integer;
550 if (vLen mod 8 /= 0) then
552 pdReportErrors(vTbErrors);
553 report "[FATAL-ERROR] pdAxisWrite_SHELL_Role_Nts0_Tcp() - Input parameter must be a multiple of 8 bits. ";
554 assert FALSE Report "Aborting simulation" severity FAILURE;
560 wait until rising_edge(sSHL_156_25Clk);
562 if (sSHL_Rol_Nts0_Tcp_Axis_tready = '1') then
566 sSHL_Rol_Nts0_Tcp_Axis_tdata <= vVec(vI-1 downto vI-64);
567 sSHL_Rol_Nts0_Tcp_Axis_tkeep <= X"FF";
568 sSHL_Rol_Nts0_Tcp_Axis_tlast <= '0';
569 sSHL_Rol_Nts0_Tcp_Axis_tvalid <= '1';
570 if (sROL_Shl_Nts0_Tcp_Axis_tready = '1') then
576 sSHL_Rol_Nts0_Tcp_Axis_tdata(63 downto 64-vI) <= vVec(vI-1 downto 0);
577 sSHL_Rol_Nts0_Tcp_Axis_tlast <= '1';
578 sSHL_Rol_Nts0_Tcp_Axis_tvalid <= '1';
580 when 1*8 => sSHL_Rol_Nts0_Tcp_Axis_tkeep <= X"80";
581 when 2*8 => sSHL_Rol_Nts0_Tcp_Axis_tkeep <= X"C0";
582 when 3*8 => sSHL_Rol_Nts0_Tcp_Axis_tkeep <= X"E0";
583 when 4*8 => sSHL_Rol_Nts0_Tcp_Axis_tkeep <= X"F0";
584 when 5*8 => sSHL_Rol_Nts0_Tcp_Axis_tkeep <= X"F8";
585 when 6*8 => sSHL_Rol_Nts0_Tcp_Axis_tkeep <= X"FC";
586 when 7*8 => sSHL_Rol_Nts0_Tcp_Axis_tkeep <= X"FE";
587 when 8*8 => sSHL_Rol_Nts0_Tcp_Axis_tkeep <= X"FF";
589 if (sROL_Shl_Nts0_Tcp_Axis_tready = '1') then
594 sSHL_Rol_Nts0_Tcp_Axis_tdata <= (others=>'X');
595 sSHL_Rol_Nts0_Tcp_Axis_tkeep <= (others=>'X');
596 sSHL_Rol_Nts0_Tcp_Axis_tlast <= '0';
597 sSHL_Rol_Nts0_Tcp_Axis_tvalid <= '0';
603 end procedure pdAxisWrite_SHL_Rol_Nts0_Tcp;
631 sSHL_156_25Rst <= '1';
638 sSHL_Rol_Nts0_Udp_Axis_tdata <= (others => '0');
639 sSHL_Rol_Nts0_Udp_Axis_tkeep <= (others => '0');
640 sSHL_Rol_Nts0_Udp_Axis_tlast <= '0';
641 sSHL_Rol_Nts0_Udp_Axis_tvalid <= '0';
644 sSHL_Rol_Nts0_Tcp_Axis_tdata <= (others => '0');
645 sSHL_Rol_Nts0_Tcp_Axis_tkeep <= (others => '0');
646 sSHL_Rol_Nts0_Tcp_Axis_tlast <= '0';
647 sSHL_Rol_Nts0_Tcp_Axis_tvalid <= '0';
654 sSHL_Rol_Mmio_UdpEchoCtrl <= "00";
655 sSHL_Rol_Mmio_UdpPostPktEn <= '0';
656 sSHL_Rol_Mmio_UdpCaptPktEn <= '0';
657 sSHL_Rol_Mmio_TcpEchoCtrl <= "00";
658 sSHL_Rol_Mmio_TcpPostPktEn <= '0';
659 sSHL_Rol_Mmio_TcpCaptPktEn <= '0';
664 sSHL_156_25Rst <= '0';
667 wait until rising_edge(sSHL_156_25Clk);
673 pdAxisWrite_SHL_Rol_Nts0_Udp(X"0000000000000000_1111111111111111_2222222222222222_3333333333333333_4444444444444444_5555555555555555_6666666666666666_7777777777777777");
675 pdAxisWrite_SHL_Rol_Nts0_Udp(X"8888888888888888_9999999999999999_CAFEFADE");
677 pdAxisWrite_SHL_Rol_Nts0_Udp(X"AAAAAAAAAAAAAAAA_BEEF");
683 pdAxisWrite_SHL_Rol_Nts0_Tcp(X"0000000000000000_1111111111111111_2222222222222222_3333333333333333_4444444444444444_5555555555555555_6666666666666666_7777777777777777");
685 pdAxisWrite_SHL_Rol_Nts0_Tcp(X"8888888888888888_9999999999999999_CAFEFADE");
687 pdAxisWrite_SHL_Rol_Nts0_Tcp(X"AAAAAAAAAAAAAAAA_BEEF");
693 pgGenShellUdpFc(2, 4);
694 pdAxisWrite_SHL_Rol_Nts0_Udp(X"0000000000000000_1010101010101010_2020202020202020_3030303030303030_4040404040404040_5050505050505050_6060606060606060_7070707070707070");
700 pgGenShellTcpFc(1, 5);
701 pdAxisWrite_SHL_Rol_Nts0_Tcp(X"0000000000000000_1010101010101010_2020202020202020_3030303030303030_4040404040404040_5050505050505050_6060606060606060_7070707070707070");
706 sSHL_Rol_Mmio_UdpEchoCtrl <= "10";
707 sSHL_Rol_Mmio_UdpPostPktEn <= '1';
719 pdReportErrors(vTbErrors);
721 end process pMainSimProc;