Skip to content

expipiplus1/clash-wavedrom

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Clash-WaveDrom

Generate wave diagrams from Clash with WaveDrom.

Examples

It can show records with labeled waves (nested records work as you'd expect).

data Gray n = Gray
  { count  :: Unsigned n
  , gray :: BitVector n
  }
  deriving stock Generic
  deriving anyclass (NFData, ToWave)

readmeSignal :: Signal System (Gray 3)
readmeSignal =
  let count = register 0 (countSucc <$> count)
      gray  = (\x -> (x `shiftR` 1) `xor` x) . bitCoerce <$> count
  in  Gray <$> count <*> gray
renderToSVG "gray.svg" (wavedromWithReset 10 "" readmeSignal)

Gray code wave diagram


It can render the Show representation alongside the BitPack representation very easily.

eitherSignal :: Signal System (Either (Index 8) (Index 3))
eitherSignal = let x = register (Right 0) (countSucc <$> x) in x
renderToSVG
  "either.svg"
  (wavedromWithClock 10 "" (WithBits <$> eitherSignal))
    { config = object ["hscale" .= (2 :: Int)]
    }

Either counter wave diagram

Observe the undefined bits being handled correctly.


About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published