Skip to content

Conversation

@desmonddak
Copy link
Contributor

Description & Motivation

Completed the use of dynamic configuration of signed operands through the multiplier componentry.

Related Issue(s)

None.

Testing

Ran existing multiplier tests.

Backwards-compatibility

Is this a breaking change that will not be backwards-compatible? If yes, how so?

Yes. Various components now have simpler APIs for sign configuration of multiplicand and multiplier (and addend for MAC).

Documentation

Does the change require any updates to documentation? If so, where? Are they included?

API documentation fully updated. Markdown documentation TBD.

@desmonddak
Copy link
Contributor Author

It would be nice to generalize this to integer or boolean configurations. A simple test example I can use is a shift register (or the rotater) which would take either a Logic or an int for a shift input.

Copy link
Contributor

@mkorbel1 mkorbel1 left a comment

Choose a reason for hiding this comment

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

This is really great!

/// The actual shift in each row. This value will be modified by the
/// sign extension routine used when folding in a sign bit from another
/// row.
/// row.
Copy link
Contributor

Choose a reason for hiding this comment

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

typo: accidentally added duplicate "row." here?

throw RohdHclException('multiplicand sign reconfiguration requires '
'signedMultiplicand=false');
}
// if (signedMultiplicand && (selectSignedMultiplicand != null)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

rm old code

throw RohdHclException('multiplicand sign reconfiguration requires '
'signedMultiplicand=false');
}
// if (signedMultiplicand && (selectSignedMultiplicand != null)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

rm old code

final Logic sign;
if (selectSignedMultiplicand != null) {
sign = mux(selectSignedMultiplicand!, addend.last, signs[row]);
if (signedMultiplicandParameter.dynamicConfig != null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I notice a lot of checking for != null, would be nice to have a bool get isDynamic helper?


/// Factory constructor to create a [StaticOrDynamicParameter] instance from a
/// dynamic.
factory StaticOrDynamicParameter.ofDynamic(dynamic config) {
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems like this the most commonly used constructor, yet the name is the longest and also a little weird (though I dont have a better suggestion, it seems appropriate) since "dynamic" is used in two meanings in the same call: a changing Logic and a dynamically typed variable.

What if we made this constructor just StaticOrDynamicParameter and the other one something like StaticOrDynamicParameter.withConfigs or something (maybe a better name)?

if (selectSignedMultiplicand != null) {
sign = mux(selectSignedMultiplicand!, addend.last, signs[row]);
if (signedMultiplicandParameter.dynamicConfig != null) {
sign = mux(signedMultiplicandParameter.dynamicConfig!, addend.last,
Copy link
Contributor

Choose a reason for hiding this comment

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

what if we added a mux or select function into this StaticOrDynamicParameter that automatically handles the switch between using a mux or a ternary operator? this would only work when it's a 1-bit value.

also, mux will be updated (eventually) so that if the select is a Const, it will resolve the result statically. but it still might be worth adding it as an option on this infrastructure

}
this.subtractIn =
(subtractIn != null) ? addInput('subtractIn', subtractIn) : null;
subtractIn = StaticOrDynamicParameter.ofDynamic(subtract).clone(this);
Copy link
Contributor

Choose a reason for hiding this comment

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

why clone?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants