Skip to content
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

SynchronizerPrimitiveShiftReg: fix Dedup Issue #2547

Merged
merged 2 commits into from
Nov 6, 2020
Merged

Conversation

mwachs5
Copy link
Contributor

@mwachs5 mwachs5 commented Jul 2, 2020

It was intended that the SynchronizerPrimitiveShiftReg be identical, as they have suggestName applied that was intended to capture all variance in terms of functionality.

However, because they had inferred reset type (the reset is cast appropriately inside the Primitive module), the FIRRTL would not be identical at the point of Dedup and you could end up with 2 versions. The final verilog (since verilog dosen't distinguish between reset types) would be identical.

Since the Primitives are intended to be easy to replace with library-specific macro sells for synchronization, this is undesirable.

This change pushes the reset type up into the SynchronizerShiftReg (which still may end up with multiple copies) to make sure you only get one SynchronizerPrimitiveShiftReg of each type.

Related issue: None

Type of change: bug report

Impact: API modification

Development Phase: implementation

Release Notes

Correct the dedup behavior for the *ResetSynchronizerPrimitiveShiftReg so that you only end up with one copy.

@mwachs5
Copy link
Contributor Author

mwachs5 commented Oct 13, 2020

@Mergifyio update

@mergify
Copy link
Contributor

mergify bot commented Oct 13, 2020

Command update: success

Branch has been successfully updated

…wo identical modules

Update src/main/scala/util/SynchronizerReg.scala

Update src/main/scala/util/SynchronizerReg.scala
@@ -100,13 +107,17 @@ object AsyncResetSynchronizerShiftReg {
apply (in, sync, init.litValue.toInt, None)
}

// Note: This module may end up with a non-Bool type reset.
// But the Primitives within will always have Bool reset type.
@deprecated("SyncResetSynchronizerShiftReg is unecessary with Chisel3 inferred resets. Use ResetSynchronizerShiftReg which will use the inferred reset type.", "rocket-chip 1.2")
Copy link
Contributor

@jackkoenig jackkoenig Nov 5, 2020

Choose a reason for hiding this comment

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

Since you now have to set the reset type, is this deprecation message correct?

Comment on lines +110 to 112
// Note: This module may end up with a non-Bool type reset.
// But the Primitives within will always have Bool reset type.
@deprecated("SyncResetSynchronizerShiftReg is unecessary with Chisel3 inferred resets. Use ResetSynchronizerShiftReg which will use the inferred reset type.", "rocket-chip 1.2")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suggested change
// Note: This module may end up with a non-Bool type reset.
// But the Primitives within will always have Bool reset type.
@deprecated("SyncResetSynchronizerShiftReg is unecessary with Chisel3 inferred resets. Use ResetSynchronizerShiftReg which will use the inferred reset type.", "rocket-chip 1.2")
// Note: This module may end up with a non-Bool type reset.
// But the Primitives within will always have Bool reset type.
@deprecated("SyncResetSynchronizerShiftReg usage is discouraged. Use ResetSynchronizerShiftReg which will use the inferred reset type. Cast the reset to Bool if you truly want to enforce SyncResetSynchronizerShiftReg functionality.", "rocket-chip 1.2")

Hmm, good point. What do you think of this instead (at least I should learn how to spell unnecessary)?

@mwachs5 mwachs5 merged commit 58a8d8f into master Nov 6, 2020
@mwachs5 mwachs5 deleted the synchonizer-reg-dedup branch December 17, 2022 09:59
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.

3 participants