-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Verify blackbox context when rendering includes
Fixes #1945
- Loading branch information
1 parent
10af0ef
commit e361a8b
Showing
4 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
FIXED: valid field of TemplateFunction isn't checked for includes [#1945](https://github.com/clash-lang/clash-compiler/issues/1945) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{-# LANGUAGE OverloadedStrings #-} | ||
module T1945 where | ||
|
||
import Clash.Annotations.Primitive (Primitive(..), HDL(..), hasBlackBox) | ||
import Clash.Netlist.Types (TemplateFunction (..)) | ||
import Clash.Prelude | ||
|
||
import Data.String.Interpolate (i) | ||
import Data.String.Interpolate.Util (unindent) | ||
|
||
bb :: a -> a | ||
bb x = x | ||
{-# NOINLINE bb #-} | ||
{-# ANN bb hasBlackBox #-} | ||
{-# ANN bb (InlinePrimitive [VHDL,Verilog,SystemVerilog] $ unindent [i| | ||
[ { "BlackBox" : | ||
{ "name" : "T1945.bb", | ||
"kind" : "Expression", | ||
"template": "~ARG[0]", | ||
"includes" : | ||
[ { "extension" : "bin" | ||
, "name" : "mem" | ||
, "format" : "Haskell" | ||
, "templateFunction" : "T1945.tf"} | ||
|
||
] | ||
} | ||
} | ||
] | ||
|]) #-} | ||
|
||
tf :: TemplateFunction | ||
tf = TemplateFunction used valid (const (pure "QQ")) | ||
where | ||
used = [0] | ||
valid = const False | ||
|
||
topEntity :: Bool -> Bool | ||
topEntity = bb |