@@ -66,13 +66,13 @@ class InvalidateAPISpec extends ChiselPropSpec with Matchers {
66
66
val nElements = 5
67
67
class ModuleWithoutDontCare extends Module {
68
68
val io = IO (new Bundle {
69
- val ins = Input (Vec (nElements, Bool ()))
69
+ val outs = Output (Vec (nElements, Bool ()))
70
70
})
71
- io.ins <> DontCare
71
+ io.outs <> DontCare
72
72
}
73
73
val firrtlOutput = myGenerateFirrtl(new ModuleWithoutDontCare )
74
74
for (i <- 0 until nElements)
75
- firrtlOutput should include(s " io.ins [ $i] is invalid " )
75
+ firrtlOutput should include(s " io.outs [ $i] is invalid " )
76
76
}
77
77
78
78
property(" a Vec with a DontCare should emit a Firrtl \" is invalid\" with Strict CompileOptions and mono connect" ) {
@@ -161,4 +161,48 @@ class InvalidateAPISpec extends ChiselPropSpec with Matchers {
161
161
162
162
compileFirrtl(new ModuleWithConditionalAndOtherwiseAssignment )
163
163
}
164
+
165
+ property(" an output without a DontCare should NOT emit a Firrtl \" is invalid\" with overriden NotStrict CompileOptions" ) {
166
+ import chisel3 .core .ExplicitCompileOptions .NotStrict
167
+ class ModuleWithoutDontCare extends Module {
168
+ override val compileOptions = chisel3.core.ExplicitCompileOptions .NotStrict .copy(explicitInvalidate = true )
169
+ val io = IO (new TrivialInterface )
170
+ io.out := io.in
171
+ }
172
+ val firrtlOutput = myGenerateFirrtl(new ModuleWithoutDontCare )
173
+ firrtlOutput should not include(" is invalid" )
174
+ }
175
+
176
+ property(" an output without a DontCare should NOT emit a Firrtl \" is invalid\" with overriden NotStrict CompileOptions module definition" ) {
177
+ import chisel3 .core .ExplicitCompileOptions .NotStrict
178
+ abstract class ExplicitInvalidateModule extends Module ()(chisel3.core.ExplicitCompileOptions .NotStrict .copy(explicitInvalidate = true ))
179
+ class ModuleWithoutDontCare extends ExplicitInvalidateModule {
180
+ val io = IO (new TrivialInterface )
181
+ io.out := io.in
182
+ }
183
+ val firrtlOutput = myGenerateFirrtl(new ModuleWithoutDontCare )
184
+ firrtlOutput should not include(" is invalid" )
185
+ }
186
+
187
+ property(" an output without a DontCare should emit a Firrtl \" is invalid\" with overriden Strict CompileOptions" ) {
188
+ import chisel3 .core .ExplicitCompileOptions .Strict
189
+ class ModuleWithoutDontCare extends Module {
190
+ override val compileOptions = chisel3.core.ExplicitCompileOptions .Strict .copy(explicitInvalidate = false )
191
+ val io = IO (new TrivialInterface )
192
+ io.out := io.in
193
+ }
194
+ val firrtlOutput = myGenerateFirrtl(new ModuleWithoutDontCare )
195
+ firrtlOutput should include(" is invalid" )
196
+ }
197
+
198
+ property(" an output without a DontCare should emit a Firrtl \" is invalid\" with overriden Strict CompileOptions module definition" ) {
199
+ import chisel3 .core .ExplicitCompileOptions .Strict
200
+ abstract class ImplicitInvalidateModule extends Module ()(chisel3.core.ExplicitCompileOptions .NotStrict .copy(explicitInvalidate = false ))
201
+ class ModuleWithoutDontCare extends ImplicitInvalidateModule {
202
+ val io = IO (new TrivialInterface )
203
+ io.out := io.in
204
+ }
205
+ val firrtlOutput = myGenerateFirrtl(new ModuleWithoutDontCare )
206
+ firrtlOutput should include(" is invalid" )
207
+ }
164
208
}
0 commit comments