File tree Expand file tree Collapse file tree 4 files changed +60
-9
lines changed
lib/Conversion/ImportVerilog
test/Conversion/ImportVerilog Expand file tree Collapse file tree 4 files changed +60
-9
lines changed Original file line number Diff line number Diff line change @@ -426,9 +426,11 @@ Value Context::convertAssertionCallExpression(
426426 value = this ->convertRvalueExpression (*args[0 ]);
427427 originalType = value.getType ();
428428 valTy = dyn_cast<moore::IntType>(value.getType ());
429+
430+ // The semantic analysis of slang will handle this error, so extra error
431+ // emission here is not necessary, but we need to check for it to avoid
432+ // crashes in case of malformed input.
429433 if (!valTy) {
430- mlir::emitError (loc) << " expected integer argument for system call `"
431- << subroutine.name << " `" ;
432434 return {};
433435 }
434436 // If the value is four-valued, we need to map it to two-valued before we
Original file line number Diff line number Diff line change 2626#include " llvm/ADT/Hashing.h"
2727#include " llvm/Support/SourceMgr.h"
2828
29+ #include " slang/analysis/AnalysisManager.h"
2930#include " slang/diagnostics/DiagnosticClient.h"
3031#include " slang/driver/Driver.h"
3132#include " slang/parsing/Preprocessor.h"
@@ -274,6 +275,11 @@ LogicalResult ImportDriver::importVerilog(ModuleOp module) {
274275 // Elaborate the input.
275276 auto compileTimer = ts.nest (" Verilog elaboration" );
276277 auto compilation = driver.createCompilation ();
278+
279+ // Semantic analysis
280+ auto analysisTimer = ts.nest (" Semantic analysis" );
281+ driver.runAnalysis (*compilation);
282+
277283 for (auto &diag : compilation->getAllDiagnostics ())
278284 driver.diagEngine .issue (diag);
279285 if (!parseSuccess || driver.diagEngine .getNumErrors () > 0 )
Original file line number Diff line number Diff line change @@ -180,7 +180,7 @@ endfunction
180180// -----
181181module Foo ;
182182 string b;
183- // expected-error @below {{expected integer argument for system call `$past` }}
183+ // expected-error @below {{sequence has no explicit clocking event and one cannot be inferred from context }}
184184 assert property ($past (b));
185185endmodule
186186
@@ -200,3 +200,52 @@ module Foo;
200200 s[0 ] = b;
201201 end
202202endmodule
203+
204+ // -----
205+ module Foo ;
206+ int v = 1 ;
207+
208+ // expected-error @+2 {{cannot mix continuous and procedural assignments to variable 'v'}}
209+ // expected-remark @-3 {{also assigned here}}
210+ assign v = 12 ;
211+ endmodule
212+
213+ // -----
214+ module Foo ;
215+ int v;
216+
217+ // expected-error @+3 {{cannot have multiple continuous assignments to variable 'v'}}
218+ // expected-remark @below {{also assigned here}}
219+ assign v = 12 ;
220+ assign v = 13 ;
221+ endmodule
222+
223+ // -----
224+ module Foo ;
225+ wire clk = 0 ;
226+ int v;
227+
228+ // expected-error @+3 {{cannot mix continuous and procedural assignments to variable 'v'}}
229+ // expected-remark @below {{also assigned here}}
230+ assign v = 12 ;
231+ always @ (posedge clk) v <= ~ v;
232+ endmodule
233+
234+ // -----
235+ module Foo ;
236+ wire clk = 0 ;
237+ int v;
238+
239+ // expected-error @+3 {{cannot mix continuous and procedural assignments to variable 'v'}}
240+ // expected-remark @below {{also assigned here}}
241+ always @ (posedge clk) v <= ~ v;
242+ assign v = 12 ;
243+ endmodule
244+
245+ // -----
246+ module Foo ;
247+ logic a;
248+
249+ // expected-error @below {{'always' procedure does not advance time and so will create a simulation deadlock}}
250+ always a = ~ a;
251+ endmodule
Original file line number Diff line number Diff line change @@ -19,12 +19,6 @@ module Foo;
1919 // CHECK-NEXT: }
2020 final foo ();
2121
22- // CHECK: moore.procedure always {
23- // CHECK-NEXT: func.call @foo
24- // CHECK-NEXT: moore.return
25- // CHECK-NEXT: }
26- always foo ();
27-
2822 // CHECK: moore.procedure always_comb {
2923 // CHECK-NEXT: func.call @foo
3024 // CHECK-NEXT: moore.return
You can’t perform that action at this time.
0 commit comments