OpenCores
URL https://opencores.org/ocsvn/qaz_libs/qaz_libs/trunk

Subversion Repositories qaz_libs

[/] [qaz_libs/] [trunk/] [axi4_stream_lib/] [src/] [axis_test_patern.sv] - Blame information for rev 34

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 34 qaztronic
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
//// Copyright (C) 2015 Authors and OPENCORES.ORG                 ////
4
////                                                              ////
5
//// This source file may be used and distributed without         ////
6
//// restriction provided that this copyright statement is not    ////
7
//// removed from the file and that any derivative work contains  ////
8
//// the original copyright notice and the associated disclaimer. ////
9
////                                                              ////
10
//// This source file is free software; you can redistribute it   ////
11
//// and/or modify it under the terms of the GNU Lesser General   ////
12
//// Public License as published by the Free Software Foundation; ////
13
//// either version 2.1 of the License, or (at your option) any   ////
14
//// later version.                                               ////
15
////                                                              ////
16
//// This source is distributed in the hope that it will be       ////
17
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
18
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
19
//// PURPOSE.  See the GNU Lesser General Public License for more ////
20
//// details.                                                     ////
21
////                                                              ////
22
//// You should have received a copy of the GNU Lesser General    ////
23
//// Public License along with this source; if not, download it   ////
24
//// from http://www.opencores.org/lgpl.shtml                     ////
25
////                                                              ////
26
//////////////////////////////////////////////////////////////////////
27
 
28
module
29
  axis_test_patern
30
  #(
31
    N, // data bus width in bytes
32
    W, // word width in bytes
33
    WPB // number of words per beat
34
  )
35
  (
36
    axis_if axis_out,
37
    input   aclk,
38
    input   aresetn
39
  );
40
 
41
// --------------------------------------------------------------------
42
// synthesis translate_off
43
  initial
44
  begin
45
    a_words_per_beat:  assert(N == W * WPB) else $fatal;
46
    a_wpb: assert((WPB != 0) & ((WPB & (WPB - 1)) == 0)) else $fatal; // power of two
47
  end
48
// synthesis translate_on
49
// --------------------------------------------------------------------
50
 
51
 
52
  // --------------------------------------------------------------------
53
  //
54
  localparam W_LG = $clog2(W);
55
 
56
 
57
  // --------------------------------------------------------------------
58
  //
59
  reg [(W*8)-W_LG-1:0] counter;
60
 
61
  always_ff @(posedge aclk)
62
    if(~aresetn)
63
      counter <= 0;
64
    else if(axis_out.tready & axis_out.tvalid)
65
      counter <= counter + 1;
66
 
67
 
68
  // --------------------------------------------------------------------
69
  //  counter test pattern
70
  wire [(N*8)-1:0] tp_counter;
71
  genvar j;
72
 
73
  generate
74
    for(j = 0; j < WPB; j++)
75
    begin: counting_test_pattern_gen
76
      wire [W_LG-1:0] index = j;
77
      assign tp_counter[j*W*8 +: W*8] = {counter, index};
78
    end
79
  endgenerate
80
 
81
 
82
  // --------------------------------------------------------------------
83
  //
84
  wire [(N*8)-1:0] tp_mux_out = tp_counter;
85
 
86
 
87
  // --------------------------------------------------------------------
88
  //
89
  assign axis_out.tvalid = 1;
90
  assign axis_out.tdata = tp_mux_out;
91
 
92
 
93
// --------------------------------------------------------------------
94
//
95
endmodule
96
 

powered by: WebSVN 2.1.0

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