-
Notifications
You must be signed in to change notification settings - Fork 2
Workspace-level Clippy lints #1153
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
Open
rslawson
wants to merge
2
commits into
main
Choose a base branch
from
rs/clippy-lints
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
94 changes: 94 additions & 0 deletions
94
bittide-instances/src/Bittide/Instances/Tests/ClockControlWb.hs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,94 @@ | ||
| -- SPDX-FileCopyrightText: 2026 Google LLC | ||
| -- | ||
| -- SPDX-License-Identifier: Apache-2.0 | ||
| module Bittide.Instances.Tests.ClockControlWb where | ||
|
|
||
| import Clash.Prelude | ||
|
|
||
| import Bittide.ClockControl.Registers (ClockControlData, clockControlWb) | ||
| import Bittide.Cpus.Riscv32imc (vexRiscv0) | ||
| import Bittide.DoubleBufferedRam | ||
| import Bittide.Instances.Hitl.Setup hiding (linkMask) | ||
| import Bittide.ProcessingElement | ||
| import Bittide.ProcessingElement.Util | ||
| import Bittide.SharedTypes (withBittideByteOrder) | ||
| import Bittide.Wishbone hiding (MemoryMap) | ||
| import Clash.Class.BitPackC (ByteOrder (BigEndian)) | ||
| import GHC.Stack (HasCallStack) | ||
| import Project.FilePath | ||
| import Protocols | ||
| import Protocols.Idle | ||
| import Protocols.MemoryMap | ||
| import System.FilePath | ||
| import System.IO.Unsafe (unsafePerformIO) | ||
| import VexRiscv (DumpVcd (NoDumpVcd)) | ||
|
|
||
| linkMask :: BitVector LinkCount | ||
| linkMask = 0b1011011 | ||
|
|
||
| linksOk :: BitVector LinkCount | ||
| linksOk = 0b1111000 | ||
|
|
||
| dataCounts :: Vec LinkCount (Signed 32) | ||
| dataCounts = iterateI (satSucc SatWrap) 0 | ||
|
|
||
| type IMemWords = DivRU (64 * 1024) 4 | ||
| type DMemWords = DivRU (32 * 1024) 4 | ||
|
|
||
| dut :: | ||
| (HasCallStack) => | ||
| Circuit (ToConstBwd Mm) (Df System (BitVector 8), CSignal System (ClockControlData LinkCount)) | ||
| dut = | ||
| withBittideByteOrder | ||
| $ withClockResetEnable clockGen (resetGenN d2) enableGen | ||
| $ circuit | ||
| $ \mm -> do | ||
| (uartRx, jtag) <- idleSource | ||
| [uartBus, (mmCC, ccWb)] <- processingElement NoDumpVcd peConfig -< (mm, jtag) | ||
| (uartTx, _uartStatus) <- uartInterfaceWb d2 d2 uartBytes -< (uartBus, uartRx) | ||
|
|
||
| ccd <- | ||
| clockControlWb | ||
| (pure linkMask) | ||
| (pure linksOk) | ||
| (pure <$> dataCounts) | ||
| -< (mmCC, ccWb) | ||
|
|
||
| idC -< (uartTx, ccd) | ||
| where | ||
| peConfig = unsafePerformIO $ do | ||
| root <- findParentContaining "cabal.project" | ||
| let | ||
| elfDir = root </> firmwareBinariesDir "riscv32imc" Release | ||
| elfPath = elfDir </> "clock-control-wb" | ||
| pure | ||
| PeConfig | ||
| { cpu = vexRiscv0 | ||
| , initI = | ||
| Reloadable @IMemWords | ||
| $ Vec | ||
| $ unsafePerformIO | ||
| $ vecFromElfInstr BigEndian elfPath | ||
| , initD = | ||
| Reloadable @DMemWords | ||
| $ Vec | ||
| $ unsafePerformIO | ||
| $ vecFromElfData BigEndian elfPath | ||
| , iBusTimeout = d0 | ||
| , dBusTimeout = d0 | ||
| , includeIlaWb = False | ||
| } | ||
| {-# OPAQUE dut #-} | ||
|
|
||
| dutMm :: (HasCallStack) => MemoryMap | ||
| dutMm = mm | ||
| where | ||
| Circuit circuitFn = dut | ||
| (SimOnly mm, _) = circuitFn ((), (pure $ deepErrorX "uart_bwd", ())) | ||
|
|
||
| dutNoMm :: | ||
| (HasCallStack) => Circuit () (Df System (BitVector 8), CSignal System (ClockControlData LinkCount)) | ||
| dutNoMm = Circuit circuitFnNoMm | ||
| where | ||
| Circuit circuitFn = dut | ||
| circuitFnNoMm (fwdL, bwdR) = let (_, fwdR) = circuitFn (fwdL, bwdR) in ((), fwdR) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -187,5 +187,7 @@ fn main() -> ! { | |
|
|
||
| #[panic_handler] | ||
| fn panic_handler(_: &PanicInfo) -> ! { | ||
| loop {} | ||
| loop { | ||
| continue; | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
If you made this
then below you could use
getMMAnyto get the memory map andunMemmapto get a circuit without the memory map, meaning less juggling of functions and Circuit wrappers