v12.22026-11-20
Language Compatibility
* Parameters and other non-signal items declared in a program can now be referenced hierarchically from outside the program (including via defparam); only references to nets and variables declared in a program are errors, as specified by the LRM
* Parameters declared in generate regions are now overridable, since generate regions have no semantic meaning
export p:: now exports names that p itself wildcard-imported and exported from another package
* Unpacked byte arrays with no format specifier are now formatted as strings in elaboration system tasks
Improvements
* -Wunsized-concat no longer warns about a single-element concatenation used as the count of a replication, like {{4}{foo}}
* Statements in the items of a case statement with a constant case expression that are not selected are now treated as unevaluated, so they no longer report warnings like out of bounds selects, matching the behavior of untaken if branches and conditional operators (thanks to @likeamahoney)
* Added Compilation::DiagnosticCapture to the API, for capturing diagnostics issued while operating on an already-elaborated compilation (thanks to @povik)
* The UDP edge coverage check no longer takes exponential time for UDPs with many inputs, and its notes listing missing rows are now complete
* AST JSON is no longer written for designs with fatal errors, which could previously hang on large recursive hierarchies
Fixes
* Fixed a crash when constructing an AST with an invalid class method specifier
* Fixed randsequence case productions selecting the wrong production for items after one that lists more than one expression
* Fixed slicing of packed port connections across multidimensional instance arrays whose dimensions have different sizes, which assigned the wrong bits to each instance
* Fixed nested type operators like type(type(x)) resolving to the type reference itself instead of the type of x when used in a type comparison or case statement
* Fixed a crash when evaluating a foreach loop in a constant function whose trailing loop dimensions are skipped (e.g. foreach (arr[i,]))
* Fixed unsized literals whose high order bit is x or z (like 'hx3) being zero-extended instead of extended with x or z to the size of the expression containing them
* Fixed out of bounds bits of a part-select of a two-state vector reading as x instead of 0 in constant expressions
* Fixed replicated assignment patterns for structs (like '{3{-1}}) converting every replica to the types of the first members instead of each member's own type, which produced malformed values and could crash constant evaluation. These patterns are now expanded into simple assignment patterns in the AST
* Fixed an internal assertion when a subroutine with more than one statement contains an invalid statement that has nested blocks, such as a fork-join in a function; statements inside a disallowed fork block are now also checked for errors
* Fixed a bug where interfaces that contain a modport with export methods followed by another modport without export methods would lose track of their exports (thanks to @hankhsu1996)
* Fixed calls to functions with static variables being folded to a constant when evaluated speculatively (e.g. as a select index), which gave incorrect results for functions that modify that state
* Fixed the implicit return value variable of static functions to have static lifetime
* Fixed several internal assertions related to invalid syntax and to assignment patterns on the left-hand side of assignments
* Fixed type parameters of class specializations and instances that default to a type declared inline (like an enum or struct) being treated as different types when the default is used in more than one place
* Fixed an internal assertion on a function call cycle through the function's return type
* Fixed false "default value must exactly match" errors for out-of-block method definitions whose default argument values need conversion to the argument type
* Fixed left-justified %- format fields of hex, octal, and binary values printing a different number, and of strings padding on the wrong side (thanks to @hankhsu1996)
* Fixed pattern variables declared in conditional expressions being rejected in constant functions as not declared locally
* Fixed this being disallowed in enum value initializers inside class methods
* Fixed values of enums declared in an interface not being usable in that interface's modport expressions
* Fixed an internal assertion when a scoped name (like p::a or C::b) or a member access refers to a symbol from within its own type; this is now reported as a recursive definition
* Fixed an internal assertion when a UDP table row has no input fields
* The prebuilt Windows release binary is now built in the Release configuration; it was previously an unoptimized Debug build (thanks to @dirk-seynhaeve)
$pastgclk and $future_gclk now return the type of their argument
* Nested modules are no longer implicitly instantiated when they are instantiated in generate blocks or other nested modules
* Fixed parsing precedence of the conditional operator relative to the -> and <-> implication operators
* Fixed constant evaluation of inside ranges with $ bounds outside of parameter initializers
Fixed index locator methods (findindex, etc) returning element offsets instead of actual indices for fixed-size arrays whose range doesn't start at zero or is descending
* Fixed %0t not being treated as a minimum width format specifier
* Fixed the string hextoa, octtoa, and bintoa methods to print two's complement bits for negative values instead of a sign
* Fixed %p formatting of empty associative arrays and untagged unpacked unions
* Fixed associative array pattern default values not being converted to the element type
* Fixed constant evaluation of if-else-if chains to stop at the first matching condition for plain and priority if statements
* Fixed negative repeat counts in constant evaluation; they are now treated as zero
* Fixed packed union member reads in constant evaluation not converting to the member's signedness and state
* Fixed real absolute tolerances for integral values being rounded instead of truncated
* Fixed checker formal default values being bound in the wrong scope when filled by a wildcard connection
* Fixed library-specific config cell rules that don't name a use cell (like cell lib.foo use #(...))
* Fixed spurious "minimum is greater than maximum" errors for sequence ranges whose minimum fails to evaluate
* Fixed recursive macros passed as arguments from their own body overflowing the stack
* Fixed an overflow when computing the width of a replication with very large operands
Fixed glob patterns with a trailing double star (like foo) failing to match an empty tail
* Fixed port direction tokens on interface ports being dropped from the syntax tree
* Fixed a use-after-free when visiting nested generic classes during elaboration (thanks to @vorsicht80)
* Fixed ICE when evaluating a queue delete call with a non-constant index
* Fixed ICE in analysis of procedural checker instances with unconnected output ports
* Fixed ICEs on a variety of invalid code, including: case generate conditions with an invalid type reference, invalid primitive instance delays, parenthesized sequence and property operators in event expressions, unnamed DPI arguments, enums with non-integral base types, randc methods, unique / priority if statements matching nothing in constant functions, let instances with mismatched typed arguments, range items in uniqueness constraints, randsequence rules with a weight block and no productions, explicit imports matching implicit generate block names, and invalid upward virtual interface name usage
Tools & Bindings
slang-tidy
v12.12026-10-25
本次更新以缺陷修复为主,集中在类型检查、常量求值与实例缓存三块。
类型检查:case 各子项此前未与表达式本身做类型比对,不兼容现在会正确报错;dist 表达式结果类型由 void 改为 logic,与 inside 运算符对齐;$sdf_annotate 允许可选参数留空,字符串参数也全部纳入检查。
常量求值:修复 repeat 计数为 real 时触发的内部编译错误;$sformatf 接受 byte 非压缩数组,输出不再夹带空字符;字符串 atoi 系列、atoreal、realtoa 的解析与输出规则收紧;带 X/Z 位的整数转字符串、宽整数的除法取余与浮点舍入、多位整数字面量截断等边界问题一并修正。
另外修了实例缓存错误共享实例体(0.0 与 -0.0、不同宽度同值参数等情形)、内联 enum 挂错作用域、struct 成员默认值未生效、interface 端口引用被误判为层次引用,以及多线程计算行偏移时的竞态。
v12.02026-09-29
本次更新重点在语言兼容与诊断能力:新增 --allow-cross-auto-bin-max 以兼容(前 IEEE)SystemVerilog 3.1a;未显式声明端口类型的 ANSI 输入端口现按 LRM 默认为 net,旧的按变量推断行为可由 --infer-input-ports-as-vars 恢复。类内 covergroup 允许引用后声明的成员,实例数组端口连接也放宽到所有整数类型切片,均与主流商业工具对齐。功能上新增外部 diagnostic waivers 文件,以及 -Wmissing-else-clause、-Wimplicit-net、-Wreal-case-eq 三个警告;--libdir 库搜索支持多线程并行解析,--Mall/--Minclude 生成的依赖文件纳入尖括号系统头。破坏性变更需留意:构建要求 CMake 3.28,fmtlib 改为完全私有依赖,第三方库须显式指定 SLANGUSESYSTEM_* 才用系统版本,pyslang 绑定迁移到 nanobind。另修复了属性过多导致的崩溃等问题。
v11.02026-05-15
slang 新版发布,主攻两件事:兼容更多商业工具里的非标准写法,以及补齐 lint 与静态分析告警。
兼容性方面,新增 --allow-virtual-iface-with-override、--allow-array-concat-assign-pattern、--relax-string-conversions 等开关;支持字符串用 + 拼接、$deposit 系统任务、coverage cross 指向另一个 cross、inside 单元素省略花括号、foreach 引用含函数调用等写法,均会以 -Wnonstandard-* 系列告警标出。一批原本直接报错的场景改为可降级为警告:std::randomize 参数、块外方法限定符、extern 方法缺实现、for 循环缺初始化、类作用域内包导入、重复赋值、字面前导下划线等,各对应新开告警项。嵌套块注释从报错降为默认警告,VCS 兼容模式下关闭。无修饰的 task/function 调用现会沿层次向上查找声明,与主流工具一致。
此外,性能与内存占用均有改善,还带来若干易用性改进和大量 bug 修复。
v10.02026-01-15
本次更新重点补齐语义诊断:断言局部变量按 LRM 实现了 definite-assignment 流分析,未赋值即使用会被报出;package 的显式 export 现在要求配套 import;ANSI 端口与参数端口声明、covergroup 形参的 const 属性、checker 参数与过程的引用限制也逐条校正。原先强制 covergroup 表达式为常量的检查被移除——实现本身有 bug,其他工具也没实现,且 LRM 定义含糊。
命令行侧新增 -Wcase-none、-Wunnamed-generate、-Wvacuous-cover、-Wnested-solve-before 等告警,以及 --cst-json、--depfile-sort、--depfile-trim、--disable-local-includes 等选项;--compat 可直接写 all 一次性开启全部兼容开关,--std 支持 1364-2005,以纯 Verilog 模式解析。诊断列号默认改为按 UTF-8 与制表符宽度计算,--diag-column-unit=byte 可恢复旧行为。
破坏性变更一处:AST 序列化中 typedef 与枚举类型改为输出指向原定义的链接,不再每次使用都重复展开类型。
v9.12025-09-25
本次更新以修复为主:always_comb 块中带赋值延迟的非阻塞赋值现可正常接受;修正了枚举基类型校验、模块端口列表中逗号分隔类型参数的解析,以及数据流分析里嵌套 for 循环步数统计的错误。AST 序列化现在会遵循 --disable-instance-caching,层级实例化与递归函数的无限递归检测也真正生效,若干崩溃问题(模式变量常量表达式、宏展开中的反引号拼接、pragma 指令报错过多时的词法分析器崩溃等)一并解决。此外还消除了未实例化 generate 块内断言误报、派生类使用基类成员的 "used before declared" 误报,以及 dist 约束中 rand 变量与 $ 的检查问题。工具方面,slang-tidy 修复了多个 checker 崩溃,并让 --dump-config 正常工作。
v9.02025-07-31
本次更新主要有两块:一是引入实例缓存,大幅加快 elaboration 阶段的性能;二是新增数据流分析框架,让 lint 能力更进一步。
语言支持方面,检查器与断言现在支持时钟流、时钟分辨率和时钟推断规则,非法使用时钟会给出相应报错,采样值系统函数同样会做时钟分辨率;同时补上了时钟块内可声明哪些 sequence/property、以及从 checker 过程中动态访问变量的规则。
新增的分析通道在 elaboration 之后做额外检查,--disable-analysis 可关闭,除非遇到 bug 否则不必动它。命令行也多了 --diag-abs-paths,诊断信息改用绝对路径输出;另新增 -Wmissing-return、-Wincomplete-return、-Wcase-unreachable、-Wcase-too-complex、-Wcase-incomplete、-Wcase-redundant-default、-Wcase-wildcard-2state 等一批告警,覆盖返回值缺失、case 分支不可达或覆盖不全等问题,--max-case-analysis-steps 可调整分析上限。内部断言或异常发生时还可通过 SLANGUSECPPTRACE 启用 cpptrace 获取更好的回溯。
破坏性变更需要注意:AST 序列化不再输出未实例化的 scope;Driver::reportCompilation 拆出 Driver::reportDiagnostics,中间可插入新的 Driver::runAnalysis,想要一站式调用则用 Driver::runFullCompilation;调试宏改名为 SLANG_DEBUG,不再依赖 NDEBUG,避免作为库引入时的 ODR 冲突;警告控制选项的优先级规则重排,命令行组合较特殊时启用的告警可能变化;net 与 variable driver 的追踪移到分析层,原先依赖该 AST API 的代码需改在分析后获取;--strict-driver-checking 已移除,把 --max-loop-analysis-steps 设为 0 即可恢复原行为。
v8.12025-05-24
This is a point release to get some bug fixes out.
Fixes
* The restriction on interface instances targeted by defparams not being allowed with virtual interfaces was also erroneously applied to interface port connections
* Fixed a null pointer crash in slang-tidy (thanks to @rhanqtl)
* Fixed a bug that could cause infinite recursion when instantiating bind targets that force elaboration due to wildcard package imports
* Fixed the handling of disable region directives declared in block comments (as opposed to single line comments which were working fine)
* Fixed a spurious error when cycle delays are used in an uninstantiated context that does not have default clocking specified
* Fixed an issue with how checker formal ports are looked up from within checker instances
* Fixed ICE with conditional statements that have pattern matching along with a named statement block
* Recursive typedef declarations now properly report an error instead of crashing
* Fixed several issues that led to invalid builds on Linux with LTO enabled
* Fixed a case where no diagnostic would be issued when incorrectly referring to an instance array element from within an expression
* Fixed SyntaxPrinter printing of directives that have skipped leading trivia
* Fixed rewiring of interface array port connections with opposite declared range directions
* Fixed a bug in the constant evaluation of division between two positive signed integers; the sign flag was lost and the result was always treated as unsigned
* Fixed JSON serialization of definition symbol attributes
* The --obfuscate-ids option has been fixed to not generate invalid SystemVerilog names that start with a digit (thanks to @Sustrak)
* Fixed slang-tidy's module instantiation prefix check to use the correct diagnostic (thanks to @corco)
Fixed $staticasserts triggering in uninstantiated contexts (thanks to @AndrewNolte)
* Fixed --allow-use-before-declare to apply to wildcard port connection expressions
v8.02025-02-06
语言支持收紧:类作用域的 randomize 约束块不再允许访问 protected 成员;新增 net 别名重复与自指检查;虚拟接口补齐三条规则,即不得层级引用接口外对象、不得包含接口端口,赋值给虚拟接口的实例也不能再套用实例配置规则。最低环境要求升至 Xcode 16 与 Clang 17。
新增十余条警告,主力是 case 语句一族:类型不匹配、缺少 default、条目超出条件范围、枚举值遗漏、重复项、通配位重叠等;另有 -Wparentheses 组专抓运算优先级类笔误,以及 -Wudp-coverage、-Wpacked-array-conv。诊断信息现在可输出为 JSON;初步引入实例缓存以加速 elaboration,暂由 --disable-instance-caching 关闭,待多驱动错误报告
v7.02024-09-26
本次版本补齐了对 IEEE 1800-2023 版 SystemVerilog LRM 的支持。
语言层面修正若干行为:打包数组的选择表达式按规范一律返回无符号类型;clocking 偏斜延时必须是常量;静态方法禁止带 override 修饰;specify 块中非法的路径条件报错可通过 -Wspecify-condition-expr 降级,以兼容其他工具。同时补齐 LRM 附录 D 的可选系统任务/函数($countdrivers、$save、$restart、$showvars 等)与附录 E 的可选编译指令(` defaultdecaytime `、 delaymode ` 等),并开始强制执行序列/属性非退化、bind 中名字解析等此前放宽的规则。
2023 版新增特性也一并落地:约束表达式与随机变量支持 real 类型,dist 可写 default,solve-before 可用 array.size(),约束块可加 override 修饰,covergroup 可继承并新增 crossretainautobins、realinterval 选项,另有 $timeunit、$timeprecision、$stacktrace 等新系统函数。
通用功能方面新增一批警告项:-Wunsigned-arith-shift 抓无符号算术右移,-Wstatic-init-order/-Wstatic-init-value 抓依赖未初始化值的静态初始化,-Wfloat-int-conv、-Wfloat-narrow 等覆盖浮点与整数、不同宽度浮点间的隐式转换,以及 -Wunused-import 等未使用项检查。
对使用者而言,主要影响是此前能过的代码现在可能报错或告警,建议关注 CI 中新增的告警项,必要时用 -Wno-` 关闭。