Skip to content

Commit

Permalink
Merge pull request #601 from bittide/uncontroversial-report-fixes
Browse files Browse the repository at this point in the history
Various uncontroversial report fixes
  • Loading branch information
hiddemoll authored Aug 14, 2024
2 parents 310587a + 5287e3c commit 4d6893a
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/simulation/report-template.tex
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
& \printclockoffsets{data['clockOffsets']} \\
startup offsets (\# clock cycles):
& \printstartupoffsets{data['startupOffsets']} \\
stable at the end of simulation:
stable at the end of run:
& \printbool{data['stable']} \\
\end{tabular}
\end{large}
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,10 @@ jobs:
run: |
cabal run bittide-experiments:unittests
- name: Run doctests
run: |
cabal run -- bittide-experiments:doctests
bittide-tests:
name: Bittide tests
runs-on: [self-hosted, compute]
Expand Down
1 change: 1 addition & 0 deletions bittide-experiments/bittide-experiments.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ library
containers,
data-default,
directory,
extra,
filepath,
happy-dot,
http-conduit,
Expand Down
26 changes: 20 additions & 6 deletions bittide-experiments/src/Bittide/Report/ClockControl.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ module Bittide.Report.ClockControl (
generateReport,
checkDependencies,
checkIntermediateResults,
formatThousands,
) where

import Data.Bool (bool)
import Data.List (intercalate)
import Data.List.Extra (chunksOf)
import System.Directory (doesDirectoryExist, doesFileExist, findExecutable)
import System.Environment (lookupEnv)
import System.FilePath (takeFileName, (</>))
Expand All @@ -30,6 +32,18 @@ import System.Process (callProcess, readProcess)
import Bittide.Plot
import Bittide.Simulate.Config

{- | Format a number with underscores every three digits.
>>> formatThousands 123456789
"123,456,789"
>>> formatThousands 100000000
"100,000,000"
>>> formatThousands 1000000
"1,000,000"
-}
formatThousands :: (Num a, Show a) => a -> String
formatThousands = reverse . intercalate "," . chunksOf 3 . reverse . show

generateReport ::
-- | Document description header
String ->
Expand Down Expand Up @@ -229,17 +243,17 @@ toLatex datetime runref header clocksPdf ebsPdf topTikz ids SimConf{..} =
, "\\begin{large}"
, " \\begin{tabular}{rl}"
, " duration \\textit{(clock cycles)}:"
, " & " <> show duration <> " \\\\"
, " & " <> formatThousands duration <> " \\\\"
, " stability detector - framesize:"
, " & " <> show stabilityFrameSize <> " \\\\"
, " & " <> formatThousands stabilityFrameSize <> " \\\\"
, " stability detector - margin:"
, " & \\textpm\\," <> show stabilityMargin <> " elements \\\\"
, " & \\textpm\\," <> formatThousands stabilityMargin <> " elements \\\\"
, " when stable, automatically stop after \\textit{(clock cycles)}:"
, " & " <> maybe "not used" show stopAfterStable <> " \\\\"
, " & " <> maybe "not used" formatThousands stopAfterStable <> " \\\\"
, " clock offsets \\textit{(fs)}:"
, " & " <> intercalate ", " (show <$> clockOffsets) <> " \\\\"
, " & " <> intercalate "; " (show <$> clockOffsets) <> " \\\\"
, " startup delays \\textit{(clock cycles)}:"
, " & " <> intercalate ", " (show <$> startupDelays) <> " \\\\"
, " & " <> intercalate "; " (formatThousands <$> startupDelays) <> " \\\\"
, " reframing:"
, " & "
<> "\\textit{"
Expand Down
1 change: 1 addition & 0 deletions bittide-experiments/src/Bittide/Topology.hs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ module Bittide.Topology (
toDot,
randomTopology,
topTypeCLIParser,
pairwise,
) where

import Prelude
Expand Down

0 comments on commit 4d6893a

Please sign in to comment.