Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

Scheremo
Copy link
Contributor

This PR implements support for $fatal system tasks in system verilog as discussed in issue #8934.
Thanks for generous support by @JosseVanDelm @towoe @cowardsa

Copy link
Contributor

@cowardsa cowardsa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great start with first PR - wohoo!

If it's not too much effort would be great to support the different variants of severity warning/error so we don't need to revisit this next time round - but they seem to be able to share similar lowering with minor changes for each/

ConversionPatternRewriter &rewriter) {

if (op.getSeverity() == Severity::Fatal) {
auto prefix = rewriter.create<sim::FormatLitOp>(op.getLoc(), "Error: ");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: would make sense to have "Fatal: " as there is an Error level

Copy link
Contributor Author

@Scheremo Scheremo Sep 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Samuel, adapted the prefix to Fatal: for fatal severity.

rewriter.replaceOpWithNewOp<sim::PrintFormattedProcOp>(op, message);
return success();
}
return failure();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to add support to handle error and warning in the same way - just with modified prefixes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a switch-case statement to match for Warning and Error. Extended the test as well.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

// CHECK-LABEL: @SeverityToPrint
func.func @SeverityToPrint() {
// CHECK: [[MSG:%.*]] = sim.fmt.lit "Error condition met!\n"
// CHECK-NEXT: [[PFX:%.*]] = sim.fmt.lit "Error: "
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: will need to extend tests for other cases if added?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test has been extended.

Copy link
Contributor

@cowardsa cowardsa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - thanks for the corrections - will merge pending any additional comments from @fabianschuiki?

Copy link
Contributor

@fabianschuiki fabianschuiki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very neat! Thanks for implementing this @Scheremo 🥳. Want us to merge this for you?

@Scheremo
Copy link
Contributor Author

Very neat! Thanks for implementing this @Scheremo 🥳. Want us to merge this for you?

Yes please! Thanks again for all your help @fabianschuiki @cowardsa, and my pair programming partner @JosseVanDelm

@fabianschuiki fabianschuiki merged commit 1f83016 into llvm:main Sep 10, 2025
7 checks passed
@Scheremo Scheremo deleted the pr/sv branch October 21, 2025 07:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants