Copyright | (C) 2022 Google Inc. |
---|---|
License | BSD2 (see the file LICENSE) |
Maintainer | QBayLogic B.V. <devops@qbaylogic.com> |
Safe Haskell | None |
Language | Haskell2010 |
Utilities and definitions to deal with Verilog's time unit. These definitions
are here mostly to deal with varying `timescale
defintions, see:
Documentation
Verilog time units
Instances
Bounded Unit Source # | |
Enum Unit Source # | |
Eq Unit Source # | |
Ord Unit Source # | |
Defined in Clash.Backend.Verilog.Time | |
Show Unit Source # | |
Generic Unit Source # | |
Hashable Unit Source # | |
NFData Unit Source # | |
Defined in Clash.Backend.Verilog.Time | |
type Rep Unit Source # | |
Defined in Clash.Backend.Verilog.Time type Rep Unit = D1 ('MetaData "Unit" "Clash.Backend.Verilog.Time" "clash-lib-1.8.1-inplace" 'False) ((C1 ('MetaCons "Fs" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Ps" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Ns" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "Us" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Ms" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "S" 'PrefixI 'False) (U1 :: Type -> Type)))) | |
type TryDomain t Unit Source # | |
Defined in Clash.Backend.Verilog.Time type TryDomain t Unit = 'NotFound |
Verilog time period. A combination of a length and a unit.
Instances
Eq Period Source # | |
Show Period Source # | |
Generic Period Source # | |
Hashable Period Source # | |
NFData Period Source # | |
Defined in Clash.Backend.Verilog.Time | |
type Rep Period Source # | |
Defined in Clash.Backend.Verilog.Time type Rep Period = D1 ('MetaData "Period" "Clash.Backend.Verilog.Time" "clash-lib-1.8.1-inplace" 'False) (C1 ('MetaCons "Period" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word64) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Unit))) |
Verilog timescale. Influences simulation precision.
Instances
Eq Scale Source # | |
Show Scale Source # | |
Generic Scale Source # | |
Hashable Scale Source # | |
NFData Scale Source # | |
Defined in Clash.Backend.Verilog.Time | |
type Rep Scale Source # | |
Defined in Clash.Backend.Verilog.Time type Rep Scale = D1 ('MetaData "Scale" "Clash.Backend.Verilog.Time" "clash-lib-1.8.1-inplace" 'False) (C1 ('MetaCons "Scale" 'PrefixI 'True) (S1 ('MetaSel ('Just "step") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Period) :*: S1 ('MetaSel ('Just "precision") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Period))) |
scaleToString :: Scale -> String Source #
Pretty print Scale
to Verilog `timescale
>>>
scaleToString (Scale (Period 100 Ps) (Period 10 Fs))
"`timescale 100ps/10fs"
periodToString :: Period -> String Source #
Convert Unit
to Verilog time unit
>>>
periodToString (Period 100 Fs)
"100fs"
parseUnit :: String -> Maybe Unit Source #
Parse string representing a Verilog time unit to Unit
.
>>>
parseUnit "ms"
Just Ms>>>
parseUnit "xs"
Nothing
parsePeriod :: String -> Maybe Period Source #
Parse a Verilog
>>>
parsePeriod "100ms"
Just (Period 100 Ms)>>>
parsePeriod "100xs"
Nothing>>>
parsePeriod "100"
Nothing>>>
parsePeriod "ms"
Nothing