-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LogicValue radixString uses underscore separators by default #535
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice changes!
@@ -0,0 +1,19 @@ | |||
// Copyright (C) 2023 Intel Corporation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
year :)
@@ -724,6 +727,10 @@ abstract class LogicValue implements Comparable<LogicValue> { | |||
/// radix format. Space-separation is for ease of reading and is often | |||
/// in chunks of 4 digits. | |||
/// | |||
/// If the format of then length/radix-encoded string is not completely parsed | |||
/// an exception will be thrown. This can be caused by illegal characters | |||
/// in the string or too short or too long of a value string. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what would be an example of too short? wouldn't it 0-pad?
try { | ||
LogicValue.ofRadixString("10'b10 0010_0111"); | ||
} on Exception catch (e) { | ||
expect(e.runtimeType, LogicValueConstructionException); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think the typical pattern for this is expect(e, isA<LogicValueConstructionException>())
Description & Motivation
Added an option to LogicValue.toRadixString and .ofRadixString to use '_' as a default separator, but allow
for the user to specify a different separator.
Related Issue(s)
#534
Testing
Converted tests to use _ as separator after testing with sepChar argument.
Backwards-compatibility
Yes. Previously output radixStrings will not parse by default as they will have spaces.
Documentation
Documentation in the class code is now up to date with this change.