File: chdr_framer_tb.v

package info (click to toggle)
uhd 3.15.0.0-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 202,252 kB
  • sloc: cpp: 182,756; ansic: 94,109; vhdl: 53,420; python: 45,849; xml: 12,956; tcl: 7,046; makefile: 2,248; sh: 1,741; pascal: 230; javascript: 120; csh: 94; asm: 20; perl: 11
file content (80 lines) | stat: -rw-r--r-- 1,669 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
//
// Copyright 2012-2013 Ettus Research LLC
// Copyright 2018 Ettus Research, a National Instruments Company
//
// SPDX-License-Identifier: LGPL-3.0-or-later
//

//`timescale 1ns
module chdr_framer_tb();
   
   reg clk, reset;
   always
     #100 clk = ~clk;

   initial $dumpfile("chdr_framer_tb.vcd");
   initial $dumpvars(0,chdr_framer_tb);

   reg [31:0] i_tdata;
   reg [127:0] i_tuser;
   reg i_tlast, i_tvalid;
   wire i_tready;

   wire [63:0] o_tdata;
   wire        o_tlast, o_tvalid;

   reg 	       o_tready = 0;
   
   chdr_framer #(.SIZE(10)) chdr_framer
     (.clk(clk), .reset(reset), .clear(0),
      .i_tdata(i_tdata), .i_tuser(i_tuser), .i_tlast(i_tlast), .i_tvalid(i_tvalid), .i_tready(i_tready),
      .o_tdata(o_tdata), .o_tlast(o_tlast), .o_tvalid(o_tvalid), .o_tready(o_tready));

   always 
     begin
	#1 o_tready = 1;
	repeat (200)
	  @(posedge clk);
	#1 o_tready = 0;
	repeat (120)
	  @(posedge clk);
     end
		   
	    
   initial
     begin
	clk = 0;
	reset = 1;
	i_tlast = 0;
	i_tvalid = 0;
	i_tdata = 32'hBEEF_0000;
	i_tuser = 128'hF123_4567_89ab_cdef_0011_2233_4455_0000;
	#1000 reset = 0;
	repeat (10)
	  @(posedge clk);
	#1 i_tvalid = 1;
	repeat (400)
	  begin
	     #1 i_tlast = 0;
	     repeat (22)
	       begin
		  #1 i_tdata = i_tdata + 1;
		  @(posedge clk);
	       end
	     #1 i_tdata = i_tdata + 1;
	     #1 i_tlast = 1;
	     @(posedge clk);
	     #1 i_tuser <= i_tuser + 1;
	  end // repeat (20)
	#1 i_tvalid <= 0;
	#100000 $finish;
     end

   always @(posedge clk)
     if(o_tvalid & o_tready)
       if(o_tlast)
	 $display("%x    LAST",o_tdata);
       else
	 $display("%x",o_tdata);
   
endmodule // chdr_framer_tb