File: t_net_delay.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 (55 lines) | stat: -rw-r--r-- 1,554 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
54
55
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2022 by Antmicro Ltd.
// SPDX-License-Identifier: CC0-1.0

`define stop $stop
`define checkh(gotv,expv) do if ((gotv) !== (expv)) begin $write("%%Error: %s:%0d:  got='h%x exp='h%x\n", `__FILE__,`__LINE__, (gotv), (expv)); `stop; end while(0)

module t;
   // verilator lint_off UNOPTFLAT
   // verilator lint_off PROCASSINIT
   logic clk = 0;
   // verilator lint_on UNOPTFLAT
   // verilator lint_on PROCASSINIT
   always #2 clk = ~clk;

   // verilator lint_off UNDRIVEN
   wire[3:0] x;
   // verilator lint_on UNDRIVEN
   bit [3:0] cyc;
   wire[3:0] #3 val1;
   wire[3:0] #3 val2;
   wire[3:0] #5 val3 = cyc;
   wire[3:0] #5 val4;
   wire[3:0] #3 val5 = x, val6 = cyc;

   assign val1 = cyc;
   assign #3 val2 = cyc;
   assign val4 = cyc;
   assign val5 = cyc;

   always @(posedge clk) begin
       if ($time > 0) cyc <= cyc + 1;
       if (cyc == 15) begin
           $write("*-* All Finished *-*\n");
           $finish;
       end
   end

   always @(posedge clk) #1 begin
`ifdef TEST_VERBOSE
      $display("[%0t] cyc=%0d val1=%0d val2=%0d val3=%0d val4=%0d val5=%0d val6=%0d",
               $time, cyc, val1, val2, val3, val4, val5, val6);
`endif
      if (cyc >= 3) begin
          `checkh(val1, cyc - 1);
          `checkh(val2, cyc - 2);
          `checkh(val3, 0);
          `checkh(val4, 0);
          `checkh(val5, cyc);
          `checkh(val6, cyc - 1);
       end
    end
endmodule