-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Conversation
e4268bb
to
38e3299
Compare
@Mergifyio update |
Command
|
…wo identical modules Update src/main/scala/util/SynchronizerReg.scala Update src/main/scala/util/SynchronizerReg.scala
630cf09
to
9b24d36
Compare
@@ -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") |
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.
Since you now have to set the reset type, is this deprecation message correct?
// 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") |
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.
// 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)?
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.