-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add in a software clock control DUT #654
base: staging
Are you sure you want to change the base?
Conversation
I should also probably report that somewhere in the combined total of the work from the three PRs (between this one and the two it depends on) the clock update frequency variability mentioned in issue #587 seems to have disappeared. Looking at the |
As per the discussion in the meeting earlier today, the The issue is, as far as I can tell, that the The current |
Adding to work to be done: |
89ab9a9
to
24817b5
Compare
10ad426
to
d2a0587
Compare
79591c5
to
550add3
Compare
b8eff1d
to
10b23cf
Compare
Also yes, I promise I'll clean up this commit history before asking for review. |
28c07d4
to
444d9aa
Compare
94cc1bd
to
a039e5a
Compare
3237e82
to
e57b585
Compare
e57b585
to
b559c96
Compare
b559c96
to
49972a1
Compare
49972a1
to
38be85a
Compare
f1740f4
to
ed7574e
Compare
The reframe enable config option currently doesn't seem to do anything. Currently debugging that in |
As mentioned, reframing is currently not working and I don't believe there's a quick path to getting it to work. As such, I'll make another PR at a later time to fix that, but the testing framework for enabling it will remain in place for the time being. |
3361c2f
to
c51feff
Compare
.github/workflows/ci.yml
Outdated
export RUNREF="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" | ||
cabal run -- bittide-tools:cc-plot ${{ github.run_id }}:hwCcTopologyTest hitl-topology-plots | ||
export TMP="${{ needs.bittide-instances-hardware-in-the-loop-test-matrix.outputs.report_kind }}" | ||
cabal run -- bittide-tools:cc-plot ${{ github.run_id }}:$TMP hitl-topology-plots | ||
|
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's this for? If you want to define an environment variable you should at least give it a descriptive name
.github/workflows/ci.yml
Outdated
mkdir -p plot-sources | ||
mv hitl-topology-plots plot-sources/hwCcTopologyTest | ||
export TMP="${{ needs.bittide-instances-hardware-in-the-loop-test-matrix.outputs.report_kind }}" | ||
mv hitl-topology-plots plot-sources/$TMP | ||
|
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.
Same for here
.github/workflows/ci.yml
Outdated
should_generate_report=$(jq 'map(select(.top == "hwCcTopologyTest")) | length > 0' checks.json) | ||
should_generate_report=$(jq 'map(select(.top == "hwCcTopologyTest" or .top == "swCcTopologyTest")) | length > 0' checks.json) | ||
if [ "${should_generate_report}" == 'true' ]; then | ||
tmp=$(jq 'map(select(.top == "hwCcTopologyTest")) | length > 0' checks.json) |
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.
Descriptive variable names :)
bittide/src/Bittide/CircuitUtils.hs
Outdated
@@ -0,0 +1,24 @@ | |||
-- SPDX-FileCopyrightText: 2022 Google LLC |
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.
2024 :)
@@ -0,0 +1,149 @@ | |||
-- SPDX-FileCopyrightText: 2022 Google LLC |
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.
2024 :)
data SwControlConfig dom mgn fsz where | ||
SwControlConfig :: | ||
( KnownNat mgn | ||
, KnownNat fsz | ||
, 1 <= fsz | ||
, KnownDomain dom | ||
) => | ||
Signal dom Bool -> | ||
SNat mgn -> | ||
SNat fsz -> | ||
SwControlConfig dom mgn fsz |
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.
This is not necessarily specialized for software, is it? Could you add some more haddock comments?
othersNotInCCReset = go <<$>> transceivers.rxDatas | ||
where | ||
go (Just val) = msb val == high | ||
go _ = False |
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.
othersNotInCCReset = go <<$>> transceivers.rxDatas | |
where | |
go (Just val) = msb val == high | |
go _ = False | |
othersNotInCCReset = maybe False (\val -> msb val == high) <$> transceivers.rxDatas |
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 still need to do <<$>>
(since transceivers.rxDatas
is Vec n (Signal rx (Maybe (BitVector 64)))
), but otherwise yeah I like how you wrote that.
othersNotInCCResetSync = zipWith go othersNotInCCReset transceivers.rxClocks | ||
where | ||
go sig rxClk = xpmCdcSingle rxClk sysClk sig |
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.
You can write this slightly shorter
othersNotInCCResetSync = zipWith go othersNotInCCReset transceivers.rxClocks | |
where | |
go sig rxClk = xpmCdcSingle rxClk sysClk sig | |
othersNotInCCResetSync = zipWith go transceivers.rxClocks othersNotInCCReset | |
where | |
go rxClk = xpmCdcSingle rxClk sysClk |
( ilaConfig | ||
$ "trigger_0" | ||
:> "capture_0" | ||
:> "probe_milliseconds" | ||
$ "trigger_fdi_0" | ||
:> "capture_fdi_0" | ||
:> "probe_fdi_milliseconds" |
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.
Why _fdi
?
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 actually have no idea. I swear I copied that from another test but now I can't find where.
callistoSwClockControl :: | ||
forall nLinks eBufBits dom margin framesize. | ||
( KnownDomain dom | ||
, KnownNat nLinks | ||
, KnownNat eBufBits | ||
, 1 <= nLinks | ||
, 1 <= eBufBits | ||
, nLinks + eBufBits <= 32 | ||
, 1 <= framesize | ||
, 1 <= DomainPeriod dom | ||
) => | ||
Clock dom -> | ||
Reset dom -> | ||
Enable dom -> | ||
SwControlConfig dom margin framesize -> | ||
Signal dom (BitVector nLinks) -> | ||
Vec nLinks (Signal dom (RelDataCount eBufBits)) -> | ||
Signal dom (CallistoResult nLinks) |
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.
Exported function missing documentation
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.
LGTM in general. I'm really looking forward to ditching all the different instances.
|
||
calibratedClockShift = capturedOnce | ||
where | ||
-- Possibly overkill. |
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.
Could you explain this comment? (In the comment)
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.
So actually I think it's worth bringing this up here since I wanted to ask if there was a good way to latch a value exactly once on a given signal. I think what I wrote there might be a bit over-engineered, and I'm also not sure if there's just a utility function somewhere that I overlooked.
bittide/src/Bittide/CircuitUtils.hs
Outdated
Circuit (CSignal dom a) (Vec n (CSignal dom a)) | ||
csDupe = Circuit $ \(m, _) -> (pure (), repeat m) | ||
|
||
cSigMap :: |
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.
cSigMap :: | |
cSignalMap :: |
Abbreviations take brain cycles to decode :-)
import Clash.Explicit.Prelude hiding (PeriodToCycles) | ||
|
||
-- import qualified Clash.Explicit.Prelude as E | ||
import Clash.Prelude (withClockResetEnable) | ||
|
||
import Language.Haskell.TH (runIO) | ||
import System.FilePath | ||
|
||
import Bittide.CircuitUtils | ||
import Bittide.ClockControl (RelDataCount) | ||
import Bittide.ClockControl.Callisto.Types (CallistoResult (..), ReframingState (Done)) | ||
import Bittide.ClockControl.DebugRegister ( | ||
DebugRegisterCfg (DebugRegisterCfg), | ||
debugRegisterWb, | ||
) | ||
import Bittide.ClockControl.Registers (ClockControlData (..), clockControlWb) | ||
import Bittide.DoubleBufferedRam (ContentType (Blob), InitialContent (Reloadable)) | ||
import Bittide.ProcessingElement (PeConfig (..), processingElement) | ||
import Bittide.ProcessingElement.Util (memBlobsFromElf) | ||
import Bittide.SharedTypes (ByteOrder (BigEndian)) | ||
|
||
import Project.FilePath | ||
|
||
import Protocols | ||
import Protocols.Idle | ||
|
||
import Clash.Cores.Xilinx.Ila (Depth (..), IlaConfig (..), ila, ilaConfig) | ||
import Data.Maybe (fromMaybe, isJust) | ||
import VexRiscv |
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.
"Qualified deps" => we can do this with the latest fourmolu fourmolu/fourmolu#403. But, these changes haven't made it into a release yet. Something to keep in mind.
Edit: I was replying to Lucas here, but it seemed to be grouped in with my review..
, reframingEnabled :: Bool | ||
-- ^ Whether or not to run this test with reframing enabled. |
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.
Create an issue we need to figure out how to properly test reframing and link it here.
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.
Made #693, will link in the comment.
where | ||
go ugn = ugnStable | ||
where | ||
ugn' = bitCoerce <$> ugn |
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.
ugn' = bitCoerce <$> ugn | |
ugn1 = bitCoerce <$> ugn |
Use number postfixes please. Ticks don't really scale and are easy to miss.
|
||
type WaitCycles dom hold prd = PeriodToCycles dom (prd - hold) | ||
|
||
data ToFincFdecState' dom hold min |
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.
It isn't clear what the '
is supposed to communicate.
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.
It's there because I forgot you can import Foo hiding (bar)
. Will fix.
| Idle | ||
deriving (Generic, NFDataX, Eq) | ||
|
||
speedChangeToFincFdec' :: |
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.
Same here. Typically '
is used for "strict" versions of a function, but that's not the case here.
syncNodePrevEnteredReset = | ||
sticky sysClk testReset syncNodeEnteredReset | ||
|
||
syncIn' = mux syncNodePrevEnteredReset syncIn (pure True :: Signal Basic125 Bool) |
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.
syncIn' = mux syncNodePrevEnteredReset syncIn (pure True :: Signal Basic125 Bool) | |
syncIn1 = mux syncNodePrevEnteredReset syncIn (pure True :: Signal Basic125 Bool) |
c51feff
to
a9ba56c
Compare
8747cd4
to
74540bb
Compare
Trying to change sync node reset detection to work better for FPGA 7. Fixes from rebasing on `rs/ilaPlot`. Forgot to sticky the CC output (again). Sending data over links to see what comes out on the other side. Adjusting ready detection/reporting. Using the MSB of link data to indicate not in CC reset. Fixes(?) to reset paths, ready reporting, and CC reset detection. Attempting to cut off testing sooner. Cutting off earlier was not the answer. Capturing calib vals differently now. UGN TESTING IS SO BACK
74540bb
to
169c564
Compare
This PR adds in a new SwCc DUT based on the work done in my two other PRs. As of the current PR it mostly passes CI except for linting, but that's okay since there's still work to be done.
As for what work is still yet to be done:
rs/measure-sw-cc
branch. The only other DUT this appears in isFullMeshSwCc
.syncIn
toIlaPlotSetup
(see line 908 and lines 937-947 as of time of writing) in order to avoid twosyncRst
asserts, which then causescaptureCond
to becomeCalibrate :: CaptureCondition
for a second time, which is problematic.