No blackbox for catch#

Skip to first unread message

Oct 29, 2023, 9:20:00 AM10/29/23
to Clash - Hardware Description Language
clash -XCPP -fconstraint-solver-iterations=0 -package silently -fclash-spec-limit=80 -fclash-inline-limit=640 -fclash-hdldir verilog27 --verilog KPU/NTLB.hs
GHC: Setting up GHC took: 1.109s
GHC: Compiling and loading modules took: 26.922s
Clash: Parsing and compiling primitives took 0.712s
GHC+Clash: Loading modules cumulatively took 31.864s
Clash: Compiling KPU.NTLB.ntlb16
Clash: Normalization took 23m29s

KPU/NTLB.hs:3633:1: error:
    Clash.Netlist.BlackBox(319): No blackbox found for: GHC.Prim.catch#. Did you forget to include directories containing primitives? You can use '-i/my/prim/dir' to achieve this.
    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.
3633 |          return (Just (pdptr,pd))

I imagine its complaining about undefined? I used undefineds, with hasUndefined to catch and do something about them (I am willing to do something else!). Cheap 3-value logic.

Or is it worried because I left the odd 'error "owwww"' in?

Thanks for pointers as to which to hit with the spanner!


Christiaan Baaij

Oct 29, 2023, 9:28:57 AM10/29/23
Your hunch is correct, we don't have a translation for `hasUndefined`. So you cannot use that in parts that have to be translated to a circuit.
Basically the only functions from `Clash.XException` that have a translation to circuits are defined in:

We should probably be clearer in the documentation which functions in Clash.XException have a translation to hardware, and which do not.

You received this message because you are subscribed to the Google Groups "Clash - Hardware Description Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit
Reply all
Reply to author
0 new messages