remove duplicate always_comb sensitivities

This commit is contained in:
Zachary Snow 2025-05-18 17:04:21 -04:00
parent d30c7e7f4e
commit 380c2b978a
4 changed files with 12 additions and 2 deletions

View File

@ -1,3 +1,10 @@
## Unreleased
### Other Enhancements
* `always_comb` blocks with sensitivities inherited from called functions or
tasks are no longer converted with duplicate expressions
## v0.0.13
### New Features

View File

@ -15,6 +15,7 @@ module Convert.AlwaysKW (convert) where
import Control.Monad (when, zipWithM, (>=>))
import Control.Monad.State.Strict
import Control.Monad.Writer.Strict
import Data.List (nub)
import Data.Maybe (fromMaybe, mapMaybe)
import Data.Monoid (Any(Any), getAny)
@ -234,7 +235,7 @@ findNonLocals item = do
_ <- scoper item
(anys, exprs) <- lift get
lift $ put prev
let nonLocals = mapMaybe (longestStaticPrefix scopes) exprs
let nonLocals = mapMaybe (longestStaticPrefix scopes) $ nub exprs
return (getAny anys, nonLocals)
triggerIdent :: Identifier

View File

@ -0,0 +1,2 @@
affirm always @(never or x1 or _sv2v_0)
affirm always @(never or x2 or _sv2v_0)

View File

@ -3,7 +3,7 @@ reg never;
reg x``num, y``num, z``num; \
function automatic t``num; \
input inp; \
t``num = x``num; \
t``num = x``num + x``num; \
endfunction \
always``sense begin \
y``num = 0; \