File: t_interface_array4.v

package info (click to toggle)
verilator 5.038-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 162,552 kB
  • sloc: cpp: 139,204; python: 20,931; ansic: 10,222; yacc: 6,000; lex: 1,925; makefile: 1,260; sh: 494; perl: 282; fortran: 22
file content (53 lines) | stat: -rw-r--r-- 1,003 bytes parent folder | download
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
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2025 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0

interface Ifc;
  logic req, grant;
  logic [7:0] addr, data;
endinterface

class Cls;
  virtual Ifc bus;
  int m_i;
  function new(virtual Ifc s, int i);
    bus = s;
    m_i = i;
  endfunction
  task request();
    bus.req <= 1'b1;
  endtask
  task wait_for_bus();
    @(posedge bus.grant);
  endtask
endclass

module devA (Ifc s);
endmodule
module devB (Ifc s);
endmodule

module top;
  Ifc s14[1:4] ();
  devA a1 (s14[1]);
  devB b1 (s14[2]);
  devA a2 (s14[3]);
  devB b2 (s14[4]);

  Ifc s65[6:5] ();
  devA a3 (s65[5]);
  devB b3 (s65[6]);

  initial begin
    Cls t14[1:4];
    Cls t65[6:5];
    t14[1] = new(s14[1], 1);
    t14[2] = new(s14[2], 2);
    t14[3] = new(s14[3], 3);
    t14[4] = new(s14[4], 4);
    t65[5] = new(s65[5], 5);
    t65[6] = new(s65[6], 6);
  end
endmodule