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

« back to all changes in this revision

Viewing changes to books/centaur/vl/systest/param2/spec.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
// more tests of parameter handling
 
32
 
 
33
module MA (out, in);
 
34
  parameter integer size = 4;
 
35
  output [size-1:0] out;
 
36
  input [size-1:0]  in;
 
37
  assign out = ~in;
 
38
endmodule
 
39
 
 
40
module MB (out, in);     // Increment unsigned by integer parameter
 
41
  parameter integer inc = 1;
 
42
  output [3:0] out;
 
43
  input  [3:0] in;
 
44
  assign out = in + inc;
 
45
endmodule
 
46
 
 
47
module MC (out, in);     // Increment signed by integer parameter
 
48
  parameter integer inc = 1;
 
49
  output [3:0] out;
 
50
  input  [3:0] in;
 
51
  wire signed [3:0] sin = in;
 
52
  assign out = sin + inc;
 
53
endmodule
 
54
 
 
55
`ifdef SYSTEM_VERILOG_MODE
 
56
 
 
57
module MD (out, in);     // Increment unsigned by unsigned integer parameter
 
58
  parameter integer unsigned inc = 1;
 
59
  output [3:0] out;
 
60
  input  [3:0] in;
 
61
  assign out = in + inc;
 
62
endmodule
 
63
 
 
64
module ME (out, in);     // Increment signed by unsigned integer parameter
 
65
  parameter integer unsigned inc = 1;
 
66
  output [3:0] out;
 
67
  input  [3:0] in;
 
68
  wire signed [3:0] sin = in;
 
69
  assign out = sin + inc;
 
70
endmodule
 
71
 
 
72
`else
 
73
 
 
74
module MD (out, in);
 
75
  parameter signed inc = 1;
 
76
  output [3:0] out;
 
77
  input  [3:0] in;
 
78
  assign out = in + inc;
 
79
endmodule
 
80
 
 
81
module ME (out, in);
 
82
  parameter signed inc = 1;
 
83
  output [3:0] out;
 
84
  input  [3:0] in;
 
85
  wire signed [3:0] sin = in;
 
86
  assign out = sin + inc;
 
87
endmodule
 
88
 
 
89
`endif
 
90
 
 
91
 
 
92
// These are the same as the corresponding modules from param/, except
 
93
// that I've made the parameter size smaller.
 
94
 
 
95
module MF (out, in);
 
96
  parameter [2:0] inc = 1;
 
97
  output [3:0] out;
 
98
  input  [3:0] in;
 
99
  assign out = in + inc;
 
100
endmodule
 
101
 
 
102
module MG (out, in);
 
103
  parameter [2:0] inc = 1;
 
104
  output [3:0] out;
 
105
  input  [3:0] in;
 
106
  wire signed [3:0] sin = in;
 
107
  assign out = sin + inc;
 
108
endmodule
 
109
 
 
110
module MH (out, in);
 
111
  parameter signed [2:0] inc = 1;
 
112
  output [3:0] out;
 
113
  input  [3:0] in;
 
114
  assign out = in + inc;
 
115
endmodule
 
116
 
 
117
module MI (out, in);
 
118
  parameter signed [2:0] inc = 1;
 
119
  output [3:0] out;
 
120
  input  [3:0] in;
 
121
  wire signed [3:0] sin = in;
 
122
  assign out = sin + inc;
 
123
endmodule
 
124
 
 
125
 
 
126
 
 
127
module dut (
 
128
 
 
129
in1, in2,
 
130
 
 
131
aout1, aout2, aout3,
 
132
bout1, bout2, bout3, bout4, bout5, bout6, bout7,
 
133
cout1, cout2, cout3, cout4, cout5, cout6, cout7,
 
134
dout1, dout2, dout3, dout4, dout5, dout6, dout7,
 
135
eout1, eout2, eout3, eout4, eout5, eout6, eout7,
 
136
fout1, fout2, fout3, fout4, fout5, fout6, fout7,
 
137
gout1, gout2, gout3, gout4, gout5, gout6, gout7,
 
138
hout1, hout2, hout3, hout4, hout5, hout6, hout7,
 
139
iout1, iout2, iout3, iout4, iout5, iout6, iout7
 
140
 
 
141
 
 
142
);
 
143
 
 
144
  parameter size = 1;
 
145
  wire [size-1:0] make_size_matter;
 
146
 
 
147
  input [3:0]      in1, in2;
 
148
 
 
149
 
 
150
  output [3:0]     aout1, aout2, aout3;
 
151
  MA ainst1 (aout1, in1);
 
152
  assign aout2[3] = in2[3];
 
153
  MA #(.size(3)) ainst2 (aout2[2:0], in1[2:0]);
 
154
  assign aout3[3:2] = in2[3:2];
 
155
  MA #(2) ainst3 (aout3[1:0], in1[1:0]);
 
156
 
 
157
  output [3:0]     bout1, bout2, bout3, bout4, bout5, bout6, bout7;
 
158
  MB binst1 (bout1, in1);
 
159
  MB #(.inc(2)) binst2 (bout2, in1);
 
160
  MB #(.inc(-1)) binst3 (bout3, in1);
 
161
  MB #(.inc(4'd3)) binst4 (bout4, in1);
 
162
  MB #(.inc(-4'd1)) binst5 (bout5, in1);
 
163
  MB #(.inc(4'sd3)) binst6 (bout6, in1);
 
164
  MB #(.inc(-4'sd1)) binst7 (bout7, in1);
 
165
 
 
166
  output [3:0]     cout1, cout2, cout3, cout4, cout5, cout6, cout7;
 
167
  MC cinst1 (cout1, in1);
 
168
  MC #(.inc(2)) cinst2 (cout2, in1);
 
169
  MC #(.inc(-1)) cinst3 (cout3, in1);
 
170
  MC #(.inc(4'd3)) cinst4 (cout4, in1);
 
171
  MC #(.inc(-4'd1)) cinst5 (cout5, in1);
 
172
  MC #(.inc(4'sd3)) cinst6 (cout6, in1);
 
173
  MC #(.inc(-4'sd1)) cinst7 (cout7, in1);
 
174
 
 
175
  output [3:0]     dout1, dout2, dout3, dout4, dout5, dout6, dout7;
 
176
  MD dinst1 (dout1, in1);
 
177
  MD #(.inc(2)) dinst2 (dout2, in1);
 
178
  MD #(.inc(-1)) dinst3 (dout3, in1);
 
179
  MD #(.inc(4'd3)) dinst4 (dout4, in1);
 
180
  MD #(.inc(-4'd1)) dinst5 (dout5, in1);
 
181
  MD #(.inc(4'sd3)) dinst6 (dout6, in1);
 
182
  MD #(.inc(-4'sd1)) dinst7 (dout7, in1);
 
183
 
 
184
  output [3:0]     eout1, eout2, eout3, eout4, eout5, eout6, eout7;
 
185
  ME einst1 (eout1, in1);
 
186
  ME #(.inc(2)) einst2 (eout2, in1);
 
187
  ME #(.inc(-1)) einst3 (eout3, in1);
 
188
  ME #(.inc(4'd3)) einst4 (eout4, in1);
 
189
  ME #(.inc(-4'd1)) einst5 (eout5, in1);
 
190
  ME #(.inc(4'sd3)) einst6 (eout6, in1);
 
191
  ME #(.inc(-4'sd1)) einst7 (eout7, in1);
 
192
 
 
193
  output [3:0]     fout1, fout2, fout3, fout4, fout5, fout6, fout7;
 
194
  MF finst1 (fout1, in1);
 
195
  MF #(.inc(2)) finst2 (fout2, in1);
 
196
  MF #(.inc(-1)) finst3 (fout3, in1);
 
197
  MF #(.inc(4'd3)) finst4 (fout4, in1);
 
198
  MF #(.inc(-4'd1)) finst5 (fout5, in1);
 
199
  MF #(.inc(4'sd3)) finst6 (fout6, in1);
 
200
  MF #(.inc(-4'sd1)) finst7 (fout7, in1);
 
201
 
 
202
  output [3:0]     gout1, gout2, gout3, gout4, gout5, gout6, gout7;
 
203
  MG ginst1 (gout1, in1);
 
204
  MG #(.inc(2)) ginst2 (gout2, in1);
 
205
  MG #(.inc(-1)) ginst3 (gout3, in1);
 
206
  MG #(.inc(4'd3)) ginst4 (gout4, in1);
 
207
  MG #(.inc(-4'd1)) ginst5 (gout5, in1);
 
208
  MG #(.inc(4'sd3)) ginst6 (gout6, in1);
 
209
  MG #(.inc(-4'sd1)) ginst7 (gout7, in1);
 
210
 
 
211
  output [3:0]     hout1, hout2, hout3, hout4, hout5, hout6, hout7;
 
212
  MH hinst1 (hout1, in1);
 
213
  MH #(.inc(2)) hinst2 (hout2, in1);
 
214
  MH #(.inc(-1)) hinst3 (hout3, in1);
 
215
  MH #(.inc(4'd3)) hinst4 (hout4, in1);
 
216
  MH #(.inc(-4'd1)) hinst5 (hout5, in1);
 
217
  MH #(.inc(4'sd3)) hinst6 (hout6, in1);
 
218
  MH #(.inc(-4'sd1)) hinst7 (hout7, in1);
 
219
 
 
220
  output [3:0]     iout1, iout2, iout3, iout4, iout5, iout6, iout7;
 
221
  MI iinst1 (iout1, in1);
 
222
  MI #(.inc(2)) iinst2 (iout2, in1);
 
223
  MI #(.inc(-1)) iinst3 (iout3, in1);
 
224
  MI #(.inc(4'd3)) iinst4 (iout4, in1);
 
225
  MI #(.inc(-4'd1)) iinst5 (iout5, in1);
 
226
  MI #(.inc(4'sd3)) iinst6 (iout6, in1);
 
227
  MI #(.inc(-4'sd1)) iinst7 (iout7, in1);
 
228
 
 
229
endmodule
 
230
 
 
231
 
 
232
/*+VL
 
233
 
 
234
module make_tests () ;
 
235
 
 
236
wire [3:0] in1, in2,
 
237
 aout1, aout2, aout3,
 
238
 bout1, bout2, bout3, bout4, bout5, bout6, bout7,
 
239
 cout1, cout2, cout3, cout4, cout5, cout6, cout7,
 
240
 dout1, dout2, dout3, dout4, dout5, dout6, dout7,
 
241
 eout1, eout2, eout3, eout4, eout5, eout6, eout7,
 
242
 fout1, fout2, fout3, fout4, fout5, fout6, fout7,
 
243
 gout1, gout2, gout3, gout4, gout5, gout6, gout7,
 
244
 hout1, hout2, hout3, hout4, hout5, hout6, hout7,
 
245
 iout1, iout2, iout3, iout4, iout5, iout6, iout7;
 
246
 
 
247
 dut #(1) dir_test_1 ( in1, in2,
 
248
 aout1, aout2, aout3,
 
249
 bout1, bout2, bout3, bout4, bout5, bout6, bout7,
 
250
 cout1, cout2, cout3, cout4, cout5, cout6, cout7,
 
251
 dout1, dout2, dout3, dout4, dout5, dout6, dout7,
 
252
 eout1, eout2, eout3, eout4, eout5, eout6, eout7,
 
253
 fout1, fout2, fout3, fout4, fout5, fout6, fout7,
 
254
 gout1, gout2, gout3, gout4, gout5, gout6, gout7,
 
255
 hout1, hout2, hout3, hout4, hout5, hout6, hout7,
 
256
 iout1, iout2, iout3, iout4, iout5, iout6, iout7
 
257
 );
 
258
 
 
259
endmodule
 
260
 
 
261
*/