@@ -1417,6 +1417,7 @@ struct RvalueExprVisitor : public ExprVisitor {
14171417
14181418 FailureOr<Value> result;
14191419 Value value;
1420+ Value value2;
14201421
14211422 // $sformatf() and $sformat look like system tasks, but we handle string
14221423 // formatting differently from expression evaluation, so handle them
@@ -1451,6 +1452,14 @@ struct RvalueExprVisitor : public ExprVisitor {
14511452 result = context.convertSystemCallArity1 (subroutine, loc, value);
14521453 break ;
14531454
1455+ case (2 ):
1456+ value = context.convertRvalueExpression (*args[0 ]);
1457+ value2 = context.convertRvalueExpression (*args[1 ]);
1458+ if (!value || !value2)
1459+ return {};
1460+ result = context.convertSystemCallArity2 (subroutine, loc, value, value2);
1461+ break ;
1462+
14541463 default :
14551464 break ;
14561465 }
@@ -2517,6 +2526,20 @@ Context::convertSystemCallArity1(const slang::ast::SystemSubroutine &subroutine,
25172526 return systemCallRes ();
25182527}
25192528
2529+ FailureOr<Value>
2530+ Context::convertSystemCallArity2 (const slang::ast::SystemSubroutine &subroutine,
2531+ Location loc, Value value1, Value value2) {
2532+ auto systemCallRes =
2533+ llvm::StringSwitch<std::function<FailureOr<Value>()>>(subroutine.name )
2534+ .Case (" getc" ,
2535+ [&]() -> Value {
2536+ return moore::StringGetCOp::create (builder, loc, value1,
2537+ value2);
2538+ })
2539+ .Default ([&]() -> Value { return {}; });
2540+ return systemCallRes ();
2541+ }
2542+
25202543// Resolve any (possibly nested) SymbolRefAttr to an op from the root.
25212544static mlir::Operation *resolve (Context &context, mlir::SymbolRefAttr sym) {
25222545 return context.symbolTable .lookupNearestSymbolFrom (context.intoModuleOp , sym);
0 commit comments