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

Clash 1.9 update #444

Merged
merged 3 commits into from
Jan 5, 2024
Merged

Clash 1.9 update #444

merged 3 commits into from
Jan 5, 2024

Conversation

kleinreact
Copy link
Contributor

This PR bumps Clash to the latest required 1.9 version (fixing the xpmCdcHandshake primitive) and applies the corresponding interface changes. In particular, this includes

  • the correct usage of clockWizardDifferential getting rid of the improvised reset syncers,
  • renaming of clock domains from BasicX to ExtX for all clocks that originate from a differential input, and
  • changing the reset kind of all ExtX domains to Asynchronous resets.

Note that clockControlDemo0 currently does not compile due to a Clash bug introduced since the previously used version, which is under investigation right now.

Copy link
Contributor

@DigitalBrains1 DigitalBrains1 left a comment

Choose a reason for hiding this comment

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

I think the difference between an improvised reset synchroniser with xpmCdcSingle and the bog-standard resetSynchronizer that is part of the safe PLL functions is that the former includes a max_delay constraint and an ASYNC_REG attribute whereas the latter includes none of those things. So I think the improvisation is qualitatively better...

@@ -14,14 +14,17 @@ import Bittide.Arithmetic.Ppm
import Data.Proxy

createDomain vXilinxSystem{vName="Basic125", vPeriod= hzToPeriod 125e6}
createDomain vXilinxSystem{vName="Ext125", vPeriod= hzToPeriod 125e6, vResetKind=Asynchronous}
Copy link
Contributor

Choose a reason for hiding this comment

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

This is more a matter of preference, but

createDomain vXilinxSystem{vName="Ext125", vPeriod= hzToPeriod 125e6, vResetKind=Asynchronous}

is fully identical to

createDomain vSystem{vName="Ext125", vPeriod= hzToPeriod 125e6}

(or vIntelSystem instead of vSystem for maximum confusion ;-P)

Copy link
Contributor

Choose a reason for hiding this comment

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

So why the different records?

Comment on lines -133 to 135
"SYSCLK_300" ::: DiffClock Basic300 ->
"SYSCLK_300" ::: DiffClock Ext300 ->
"SYNC_IN" ::: Signal Basic300 Bool ->
"SYNC_OUT" ::: Signal Basic300 Bool
Copy link
Contributor

Choose a reason for hiding this comment

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

Oof, good catch. This used to declare that the input and output clocks of the clock wizard were 100% identical, which means you could have just piped a signal synchronous to the input clock to the domain of the output clock or vice versa. But they are obviously not identical, so this might introduce metastability.

Copy link
Contributor

@DigitalBrains1 DigitalBrains1 Dec 7, 2023

Choose a reason for hiding this comment

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

(I have to admit the odds of you doing this accidentally are pretty low. But usually the type system prevents it and I really think you should not lie about equality of clocks even if the odds of it going wrong are low.)

@kleinreact kleinreact mentioned this pull request Dec 12, 2023
1 task
@leonschoorl
Copy link
Contributor

clash-lang/clash-compiler#2624 should allow clockControlDemo0 to build again

Copy link
Contributor

@martijnbastiaan martijnbastiaan left a comment

Choose a reason for hiding this comment

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

@kleinreact Could you check whether @leonschoorl's patch works?

@kleinreact
Copy link
Contributor Author

@kleinreact Could you check whether @leonschoorl's patch works?

Negative 😞. @leonschoorl: Is that new error related to your fixes?

@martijnbastiaan
Copy link
Contributor

The output is confusing: it prints a warning (which we should be able to ignore if it doesn't come back later as an error). The real error is:

    Clash.Cores.Xilinx.DcFifo.Internal.BlackBoxes.dcFifoTF: dcFifo only supports synchronous resets

Do we connect dc fifo to an async reset? Because that would be an issue yeah...

@kleinreact
Copy link
Contributor Author

Do we connect dc fifo to an async reset?

The only related change is the update of the external clock domains to use asynchronous resets, which is required for the safe variants of clock wizards and looks to me like the right way of doing it? So yes, if that's correct then we are connecting the dc fifo to an asynchronous reset somewhere in that instance.

@martijnbastiaan
Copy link
Contributor

Hmmyeah, I was typing a response in another PR:

Screenshot from 2024-01-02 14-29-26

So in short, we don't have a good way of signalling "this is a signal that's unrelated to any (visible) domain".

@kleinreact
Copy link
Contributor Author

But it still means we are using a "free reset" with dcFifo, which is unintended behavior, right? So the error indication points to a true error then?

@martijnbastiaan
Copy link
Contributor

But it still means we are using a "free reset" with dcFifo, which is unintended behavior, right? So the error indication points to a true error then?

Yes, it is unintended behavior. The reset should be synchronized. The error just crops up for the "wrong" reasons.

@martijnbastiaan martijnbastiaan merged commit 530a3a7 into staging Jan 5, 2024
36 checks passed
@martijnbastiaan martijnbastiaan deleted the clash-update branch January 5, 2024 13:21
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.

5 participants