~ubuntu-branches/ubuntu/wily/acl2/wily

« back to all changes in this revision

Viewing changes to books/centaur/vl/systest/fns4/compare.v

  • Committer: Package Import Robot
  • Author(s): Camm Maguire
  • Date: 2015-01-16 10:35:45 UTC
  • mfrom: (3.3.26 sid)
  • Revision ID: package-import@ubuntu.com-20150116103545-prehe9thgo79o8w8
Tags: 7.0-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// VL Verilog Toolkit
 
2
// Copyright (C) 2008-2014 Centaur Technology
 
3
//
 
4
// Contact:
 
5
//   Centaur Technology Formal Verification Group
 
6
//   7600-C N. Capital of Texas Highway, Suite 300, Austin, TX 78731, USA.
 
7
//   http://www.centtech.com/
 
8
//
 
9
// License: (An MIT/X11-style license)
 
10
//
 
11
//   Permission is hereby granted, free of charge, to any person obtaining a
 
12
//   copy of this software and associated documentation files (the "Software"),
 
13
//   to deal in the Software without restriction, including without limitation
 
14
//   the rights to use, copy, modify, merge, publish, distribute, sublicense,
 
15
//   and/or sell copies of the Software, and to permit persons to whom the
 
16
//   Software is furnished to do so, subject to the following conditions:
 
17
//
 
18
//   The above copyright notice and this permission notice shall be included in
 
19
//   all copies or substantial portions of the Software.
 
20
//
 
21
//   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
22
//   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
23
//   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
 
24
//   THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 
25
//   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 
26
//   FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 
27
//   DEALINGS IN THE SOFTWARE.
 
28
//
 
29
// Original author: Jared Davis <jared@centtech.com>
 
30
 
 
31
`ifndef SYSTEM_VERILOG_MODE
 
32
 
 
33
module dummy ();
 
34
 
 
35
  initial $display("This test is for SystemVerilog only, nothing to check.");
 
36
 
 
37
endmodule
 
38
 
 
39
`else
 
40
 
 
41
module compare () ;
 
42
 
 
43
  reg [7:0]  in1;
 
44
  reg [7:0]  in2;
 
45
 
 
46
  wire [7:0] spec_out1, spec_out2, spec_out3, spec_out4, spec_out5;
 
47
 
 
48
  dut spec (.in1(in1),
 
49
            .in2(in2),
 
50
            .out1(spec_out1),
 
51
            .out2(spec_out2),
 
52
            .out3(spec_out3),
 
53
            .out4(spec_out4),
 
54
            .out5(spec_out5)
 
55
  );
 
56
 
 
57
  wire [7:0] impl_out1, impl_out2, impl_out3, impl_out4, impl_out5;
 
58
 
 
59
  \dut$size=1 impl(.in1(in1),
 
60
                   .in2(in2),
 
61
                   .out1(impl_out1),
 
62
                   .out2(impl_out2),
 
63
                   .out3(impl_out3),
 
64
                   .out4(impl_out4),
 
65
                   .out5(impl_out5)
 
66
  );
 
67
 
 
68
  wire all_ok =     (impl_out1 === spec_out1)
 
69
                 && (impl_out2 === spec_out2)
 
70
                 && (impl_out3 === spec_out3)
 
71
                 && (impl_out4 === spec_out4)
 
72
                 && (impl_out5 === spec_out5);
 
73
 
 
74
  reg [3:0]  Vals;
 
75
  integer    i0, i1, i2, i3, i4, i5, i6, i7, i8;
 
76
  integer    j0, j1, j2, j3, j4, j5, j6, j7, j8;
 
77
  integer    seed;
 
78
 
 
79
  initial
 
80
    begin
 
81
      Vals = 4'bZX10;
 
82
      seed = 0;
 
83
 
 
84
      for(i0 = 0; i0 < 4; i0 = i0 + 1)
 
85
      for(i1 = 0; i1 < 4; i1 = i1 + 1)
 
86
      for(i2 = 0; i2 < 4; i2 = i2 + 1)
 
87
      for(i3 = 0; i3 < 4; i3 = i3 + 1)
 
88
      for(i4 = 0; i4 < 4; i4 = i4 + 1)
 
89
      for(i5 = 0; i5 < 4; i5 = i5 + 1)
 
90
      for(i6 = 0; i6 < 4; i6 = i6 + 1)
 
91
      for(i7 = 0; i7 < 4; i7 = i7 + 1)
 
92
 
 
93
      for(j0 = 0; j0 < 50; j0 = j0 + 1)
 
94
      begin
 
95
        in1 = $random(seed);
 
96
        in2 = $random(seed);
 
97
        in1[3:0] = {Vals[i0], Vals[i1], Vals[i2], Vals[i3]};
 
98
        in2[3:0] = {Vals[i4], Vals[i5], Vals[i6], Vals[i7]};
 
99
        #10;
 
100
 
 
101
        if (all_ok !== 1'b1)         $display("fail for in1 = %b, in2 = %b:", in1, in2);
 
102
        if (spec_out1 !== impl_out1) $display("out1 spec = %b vs. impl = %b", spec_out1, impl_out1);
 
103
        if (spec_out2 !== impl_out2) $display("out2 spec = %b vs. impl = %b", spec_out2, impl_out2);
 
104
        if (spec_out3 !== impl_out3) $display("out3 spec = %b vs. impl = %b", spec_out3, impl_out3);
 
105
        if (spec_out4 !== impl_out4) $display("out4 spec = %b vs. impl = %b", spec_out4, impl_out4);
 
106
        if (spec_out5 !== impl_out5) $display("out5 spec = %b vs. impl = %b", spec_out5, impl_out5);
 
107
        if (all_ok !== 1'b1)         $finish;
 
108
 
 
109
      end
 
110
 
 
111
   end
 
112
 
 
113
endmodule
 
114
 
 
115
`endif