Skip to content

Commit 8ce162e

Browse files
Make ~LONGESTPERIOD return 100 ns at minimum
Sidesteps #2455
1 parent 053669c commit 8ce162e

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CHANGED: Clock generators now wait at least 100 ns before producing their first tick. This change has been implemented to account for Xilinx's GSR in clock synchronization primitives. This change does not affect Clash simulation. See [#2455](https://github.com/clash-lang/clash-compiler/issues/2455).

clash-lib/src/Clash/Netlist/BlackBox/Types.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,8 @@ data Element
179179
-- ^ Period of a domain. Errors if not applied to a @KnownDomain@ or
180180
-- @KnownConfiguration@.
181181
| LongestPeriod
182-
-- ^ Longest period of all known domains
182+
-- ^ Longest period of all known domains. The minimum duration returned is
183+
-- 100 ns, see https://github.com/clash-lang/clash-compiler/issues/2455.
183184
| ActiveEdge !Signal.ActiveEdge !Int
184185
-- ^ Test active edge of memory elements in a certain domain. Errors if not
185186
-- applied to a @KnownDomain@ or @KnownConfiguration@.

clash-lib/src/Clash/Netlist/BlackBox/Util.hs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
{-# LANGUAGE CPP #-}
1515
{-# LANGUAGE FlexibleContexts #-}
1616
{-# LANGUAGE LambdaCase #-}
17+
{-# LANGUAGE NumericUnderscores #-}
1718
{-# LANGUAGE OverloadedStrings #-}
1819
{-# LANGUAGE QuasiQuotes #-}
1920
{-# LANGUAGE RankNTypes #-}
@@ -463,7 +464,9 @@ renderElem b (Period n) = do
463464

464465
renderElem _ LongestPeriod = do
465466
doms <- domainConfigurations
466-
let longestPeriod = maximum [vPeriod v | v <- HashMap.elems doms]
467+
-- Longest period with a minimum of 100 ns, see:
468+
-- https://github.com/clash-lang/clash-compiler/issues/2455
469+
let longestPeriod = maximum (100_000 : [vPeriod v | v <- HashMap.elems doms])
467470
return (const (Text.pack (show longestPeriod)))
468471

469472
renderElem b (Tag n) = do

0 commit comments

Comments
 (0)