2
// Copyright (C) 2008-2014 Centaur Technology
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/
9
// License: (An MIT/X11-style license)
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:
18
// The above copyright notice and this permission notice shall be included in
19
// all copies or substantial portions of the Software.
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.
29
// Original author: Jared Davis <jared@centtech.com>
31
// basic tests of case statement handling
49
input [size-1:0] src1;
50
input [size-1:0] src2;
51
input [size-1:0] src3;
53
output [size-1:0] out1;
54
output [size-1:0] out2;
55
output [size-1:0] out3;
56
output [size-1:0] out4;
57
output [size-1:0] out5;
59
reg [size-1:0] out1, out2, out3, out4, out5;
61
wire [2:0] lsbs = {src1[0], src2[0], src3[0]};
73
default: out1 = {size{1'bx}};
82
default: out2 = {size{1'bx}};
91
default: out3 = {size{1'bx}};
96
{lsbs[0], lsbs[1], lsbs[2]} : out4 = 0;
97
{lsbs[1], lsbs[0], lsbs[2]} : out4 = 1;
98
{lsbs[1], lsbs[2], lsbs[0]} : out4 = 2;
104
{lsbs[0], lsbs[1], lsbs[2]} : out5 = 0;
105
{lsbs[1], lsbs[0], lsbs[2]} : out5 = 1;
106
{lsbs[1], lsbs[2], lsbs[0]} : out5 = 2;
117
module make_tests () ;
121
case_test #(1) test1 (w[0:0], w[0:0], w[0:0],
122
w[0:0], w[0:0], w[0:0], w[0:0], w[0:0]);
124
case_test #(2) test2 (w[1:0], w[1:0], w[1:0],
125
w[1:0], w[1:0], w[1:0], w[1:0], w[1:0]);
127
case_test #(3) test3 (w[2:0], w[2:0], w[2:0],
128
w[2:0], w[2:0], w[2:0], w[2:0], w[2:0]);
130
case_test #(4) test4 (w[3:0], w[3:0], w[3:0],
131
w[3:0], w[3:0], w[3:0], w[3:0], w[3:0]);
133
case_test #(5) test5 (w[4:0], w[4:0], w[4:0],
134
w[4:0], w[4:0], w[4:0], w[4:0], w[4:0]);
136
case_test #(6) test6 (w[5:0], w[5:0], w[5:0],
137
w[5:0], w[5:0], w[5:0], w[5:0], w[5:0]);
139
case_test #(7) test7 (w[6:0], w[6:0], w[6:0],
140
w[6:0], w[6:0], w[6:0], w[6:0], w[6:0]);
142
case_test #(8) test8 (w[7:0], w[7:0], w[7:0],
143
w[7:0], w[7:0], w[7:0], w[7:0], w[7:0]);