Skip to content
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

"Can't translate domain tagType.Errors.IfStuck..." #1007

Closed
leonschoorl opened this issue Jan 14, 2020 · 0 comments · Fixed by #1009
Closed

"Can't translate domain tagType.Errors.IfStuck..." #1007

leonschoorl opened this issue Jan 14, 2020 · 0 comments · Fixed by #1009
Labels

Comments

@leonschoorl
Copy link
Member

import Clash.Prelude

-- topEntity :: Clock "System" -> Reset "System" -> Signal System Bool -> Signal System Bool
topEntity clk rst = withClockResetEnable clk rst enableGen $ mealy @System f False

f s x = (x,s)

In comments is the inferred type for topEntity.
If this is uncommented everything works correctly.

When left commented it will still type check and simulate fine in clashi.
But when generating HDL clash will trip over some leftover type magic from the multiple hidden clocks and/or the associated custom type errors: Can't translate domain tagType.Errors.IfStuck8214565720323842538 ...

Full error:
NamingClashes.hs:4:1: error:
    Clash.Netlist.Util(796): Can't translate domain tagType.Errors.IfStuck8214565720323842538
  Clash.Class.HasDomain.HasSingleDomain.TryDomainResult8214565720323844496
  GHC.Types.Symbol3674937295934325066
  (Clash.Class.HasDomain.HasSingleDomain.TryDomain8214565720323844495
     (Clash.Signal.Internal.Signal8214565720323789597
        "System"
        GHC.Types.Bool3674937295934324744
     -> Clash.Signal.Internal.Signal8214565720323789597
          "System"
          GHC.Types.Bool3674937295934324744)
     (Clash.Signal.Internal.Signal8214565720323789597
        "System"
        GHC.Types.Bool3674937295934324744
     -> Clash.Signal.Internal.Signal8214565720323789597
          "System"
          GHC.Types.Bool3674937295934324744))
  (GHC.TypeLits.TypeError3674937295934325088
     GHC.Types.Symbol3674937295934325066
     (GHC.TypeLits.:$$:3891110078048108700
        (GHC.TypeLits.:$$:3891110078048108700
           (GHC.TypeLits.:$$:3891110078048108700
              (GHC.TypeLits.:$$:3891110078048108700
                 (GHC.TypeLits.:$$:3891110078048108700
                    (GHC.TypeLits.:$$:3891110078048108700
                       (GHC.TypeLits.:$$:3891110078048108700
                          (GHC.TypeLits.:$$:3891110078048108700
                             (GHC.TypeLits.:$$:3891110078048108700
                                (GHC.TypeLits.:$$:3891110078048108700
                                   (GHC.TypeLits.:$$:3891110078048108700
                                      (GHC.TypeLits.:$$:3891110078048108700
                                         (GHC.TypeLits.:$$:3891110078048108700
                                            (GHC.TypeLits.Text3891110078048108694
                                               "Could not determine whether the following type contained a non-ambiguous domain:")
                                            (GHC.TypeLits.Text3891110078048108694
                                               ""))
                                         (GHC.TypeLits.:<>:3891110078048108697
                                            (GHC.TypeLits.Text3891110078048108694
                                               "  ")
                                            (GHC.TypeLits.ShowType3891110078048108703
                                               (GHC.Prim.TYPE3674937295934324912
                                                  GHC.Types.LiftedRep3891110078048108766)
                                               (Clash.Signal.Internal.Signal8214565720323789597
                                                  "System"
                                                  GHC.Types.Bool3674937295934324744
                                               -> Clash.Signal.Internal.Signal8214565720323789597
                                                    "System"
                                                    GHC.Types.Bool3674937295934324744))))
                                      (GHC.TypeLits.Text3891110078048108694 ""))
                                   (GHC.TypeLits.Text3891110078048108694
                                      "In the full type:"))
                                (GHC.TypeLits.Text3891110078048108694 ""))
                             (GHC.TypeLits.:<>:3891110078048108697
                                (GHC.TypeLits.Text3891110078048108694 "  ")
                                (GHC.TypeLits.ShowType3891110078048108703
                                   (GHC.Prim.TYPE3674937295934324912
                                      GHC.Types.LiftedRep3891110078048108766)
                                   (Clash.Signal.Internal.Signal8214565720323789597
                                      "System"
                                      GHC.Types.Bool3674937295934324744
                                   -> Clash.Signal.Internal.Signal8214565720323789597
                                        "System"
                                        GHC.Types.Bool3674937295934324744))))
                          (GHC.TypeLits.Text3891110078048108694 ""))
                       (GHC.TypeLits.Text3891110078048108694
                          "Does it contain one?"))
                    (GHC.TypeLits.Text3891110078048108694 ""))
                 (GHC.TypeLits.Text3891110078048108694 "------"))
              (GHC.TypeLits.Text3891110078048108694 ""))
           (GHC.TypeLits.:$$:3891110078048108700
              (GHC.TypeLits.:$$:3891110078048108700
                 (GHC.TypeLits.:$$:3891110078048108700
                    (GHC.TypeLits.:$$:3891110078048108700
                       (GHC.TypeLits.:$$:3891110078048108700
                          (GHC.TypeLits.:$$:3891110078048108700
                             (GHC.TypeLits.:$$:3891110078048108700
                                (GHC.TypeLits.Text3891110078048108694
                                   "This might happen if an instance for TryDomain is missing. Try to determine")
                                (GHC.TypeLits.Text3891110078048108694
                                   "which of the types miss an instance, and add them. Example implementations:"))
                             (GHC.TypeLits.Text3891110078048108694 ""))
                          (GHC.TypeLits.Text3891110078048108694
                             " * type instance TryDomain t (MyVector n a)    = TryDomain t a"))
                       (GHC.TypeLits.Text3891110078048108694
                          " * type instance TryDomain t (MyCircuit dom a) = Found dom"))
                    (GHC.TypeLits.Text3891110078048108694
                       " * type instance TryDomain t Terminal          = NotFound"))
                 (GHC.TypeLits.Text3891110078048108694 ""))
              (GHC.TypeLits.Text3891110078048108694
                 "Alternatively, use one of the withSpecific* functions.")))
        (GHC.TypeLits.:$$:3891110078048108700
           (GHC.TypeLits.:$$:3891110078048108700
              (GHC.TypeLits.:$$:3891110078048108700
                 (GHC.TypeLits.:$$:3891110078048108700
                    (GHC.TypeLits.:$$:3891110078048108700
                       (GHC.TypeLits.:$$:3891110078048108700
                          (GHC.TypeLits.:$$:3891110078048108700
                             (GHC.TypeLits.:$$:3891110078048108700
                                (GHC.TypeLits.:$$:3891110078048108700
                                   (GHC.TypeLits.:$$:3891110078048108700
                                      (GHC.TypeLits.:$$:3891110078048108700
                                         (GHC.TypeLits.:$$:3891110078048108700
                                            (GHC.TypeLits.:$$:3891110078048108700
                                               (GHC.TypeLits.:$$:3891110078048108700
                                                  (GHC.TypeLits.:$$:3891110078048108700
                                                     (GHC.TypeLits.:$$:3891110078048108700
                                                        (GHC.TypeLits.Text3891110078048108694
                                                           "")
                                                        (GHC.TypeLits.Text3891110078048108694
                                                           "------"))
                                                     (GHC.TypeLits.Text3891110078048108694
                                                        ""))
                                                  (GHC.TypeLits.Text3891110078048108694
                                                     "You tried to apply an explicitly routed clock, reset, or enable line"))
                                               (GHC.TypeLits.Text3891110078048108694
                                                  "to a construct with, possibly, an implicitly routed one. Clash failed to"))
                                            (GHC.TypeLits.Text3891110078048108694
                                               "unambigously determine a single domain and could therefore not route it."))
                                         (GHC.TypeLits.Text3891110078048108694
                                            "You possibly used one of these sets of functions:"))
                                      (GHC.TypeLits.Text3891110078048108694 ""))
                                   (GHC.TypeLits.Text3891110078048108694
                                      " * with{ClockResetEnable,Clock,Reset,Enable}"))
                                (GHC.TypeLits.Text3891110078048108694
                                   " * expose{ClockResetEnable,Clock,Reset,Enable}"))
                             (GHC.TypeLits.Text3891110078048108694 ""))
                          (GHC.TypeLits.Text3891110078048108694
                             "These functions are suitable for components defined over a single domain"))
                       (GHC.TypeLits.Text3891110078048108694
                          "only. If you want to use multiple domains, use the following instead:"))
                    (GHC.TypeLits.Text3891110078048108694 ""))
                 (GHC.TypeLits.Text3891110078048108694
                    " * withSpecific{ClockResetEnable,Clock,Reset,Enable}"))
              (GHC.TypeLits.Text3891110078048108694
                 " * exposeSpecific{ClockResetEnable,Clock,Reset,Enable}"))
           (GHC.TypeLits.Text3891110078048108694 ""))))
  (Fcf.Combinators.Pure8214565720323842537
     GHC.Types.Symbol3674937295934325066
     (Clash.Class.HasDomain.HasSingleDomain.ErrOnConflict8214565720323844488
        (Clash.Signal.Internal.Signal8214565720323789597
           "System"
           GHC.Types.Bool3674937295934324744
        -> Clash.Signal.Internal.Signal8214565720323789597
             "System"
             GHC.Types.Bool3674937295934324744)
        (Clash.Class.HasDomain.HasSingleDomain.TryDomain8214565720323844495
           (Clash.Signal.Internal.Signal8214565720323789597
              "System"
              GHC.Types.Bool3674937295934324744
           -> Clash.Signal.Internal.Signal8214565720323789597
                "System"
                GHC.Types.Bool3674937295934324744)
           (Clash.Signal.Internal.Signal8214565720323789597
              "System"
              GHC.Types.Bool3674937295934324744
           -> Clash.Signal.Internal.Signal8214565720323789597
                "System"
                GHC.Types.Bool3674937295934324744))))
    NB: The source location of the error is not exact, only indicative, as it is acquired after optimisations.
    The actual location of the error can be in a function that is inlined.
    To prevent inlining of those functions, annotate them with a NOINLINE pragma.
  |
4 | topEntity clk rst = withClockResetEnable clk rst enableGen $ mealy @System f False
  | ^^^^^^^^^
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants