Open martijnbastiaan opened 7 months ago
This:
commit 3c20e659a3d5ea006661a1960f46948967dd5a42 (HEAD -> master) Author: Martijn Bastiaan <martijn@qbaylogic.com> Date: Wed Feb 7 17:13:53 2024 +0100 Add test for #2660 diff --git a/tests/Main.hs b/tests/Main.hs index b56019fe9..351c88e10 100755 --- a/tests/Main.hs +++ b/tests/Main.hs @@ -559,7 +559,8 @@ runClashTest = defaultMain $ clashTestRoot def{ hdlTargets=[VHDL, Verilog, SystemVerilog] , hdlLoad=[Vivado] , hdlSim=[Vivado] - , buildTargets=BuildSpecific [ "noInputTrue" + , buildTargets=BuildSpecific [ "t2660" + , "noInputTrue" , "noInputFalse" , "noInputLow" , "noInputHigh" diff --git a/tests/shouldwork/Cores/Xilinx/VIO.hs b/tests/shouldwork/Cores/Xilinx/VIO.hs index 483ebc32e..a42b8852a 100644 --- a/tests/shouldwork/Cores/Xilinx/VIO.hs +++ b/tests/shouldwork/Cores/Xilinx/VIO.hs @@ -28,6 +28,16 @@ top = 0 makeTopEntity 'top +-- | See https://github.com/clash-lang/clash-compiler/issues/2659 +t2660 :: + "clk" ::: Clock Dom -> + "result" ::: Signal Dom Bool +t2660 = vioProbe @Dom inNames outNames (errorX "boo") + where + inNames = Nil + outNames = singleton "probe_out" +makeTopEntity 't2660 + noInputTrue :: "clk" ::: Clock Dom -> "result" ::: Signal Dom Bool
makes
cabal run clash-testsuite -- -p shouldwork.Cores.Xilinx.VIO.VHDL -j24
fail with:
<no location info>: error: Clash error call: Clash failed to determine a constant value for one of the expressions given as the inital output probe values. The failing expression is: BlackBoxE "Clash.XException.errorX" [] [] [] (BBTemplate [ Err Nothing ]) Context { bbName = "Clash.XException.errorX" , bbResults = [ ( Identifier (RawIdentifier "result" Nothing [ ( "unsafeMake" , SrcLoc { srcLocPackage = "clash-lib-1.9.0-inplace" , srcLocModule = "Clash.Netlist.Id" , srcLocFile = "src/Clash/Netlist/Id.hs" , srcLocStartLine = 244 , srcLocStartCol = 20 , srcLocEndLine = 244 , srcLocEndCol = 30 } ) , ( "unsafeFromCoreId" , SrcLoc { srcLocPackage = "clash-lib-1.9.0-inplace" , srcLocModule = "Clash.Netlist.BlackBox" , srcLocFile = "src/Clash/Netlist/BlackBox.hs" , srcLocStartLine = 148 , srcLocStartCol = 21 , srcLocEndLine = 148 , srcLocEndCol = 40 } ) , ( "mkBlackBoxContext" , SrcLoc { srcLocPackage = "clash-lib-1.9.0-inplace" , srcLocModule = "Clash.Netlist.BlackBox" , srcLocFile = "src/Clash/Netlist/BlackBox.hs" , srcLocStartLine = 524 , srcLocStartCol = 47 , srcLocEndLine = 524 , srcLocEndCol = 64 } ) ]) Nothing , Bool ) ] , bbInputs = [ ( Identifier (RawIdentifier "__VOID__" Nothing [ ( "unsafeMake" , SrcLoc { srcLocPackage = "clash-lib-1.9.0-inplace" , srcLocModule = "Clash.Netlist.BlackBox" , srcLocFile = "src/Clash/Netlist/BlackBox.hs" , srcLocStartLine = 550 , srcLocStartCol = 52 , srcLocEndLine = 550 , srcLocEndCol = 65 } ) ]) Nothing , Void Nothing , False ) , ( BlackBoxE "Clash.Normalize.Primitives.removedArg" [] [] [] (BBTemplate [ Err Nothing ]) Context { bbName = "Clash.Normalize.Primitives.removedArg" , bbResults = [ ( Identifier (RawIdentifier "result" Nothing [ ( "unsafeMake" , SrcLoc { srcLocPackage = "clash-lib-1.9.0-inplace" , srcLocModule = "Clash.Netlist.Id" , srcLocFile = "src/Clash/Netlist/Id.hs" , srcLocStartLine = 244 , srcLocStartCol = 20 , srcLocEndLine = 244 , srcLocEndCol = 30 } ) , ( "unsafeFromCoreId" , SrcLoc { srcLocPackage = "clash-lib-1.9.0-inplace" , srcLocModule = "Clash.Netlist.BlackBox" , srcLocFile = "src/Clash/Netlist/BlackBox.hs" , srcLocStartLine = 148 , srcLocStartCol = 21 , srcLocEndLine = 148 , srcLocEndCol = 40 } ) , ( "mkBlackBoxContext" , SrcLoc { srcLocPackage = "clash-lib-1.9.0-inplace" , srcLocModule = "Clash.Netlist.BlackBox" , srcLocFile = "src/Clash/Netlist/BlackBox.hs" , srcLocStartLine = 524 , srcLocStartCol = 47 , srcLocEndLine = 524 , srcLocEndCol = 64 } ) ]) Nothing , String ) ] , bbInputs = [] , bbFunctions = fromList [] , bbQsysIncName = [] , bbLevel = 0 , bbCompName = UniqueIdentifier { i_baseName = "VIO_t2659_vioProbe" , i_baseNameCaseFold = "vio_t2659_vioprobe" , i_extensionsRev = [] , i_idType = Basic , i_hdl = VHDL , i_provenance = [ ( "make##" , SrcLoc { srcLocPackage = "clash-lib-1.9.0-inplace" , srcLocModule = "Clash.Netlist.Id.Internal" , srcLocFile = "src/Clash/Netlist/Id/Internal.hs" , srcLocStartLine = 131 , srcLocStartCol = 9 , srcLocEndLine = 131 , srcLocEndCol = 15 } ) , ( "make#" , SrcLoc { srcLocPackage = "clash-lib-1.9.0-inplace" , srcLocModule = "Clash.Netlist.Id.Internal" , srcLocFile = "src/Clash/Netlist/Id/Internal.hs" , srcLocStartLine = 135 , srcLocStartCol = 18 , srcLocEndLine = 135 , srcLocEndCol = 23 } ) , ( "makeBasic#" , SrcLoc { srcLocPackage = "clash-lib-1.9.0-inplace" , srcLocModule = "Clash.Netlist.Id" , srcLocFile = "src/Clash/Netlist/Id.hs" , srcLocStartLine = 179 , srcLocStartCol = 32 , srcLocEndLine = 179 , srcLocEndCol = 42 } ) , ( "makeBasic" , SrcLoc { srcLocPackage = "clash-lib-1.9.0-inplace" , srcLocModule = "Clash.Netlist" , srcLocFile = "src/Clash/Netlist.hs" , srcLocStartLine = 201 , srcLocStartCol = 15 , srcLocEndLine = 201 , srcLocEndCol = 27 } ) ] } , bbCtxName = Just "result" } True , String , True ) ] , bbFunctions = fromList [] , bbQsysIncName = [] , bbLevel = 0 , bbCompName = UniqueIdentifier { i_baseName = "VIO_t2659_vioProbe" , i_baseNameCaseFold = "vio_t2659_vioprobe" , i_extensionsRev = [] , i_idType = Basic , i_hdl = VHDL , i_provenance = [ ( "make##" , SrcLoc { srcLocPackage = "clash-lib-1.9.0-inplace" , srcLocModule = "Clash.Netlist.Id.Internal" , srcLocFile = "src/Clash/Netlist/Id/Internal.hs" , srcLocStartLine = 131 , srcLocStartCol = 9 , srcLocEndLine = 131 , srcLocEndCol = 15 } ) , ( "make#" , SrcLoc { srcLocPackage = "clash-lib-1.9.0-inplace" , srcLocModule = "Clash.Netlist.Id.Internal" , srcLocFile = "src/Clash/Netlist/Id/Internal.hs" , srcLocStartLine = 135 , srcLocStartCol = 18 , srcLocEndLine = 135 , srcLocEndCol = 23 } ) , ( "makeBasic#" , SrcLoc { srcLocPackage = "clash-lib-1.9.0-inplace" , srcLocModule = "Clash.Netlist.Id" , srcLocFile = "src/Clash/Netlist/Id.hs" , srcLocStartLine = 179 , srcLocStartCol = 32 , srcLocEndLine = 179 , srcLocEndCol = 42 } ) , ( "makeBasic" , SrcLoc { srcLocPackage = "clash-lib-1.9.0-inplace" , srcLocModule = "Clash.Netlist" , srcLocFile = "src/Clash/Netlist.hs" , srcLocStartLine = 201 , srcLocStartCol = 15 , srcLocEndLine = 201 , srcLocEndCol = 27 } ) ] } , bbCtxName = Just "result" } True The complete expression is: BlackBoxE "Clash.XException.errorX" [] [] [] (BBTemplate [ Err Nothing ]) Context { bbName = "Clash.XException.errorX" , bbResults = [ ( Identifier (RawIdentifier "result" Nothing [ ( "unsafeMake" , SrcLoc { srcLocPackage = "clash-lib-1.9.0-inplace" , srcLocModule = "Clash.Netlist.Id" , srcLocFile = "src/Clash/Netlist/Id.hs" , srcLocStartLine = 244 , srcLocStartCol = 20 , srcLocEndLine = 244 , srcLocEndCol = 30 } ) , ( "unsafeFromCoreId" , SrcLoc { srcLocPackage = "clash-lib-1.9.0-inplace" , srcLocModule = "Clash.Netlist.BlackBox" , srcLocFile = "src/Clash/Netlist/BlackBox.hs" , srcLocStartLine = 148 , srcLocStartCol = 21 , srcLocEndLine = 148 , srcLocEndCol = 40 } ) , ( "mkBlackBoxContext" , SrcLoc { srcLocPackage = "clash-lib-1.9.0-inplace" , srcLocModule = "Clash.Netlist.BlackBox" , srcLocFile = "src/Clash/Netlist/BlackBox.hs" , srcLocStartLine = 524 , srcLocStartCol = 47 , srcLocEndLine = 524 , srcLocEndCol = 64 } ) ]) Nothing , Bool ) ] , bbInputs = [ ( Identifier (RawIdentifier "__VOID__" Nothing [ ( "unsafeMake" , SrcLoc { srcLocPackage = "clash-lib-1.9.0-inplace" , srcLocModule = "Clash.Netlist.BlackBox" , srcLocFile = "src/Clash/Netlist/BlackBox.hs" , srcLocStartLine = 550 , srcLocStartCol = 52 , srcLocEndLine = 550 , srcLocEndCol = 65 } ) ]) Nothing , Void Nothing , False ) , ( BlackBoxE "Clash.Normalize.Primitives.removedArg" [] [] [] (BBTemplate [ Err Nothing ]) Context { bbName = "Clash.Normalize.Primitives.removedArg" , bbResults = [ ( Identifier (RawIdentifier "result" Nothing [ ( "unsafeMake" , SrcLoc { srcLocPackage = "clash-lib-1.9.0-inplace" , srcLocModule = "Clash.Netlist.Id" , srcLocFile = "src/Clash/Netlist/Id.hs" , srcLocStartLine = 244 , srcLocStartCol = 20 , srcLocEndLine = 244 , srcLocEndCol = 30 } ) , ( "unsafeFromCoreId" , SrcLoc { srcLocPackage = "clash-lib-1.9.0-inplace" , srcLocModule = "Clash.Netlist.BlackBox" , srcLocFile = "src/Clash/Netlist/BlackBox.hs" , srcLocStartLine = 148 , srcLocStartCol = 21 , srcLocEndLine = 148 , srcLocEndCol = 40 } ) , ( "mkBlackBoxContext" , SrcLoc { srcLocPackage = "clash-lib-1.9.0-inplace" , srcLocModule = "Clash.Netlist.BlackBox" , srcLocFile = "src/Clash/Netlist/BlackBox.hs" , srcLocStartLine = 524 , srcLocStartCol = 47 , srcLocEndLine = 524 , srcLocEndCol = 64 } ) ]) Nothing , String ) ] , bbInputs = [] , bbFunctions = fromList [] , bbQsysIncName = [] , bbLevel = 0 , bbCompName = UniqueIdentifier { i_baseName = "VIO_t2659_vioProbe" , i_baseNameCaseFold = "vio_t2659_vioprobe" , i_extensionsRev = [] , i_idType = Basic , i_hdl = VHDL , i_provenance = [ ( "make##" , SrcLoc { srcLocPackage = "clash-lib-1.9.0-inplace" , srcLocModule = "Clash.Netlist.Id.Internal" , srcLocFile = "src/Clash/Netlist/Id/Internal.hs" , srcLocStartLine = 131 , srcLocStartCol = 9 , srcLocEndLine = 131 , srcLocEndCol = 15 } ) , ( "make#" , SrcLoc { srcLocPackage = "clash-lib-1.9.0-inplace" , srcLocModule = "Clash.Netlist.Id.Internal" , srcLocFile = "src/Clash/Netlist/Id/Internal.hs" , srcLocStartLine = 135 , srcLocStartCol = 18 , srcLocEndLine = 135 , srcLocEndCol = 23 } ) , ( "makeBasic#" , SrcLoc { srcLocPackage = "clash-lib-1.9.0-inplace" , srcLocModule = "Clash.Netlist.Id" , srcLocFile = "src/Clash/Netlist/Id.hs" , srcLocStartLine = 179 , srcLocStartCol = 32 , srcLocEndLine = 179 , srcLocEndCol = 42 } ) , ( "makeBasic" , SrcLoc { srcLocPackage = "clash-lib-1.9.0-inplace" , srcLocModule = "Clash.Netlist" , srcLocFile = "src/Clash/Netlist.hs" , srcLocStartLine = 201 , srcLocStartCol = 15 , srcLocEndLine = 201 , srcLocEndCol = 27 } ) ] } , bbCtxName = Just "result" } True , String , True ) ] , bbFunctions = fromList [] , bbQsysIncName = [] , bbLevel = 0 , bbCompName = UniqueIdentifier { i_baseName = "VIO_t2659_vioProbe" , i_baseNameCaseFold = "vio_t2659_vioprobe" , i_extensionsRev = [] , i_idType = Basic , i_hdl = VHDL , i_provenance = [ ( "make##" , SrcLoc { srcLocPackage = "clash-lib-1.9.0-inplace" , srcLocModule = "Clash.Netlist.Id.Internal" , srcLocFile = "src/Clash/Netlist/Id/Internal.hs" , srcLocStartLine = 131 , srcLocStartCol = 9 , srcLocEndLine = 131 , srcLocEndCol = 15 } ) , ( "make#" , SrcLoc { srcLocPackage = "clash-lib-1.9.0-inplace" , srcLocModule = "Clash.Netlist.Id.Internal" , srcLocFile = "src/Clash/Netlist/Id/Internal.hs" , srcLocStartLine = 135 , srcLocStartCol = 18 , srcLocEndLine = 135 , srcLocEndCol = 23 } ) , ( "makeBasic#" , SrcLoc { srcLocPackage = "clash-lib-1.9.0-inplace" , srcLocModule = "Clash.Netlist.Id" , srcLocFile = "src/Clash/Netlist/Id.hs" , srcLocStartLine = 179 , srcLocStartCol = 32 , srcLocEndLine = 179 , srcLocEndCol = 42 } ) , ( "makeBasic" , SrcLoc { srcLocPackage = "clash-lib-1.9.0-inplace" , srcLocModule = "Clash.Netlist" , srcLocFile = "src/Clash/Netlist.hs" , srcLocStartLine = 201 , srcLocStartCol = 15 , srcLocEndLine = 201 , srcLocEndCol = 27 } ) ] } , bbCtxName = Just "result" } True As a quick fix: it may help to leverage the template haskell function $(lift ...) to get rid of this error message. CallStack (from HasCallStack): error, called at src/Clash/Cores/Xilinx/VIO/Internal/BlackBoxes.hs:299:22 in clash-cores-1.9.0-inplace:Clash.Cores.Xilinx.VIO.Internal.BlackBoxes constantProbeValues, called at src/Clash/Cores/Xilinx/VIO/Internal/BlackBoxes.hs:265:11 in clash-cores-1.9.0-inplace:Clash.Cores.Xilinx.VIO.Internal.BlackBoxes vioProbeTclBBTF, called at src/Clash/Cores/Xilinx/VIO/Internal/BlackBoxes.hs:239:5 in clash-cores-1.9.0-inplace:Clash.Cores.Xilinx.VIO.Internal.BlackBoxes vioProbeTclTF, called at src/Clash/Cores/Xilinx/VIO/Internal/BlackBoxes.hs:79:49 in clash-cores-1.9.0-inplace:Clash.Cores.Xilinx.VIO.Internal.BlackBoxes vioProbeBBF, called at <interactive>:2:1 in interactive:Ghci1
This:
makes
fail with: