Skip to content

autoReg @System @(Maybe Int) can't be used with undefined reset values #1507

Closed
@martijnbastiaan

Description

@martijnbastiaan

Minimal example:

import Clash.Prelude

topEntity :: 
  SystemClockResetEnable => 
  Signal System (Maybe Int) ->
  Signal System (Maybe Int)
topEntity = autoReg  (errorX "foo bar")       

Error:

Test.hs:7:1: error:
    
    Clash.Netlist.BlackBox(188): Couldn't instantiate blackbox for Clash.Signal.Internal.register#. Verification procedure reported:
    
    Argument 5 should be literal, as blackbox used ~CONST[5], but was:
    
    Identifier "initial_0" Nothing
    
    The source location of the error is not exact, only indicative, as it is acquired 
    after optimizations. 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.
  |
7 | topEntity = autoReg  (errorX "foo bar")
  | ^^^^^^^^^

When running with -fclash-debug DebugSilent I get:

Irreducible constant as case subject: Clash.XException.errorX
  @(GHC.Maybe.Maybe[3674937295934324792] GHC.Types.Int[3674937295934324766])
  (Clash.Transformations.removedArg @GHC.Stack.Types.CallStack[3674937295934325108])
  (Clash.Transformations.removedArg
     @(GHC.Types.[][3674937295934324788] GHC.Types.Char[3674937295934324752]))
Can be reduced to: Clash.XException.errorX
  @(GHC.Maybe.Maybe[3674937295934324792] GHC.Types.Int[3674937295934324766])
  (Clash.Transformations.removedArg @GHC.Stack.Types.CallStack[3674937295934325108])
  (Clash.Transformations.removedArg
     @(GHC.Types.[][3674937295934324788] GHC.Types.Char[3674937295934324752]))
Irreducible constant as case subject: Clash.XException.errorX
  @(GHC.Maybe.Maybe[3674937295934324792] GHC.Types.Int[3674937295934324766])
  (Clash.Transformations.removedArg @GHC.Stack.Types.CallStack[3674937295934325108])
  (Clash.Transformations.removedArg
     @(GHC.Types.[][3674937295934324788] GHC.Types.Char[3674937295934324752]))
Can be reduced to: Clash.XException.errorX
  @(GHC.Maybe.Maybe[3674937295934324792] GHC.Types.Int[3674937295934324766])
  (Clash.Transformations.removedArg @GHC.Stack.Types.CallStack[3674937295934325108])
  (Clash.Transformations.removedArg
     @(GHC.Types.[][3674937295934324788] GHC.Types.Char[3674937295934324752]))
Irreducible constant as case subject: Clash.XException.errorX
  @(GHC.Maybe.Maybe[3674937295934324792] GHC.Types.Int[3674937295934324766])
  (Clash.Transformations.removedArg @GHC.Stack.Types.CallStack[3674937295934325108])
  (Clash.Transformations.removedArg
     @(GHC.Types.[][3674937295934324788] GHC.Types.Char[3674937295934324752]))
Can be reduced to: Clash.XException.errorX
  @(GHC.Maybe.Maybe[3674937295934324792] GHC.Types.Int[3674937295934324766])
  (Clash.Transformations.removedArg @GHC.Stack.Types.CallStack[3674937295934325108])
  (Clash.Transformations.removedArg
     @(GHC.Types.[][3674937295934324788] GHC.Types.Char[3674937295934324752]))
Irreducible constant as case subject: Clash.XException.errorX
  @(GHC.Maybe.Maybe[3674937295934324792] GHC.Types.Int[3674937295934324766])
  (Clash.Transformations.removedArg @GHC.Stack.Types.CallStack[3674937295934325108])
  (Clash.Transformations.removedArg
     @(GHC.Types.[][3674937295934324788] GHC.Types.Char[3674937295934324752]))
Can be reduced to: Clash.XException.errorX
  @(GHC.Maybe.Maybe[3674937295934324792] GHC.Types.Int[3674937295934324766])
  (Clash.Transformations.removedArg @GHC.Stack.Types.CallStack[3674937295934325108])
  (Clash.Transformations.removedArg
     @(GHC.Types.[][3674937295934324788] GHC.Types.Char[3674937295934324752]))
Irreducible constant as case subject: Clash.XException.errorX
  @(GHC.Maybe.Maybe[3674937295934324792] GHC.Types.Int[3674937295934324766])
  (Clash.Transformations.removedArg @GHC.Stack.Types.CallStack[3674937295934325108])
  (Clash.Transformations.removedArg
     @(GHC.Types.[][3674937295934324788] GHC.Types.Char[3674937295934324752]))
Can be reduced to: Clash.XException.errorX
  @(GHC.Maybe.Maybe[3674937295934324792] GHC.Types.Int[3674937295934324766])
  (Clash.Transformations.removedArg @GHC.Stack.Types.CallStack[3674937295934325108])
  (Clash.Transformations.removedArg
     @(GHC.Types.[][3674937295934324788] GHC.Types.Char[3674937295934324752]))
Irreducible constant as case subject: Clash.XException.errorX
  @(GHC.Maybe.Maybe[3674937295934324792] GHC.Types.Int[3674937295934324766])
  (Clash.Transformations.removedArg @GHC.Stack.Types.CallStack[3674937295934325108])
  (Clash.Transformations.removedArg
     @(GHC.Types.[][3674937295934324788] GHC.Types.Char[3674937295934324752]))
Can be reduced to: Clash.XException.errorX
  @(GHC.Maybe.Maybe[3674937295934324792] GHC.Types.Int[3674937295934324766])
  (Clash.Transformations.removedArg @GHC.Stack.Types.CallStack[3674937295934325108])
  (Clash.Transformations.removedArg
     @(GHC.Types.[][3674937295934324788] GHC.Types.Char[3674937295934324752]))
Irreducible constant as case subject: Clash.XException.errorX
  @(GHC.Maybe.Maybe[3674937295934324792] GHC.Types.Int[3674937295934324766])
  (Clash.Transformations.removedArg @GHC.Stack.Types.CallStack[3674937295934325108])
  (Clash.Transformations.removedArg
     @(GHC.Types.[][3674937295934324788] GHC.Types.Char[3674937295934324752]))
Can be reduced to: Clash.XException.errorX
  @(GHC.Maybe.Maybe[3674937295934324792] GHC.Types.Int[3674937295934324766])
  (Clash.Transformations.removedArg @GHC.Stack.Types.CallStack[3674937295934325108])
  (Clash.Transformations.removedArg
     @(GHC.Types.[][3674937295934324788] GHC.Types.Char[3674937295934324752]))
Irreducible constant as case subject: Clash.XException.errorX
  @(GHC.Maybe.Maybe[3674937295934324792] GHC.Types.Int[3674937295934324766])
  (Clash.Transformations.removedArg @GHC.Stack.Types.CallStack[3674937295934325108])
  (Clash.Transformations.removedArg
     @(GHC.Types.[][3674937295934324788] GHC.Types.Char[3674937295934324752]))
Can be reduced to: Clash.XException.errorX
  @(GHC.Maybe.Maybe[3674937295934324792] GHC.Types.Int[3674937295934324766])
  (Clash.Transformations.removedArg @GHC.Stack.Types.CallStack[3674937295934325108])
  (Clash.Transformations.removedArg
     @(GHC.Types.[][3674937295934324788] GHC.Types.Char[3674937295934324752]))
Irreducible constant as case subject: Clash.XException.errorX
  @(GHC.Maybe.Maybe[3674937295934324792] GHC.Types.Int[3674937295934324766])
  (Clash.Transformations.removedArg @GHC.Stack.Types.CallStack[3674937295934325108])
  (Clash.Transformations.removedArg
     @(GHC.Types.[][3674937295934324788] GHC.Types.Char[3674937295934324752]))
Can be reduced to: Clash.XException.errorX
  @(GHC.Maybe.Maybe[3674937295934324792] GHC.Types.Int[3674937295934324766])
  (Clash.Transformations.removedArg @GHC.Stack.Types.CallStack[3674937295934325108])
  (Clash.Transformations.removedArg
     @(GHC.Types.[][3674937295934324788] GHC.Types.Char[3674937295934324752]))
Irreducible constant as case subject: Clash.XException.errorX
  @(GHC.Maybe.Maybe[3674937295934324792] GHC.Types.Int[3674937295934324766])
  (Clash.Transformations.removedArg @GHC.Stack.Types.CallStack[3674937295934325108])
  (Clash.Transformations.removedArg
     @(GHC.Types.[][3674937295934324788] GHC.Types.Char[3674937295934324752]))
Can be reduced to: Clash.XException.errorX
  @(GHC.Maybe.Maybe[3674937295934324792] GHC.Types.Int[3674937295934324766])
  (Clash.Transformations.removedArg @GHC.Stack.Types.CallStack[3674937295934325108])
  (Clash.Transformations.removedArg
     @(GHC.Types.[][3674937295934324788] GHC.Types.Char[3674937295934324752]))
Irreducible constant as case subject: Clash.XException.errorX
  @(GHC.Maybe.Maybe[3674937295934324792] GHC.Types.Int[3674937295934324766])
  (Clash.Transformations.removedArg @GHC.Stack.Types.CallStack[3674937295934325108])
  (Clash.Transformations.removedArg
     @(GHC.Types.[][3674937295934324788] GHC.Types.Char[3674937295934324752]))
Can be reduced to: Clash.XException.errorX
  @(GHC.Maybe.Maybe[3674937295934324792] GHC.Types.Int[3674937295934324766])
  (Clash.Transformations.removedArg @GHC.Stack.Types.CallStack[3674937295934325108])
  (Clash.Transformations.removedArg
     @(GHC.Types.[][3674937295934324788] GHC.Types.Char[3674937295934324752]))
Irreducible constant as case subject: Clash.XException.errorX
  @(GHC.Maybe.Maybe[3674937295934324792] GHC.Types.Int[3674937295934324766])
  (Clash.Transformations.removedArg @GHC.Stack.Types.CallStack[3674937295934325108])
  (Clash.Transformations.removedArg
     @(GHC.Types.[][3674937295934324788] GHC.Types.Char[3674937295934324752]))
Can be reduced to: Clash.XException.errorX
  @(GHC.Maybe.Maybe[3674937295934324792] GHC.Types.Int[3674937295934324766])
  (Clash.Transformations.removedArg @GHC.Stack.Types.CallStack[3674937295934325108])
  (Clash.Transformations.removedArg
     @(GHC.Types.[][3674937295934324788] GHC.Types.Char[3674937295934324752]))
Irreducible constant as case subject: Clash.XException.errorX
  @(GHC.Maybe.Maybe[3674937295934324792] GHC.Types.Int[3674937295934324766])
  (Clash.Transformations.removedArg @GHC.Stack.Types.CallStack[3674937295934325108])
  (Clash.Transformations.removedArg
     @(GHC.Types.[][3674937295934324788] GHC.Types.Char[3674937295934324752]))
Can be reduced to: Clash.XException.errorX
  @(GHC.Maybe.Maybe[3674937295934324792] GHC.Types.Int[3674937295934324766])
  (Clash.Transformations.removedArg @GHC.Stack.Types.CallStack[3674937295934325108])
  (Clash.Transformations.removedArg
     @(GHC.Types.[][3674937295934324788] GHC.Types.Char[3674937295934324752]))
Irreducible constant as case subject: Clash.XException.errorX
  @(GHC.Maybe.Maybe[3674937295934324792] GHC.Types.Int[3674937295934324766])
  (Clash.Transformations.removedArg @GHC.Stack.Types.CallStack[3674937295934325108])
  (Clash.Transformations.removedArg
     @(GHC.Types.[][3674937295934324788] GHC.Types.Char[3674937295934324752]))
Can be reduced to: Clash.XException.errorX
  @(GHC.Maybe.Maybe[3674937295934324792] GHC.Types.Int[3674937295934324766])
  (Clash.Transformations.removedArg @GHC.Stack.Types.CallStack[3674937295934325108])
  (Clash.Transformations.removedArg
     @(GHC.Types.[][3674937295934324788] GHC.Types.Char[3674937295934324752]))
Irreducible constant as case subject: Clash.XException.errorX
  @(GHC.Maybe.Maybe[3674937295934324792] GHC.Types.Int[3674937295934324766])
  (Clash.Transformations.removedArg @GHC.Stack.Types.CallStack[3674937295934325108])
  (Clash.Transformations.removedArg
     @(GHC.Types.[][3674937295934324788] GHC.Types.Char[3674937295934324752]))
Can be reduced to: Clash.XException.errorX
  @(GHC.Maybe.Maybe[3674937295934324792] GHC.Types.Int[3674937295934324766])
  (Clash.Transformations.removedArg @GHC.Stack.Types.CallStack[3674937295934325108])
  (Clash.Transformations.removedArg
     @(GHC.Types.[][3674937295934324788] GHC.Types.Char[3674937295934324752]))
Irreducible constant as case subject: Clash.XException.errorX
  @(GHC.Maybe.Maybe[3674937295934324792] GHC.Types.Int[3674937295934324766])
  (Clash.Transformations.removedArg @GHC.Stack.Types.CallStack[3674937295934325108])
  (Clash.Transformations.removedArg
     @(GHC.Types.[][3674937295934324788] GHC.Types.Char[3674937295934324752]))
Can be reduced to: Clash.XException.errorX
  @(GHC.Maybe.Maybe[3674937295934324792] GHC.Types.Int[3674937295934324766])
  (Clash.Transformations.removedArg @GHC.Stack.Types.CallStack[3674937295934325108])
  (Clash.Transformations.removedArg
     @(GHC.Types.[][3674937295934324788] GHC.Types.Char[3674937295934324752]))
Irreducible constant as case subject: Clash.XException.errorX
  @(GHC.Maybe.Maybe[3674937295934324792] GHC.Types.Int[3674937295934324766])
  (Clash.Transformations.removedArg @GHC.Stack.Types.CallStack[3674937295934325108])
  (Clash.Transformations.removedArg
     @(GHC.Types.[][3674937295934324788] GHC.Types.Char[3674937295934324752]))
Can be reduced to: Clash.XException.errorX
  @(GHC.Maybe.Maybe[3674937295934324792] GHC.Types.Int[3674937295934324766])
  (Clash.Transformations.removedArg @GHC.Stack.Types.CallStack[3674937295934325108])
  (Clash.Transformations.removedArg
     @(GHC.Types.[][3674937295934324788] GHC.Types.Char[3674937295934324752]))
Irreducible constant as case subject: Clash.XException.errorX
  @(GHC.Maybe.Maybe[3674937295934324792] GHC.Types.Int[3674937295934324766])
  (Clash.Transformations.removedArg @GHC.Stack.Types.CallStack[3674937295934325108])
  (Clash.Transformations.removedArg
     @(GHC.Types.[][3674937295934324788] GHC.Types.Char[3674937295934324752]))
Can be reduced to: Clash.XException.errorX
  @(GHC.Maybe.Maybe[3674937295934324792] GHC.Types.Int[3674937295934324766])
  (Clash.Transformations.removedArg @GHC.Stack.Types.CallStack[3674937295934325108])
  (Clash.Transformations.removedArg
     @(GHC.Types.[][3674937295934324788] GHC.Types.Char[3674937295934324752]))
Irreducible constant as case subject: Clash.XException.errorX
  @(GHC.Maybe.Maybe[3674937295934324792] GHC.Types.Int[3674937295934324766])
  (Clash.Transformations.removedArg @GHC.Stack.Types.CallStack[3674937295934325108])
  (Clash.Transformations.removedArg
     @(GHC.Types.[][3674937295934324788] GHC.Types.Char[3674937295934324752]))
Can be reduced to: Clash.XException.errorX
  @(GHC.Maybe.Maybe[3674937295934324792] GHC.Types.Int[3674937295934324766])
  (Clash.Transformations.removedArg @GHC.Stack.Types.CallStack[3674937295934325108])
  (Clash.Transformations.removedArg
     @(GHC.Types.[][3674937295934324788] GHC.Types.Char[3674937295934324752]))
Irreducible constant as case subject: Clash.XException.errorX
  @(GHC.Maybe.Maybe[3674937295934324792] GHC.Types.Int[3674937295934324766])
  (Clash.Transformations.removedArg @GHC.Stack.Types.CallStack[3674937295934325108])
  (Clash.Transformations.removedArg
     @(GHC.Types.[][3674937295934324788] GHC.Types.Char[3674937295934324752]))
Can be reduced to: Clash.XException.errorX
  @(GHC.Maybe.Maybe[3674937295934324792] GHC.Types.Int[3674937295934324766])
  (Clash.Transformations.removedArg @GHC.Stack.Types.CallStack[3674937295934325108])
  (Clash.Transformations.removedArg
     @(GHC.Types.[][3674937295934324788] GHC.Types.Char[3674937295934324752]))
Irreducible constant as case subject: Clash.XException.errorX
  @(GHC.Maybe.Maybe[3674937295934324792] GHC.Types.Int[3674937295934324766])
  (Clash.Transformations.removedArg @GHC.Stack.Types.CallStack[3674937295934325108])
  (Clash.Transformations.removedArg
     @(GHC.Types.[][3674937295934324788] GHC.Types.Char[3674937295934324752]))
Can be reduced to: Clash.XException.errorX
  @(GHC.Maybe.Maybe[3674937295934324792] GHC.Types.Int[3674937295934324766])
  (Clash.Transformations.removedArg @GHC.Stack.Types.CallStack[3674937295934325108])
  (Clash.Transformations.removedArg
     @(GHC.Types.[][3674937295934324788] GHC.Types.Char[3674937295934324752]))
Irreducible constant as case subject: Clash.XException.errorX
  @(GHC.Maybe.Maybe[3674937295934324792] GHC.Types.Int[3674937295934324766])
  (Clash.Transformations.removedArg @GHC.Stack.Types.CallStack[3674937295934325108])
  (Clash.Transformations.removedArg
     @(GHC.Types.[][3674937295934324788] GHC.Types.Char[3674937295934324752]))
Can be reduced to: Clash.XException.errorX
  @(GHC.Maybe.Maybe[3674937295934324792] GHC.Types.Int[3674937295934324766])
  (Clash.Transformations.removedArg @GHC.Stack.Types.CallStack[3674937295934325108])
  (Clash.Transformations.removedArg
     @(GHC.Types.[][3674937295934324788] GHC.Types.Char[3674937295934324752]))

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions