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

« back to all changes in this revision

Viewing changes to books/centaur/vl/systest/define/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
module compare () ;
 
32
 
 
33
  reg [3:0] a;
 
34
  reg [3:0] n1;
 
35
  reg [3:0] n2;
 
36
 
 
37
  wire [3:0] spec_o1;
 
38
  wire [3:0] spec_o2;
 
39
  wire [3:0] spec_o3;
 
40
  wire [3:0] spec_o4;
 
41
  wire [3:0] spec_o5;
 
42
 
 
43
  wire [3:0] impl_o1;
 
44
  wire [3:0] impl_o2;
 
45
  wire [3:0] impl_o3;
 
46
  wire [3:0] impl_o4;
 
47
  wire [3:0] impl_o5;
 
48
 
 
49
  dut spec (
 
50
  .o1(spec_o1),
 
51
  .o2(spec_o2),
 
52
  .o3(spec_o3),
 
53
  .o4(spec_o4),
 
54
  .o5(spec_o5),
 
55
  .a(a),
 
56
  .n1(n1),
 
57
  .n2(n2)
 
58
  );
 
59
 
 
60
  \dut$size=1 impl (
 
61
  .o1(impl_o1),
 
62
  .o2(impl_o2),
 
63
  .o3(impl_o3),
 
64
  .o4(impl_o4),
 
65
  .o5(impl_o5),
 
66
  .a(a),
 
67
  .n1(n1),
 
68
  .n2(n2)
 
69
  );
 
70
 
 
71
  wire ok =
 
72
          (impl_o1 === spec_o1)
 
73
       && (impl_o2 === spec_o2)
 
74
       && (impl_o3 === spec_o3)
 
75
       && (impl_o4 === spec_o4)
 
76
       && (impl_o5 === spec_o5);
 
77
 
 
78
  integer    seed;
 
79
  integer    i;
 
80
  initial
 
81
  begin
 
82
    for(i = 0; i < 'd 1_000_000; i = i + 1)
 
83
    begin
 
84
      {a, n1, n2} = $random(seed);
 
85
      #10;
 
86
      if (!ok)
 
87
      begin
 
88
        $display("Failure for %b, %b, %b:", a, n1, n2);
 
89
        if (impl_o1 !== spec_o1) $display("fail o1: impl %b, spec %b", impl_o1, spec_o1);
 
90
        if (impl_o2 !== spec_o2) $display("fail o2: impl %b, spec %b", impl_o2, spec_o2);
 
91
        if (impl_o3 !== spec_o3) $display("fail o3: impl %b, spec %b", impl_o3, spec_o3);
 
92
        if (impl_o4 !== spec_o4) $display("fail o4: impl %b, spec %b", impl_o4, spec_o4);
 
93
        if (impl_o5 !== spec_o5) $display("fail o5: impl %b, spec %b", impl_o5, spec_o5);
 
94
      end
 
95
    end
 
96
  end
 
97
 
 
98
endmodule
 
99