Releases: MikePopoloski/slang
v0.6: More language features
Highlights
Many large open source SystemVerilog codebases can now be fully elaborated by slang, such as the black-parrot project.
Language Support
- Partial support for
bind
directives - Support for modports, including enforcing all connection and port access rules
- Full support for DPI import and export directives (except for open array arguments)
- Support for the $assertcontrol family of system tasks
- Support for
iff
conditional event controls - Support for
wait
statements - Support for procedural assign / deassign / force / release statements
- Support for intra-assignment repeat event controls
- Implemented remaining support and rules for nets, net types, net delays, and user-defined net types
- Support for
ref
arguments - Support for all built-in methods on associative arrays
- Support for the built-in
std
package - Support for the std::process class
- Support for the std::semaphore class
- Enforce all rules around optional parenthesis when invoking subroutines
- Support for
with
array iterator expressions, including in constant expressions - Added the sum, product, sort, rsort, reverse, shuffle, min, max, unique, unique_index built-in array methods
- Added the find, find_index, find_first, find_first_index, find_last, find_last_index built-in array methods
- Support for
rand
andrandc
class properties - Added the randomize, pre_randomize, post_randomize, srandom, get_randstate, set_randstate built-in class methods
- Added the $urandom_range system function
- Added the rand_mode and constraint_mode built-in methods on classes and properties
- Full support for class constraint declarations and constraint blocks, including all class qualifiers and name lookup rules
- Full support for inline constraint blocks via
with
expressions onrandomize
calls, includinglocal::
name lookup - Support for left justifying integers when formatting with $sformatf
General Features
- Added a -G command line option which can override top-level module parameter values
- Added a --ast-json-scope option which controls which scopes are dumped to JSON
- Added -Wwidth-expand and -Wwidth-trunc (both off by default) which warn about implicit integral conversions that change size
- Added -Wimplicit-conv (on by default) which warns about implicit conversions between different structs / unions / enums
- Did a cleanup pass on warning text and grouping into categories. The default set of warnings should now consist only of warnings that have a very high likelihood of being a real problem. The -Wextra group is recommended but not enabled by default. -Wconversion is a new group that includes all implicit conversion-related warnings.
- Added a --ignore-unknown-modules flag which suppresses errors for instantiations of unknown modules
- The driver tool now prints errors to stderr instead of stdout
- Added --libdir and --libext flags to allow automatically searching for files to include in the build when encountering unknown modules
- Added a -v flag to include source files that are treated as "libraries", meaning modules in them are not automatically instantiated
Fixes
- Fixed many issues related to spurious semantic errors reported inside uninstantiated modules
- Fixed traversal of statement bodies via the ASTVisitor helper class
- Fixed incorrect errors reported for non-ANSI ports with separate I/O and type declarations
- Fixed many issues related to method prototype declarations
- Unpacked arrays now correctly support up to 2^31 elements
- Implicitly typed parameters that are assigned string literals are themselves treated as string literals in other expressions
- Fixed accidental truncation of bits that was occurring when connecting array ports across interface instance array instantiations
- Fixed type checking for compound assignment operators
- Fixed lookup of class names in packages
- Fixed many issues with class inheritance
- Fixed crash when visiting generic class specializations leads to more specializations being created
- Fixed merging of port types across separate I/O and type declarations, including in subroutine bodies
- Fixed
foreach
loops to work with strings and predefined integer types - Fixed
foreach
loops over class properties - Don't report an error when
void
casting a system subroutine that can be both a task and a function - Fixed a check for variable initializers that reference themselves in their own declaration
- Fixed lookup of subroutines when invoking them without parenthesis
- Port connections were missing in AST JSON output
- Fixed lookup of event objects in various statements
- Fixed visibility checks for members of generic classes
- Trailing '%' symbols in format strings are now a warning instead of an error
v0.5: Classes
Highlights
This release contains full elaboration support for classes, including generic classes, virtual classes, and interface classes.
Language Support
- Added full support for classes and all related features
- Added support for bitstream casting (thanks to @thingkingland )
- Added support for streaming operator expressions (thanks to @thingkingland )
- The parser now enforces language rules about which kinds of members are allowed in certain scopes
- Added support for elaboration system tasks ($warning, $error, etc)
- Added support for the $cast system task
- Added support for chandles
- Added support for events and event trigger statements
- Added support for the wait_order statement
- Finished remaining string and string-literal expressions and conversions
General Features
- Added -Wunused-def (off by default) which warns about unused module/interface/program definitions
- Added -Wno-top which warns if no top-level modules are found in a design
- Added -Wtask-ignored for system tasks that get skipped during constant evaluation
- Added -Wunsized-concat which warns for unsized integers used in concatenations
- Added a --top option which can be used to manually specify the top-level modules in a design
- The slang driver now reports the discovered top-level modules when elaborating unless --quiet is passed
Fixes
- slang will no longer try to automatically instantiate unused modules that have interface ports
- Cleaned up type checking that is performed in uninstantiated modules
- Fixed the build to work for macOS (thanks to @thingkingland )
- Fixed corner cases for assignment of unpacked arrays (thanks to @thingkingland )
- Fixed a bug that prevented empty port connections from working correctly
- Fixed a bug that prevented empty parameter assignments from working correctly
- Fixed bugs related to constant evaluation involving mixed signedness of expressions (thanks to @thingkingland )
- Fixed constant evaluation of shift operators with negative or unknown amounts (thanks to @thingkingland )
- Fixed detection of whether statements are in a loop when those statements are in a nested level of block hierarchy
- Fixed a preprocessor bug related to macro concatenation
v0.4: Polish and refactoring
Highlights
This release contains a lot of internal refactoring and cleanup, with the goals of correctly handling all corner cases as well as dramatically speeding up compilation time -- some projects and workloads may see up to a 10x speedup.
Language Support
- Support for intra-assignment timing controls
- Full support for dynamic arrays in type checking and constant expressions
- Full support for associative arrays in type checking and constant expressions
- Partial support for queues in type checking and constant expressions (still missing expressions involving the '$' magic value)
- Added $dimensions and $unpacked_dimensions system functions
- Added $printtimescale, $timeformat, and $system functions
- Added $ferror, $fgets, $fscanf, $sscanf, and $fread system functions
- Support for disable statements
- Support for unpacked array concatenations
- Support for min:typ:max expressions
- Support for disable-fork and wait-fork statements
- String literals can now correctly be implicitly assigned to unpacked arrays of bytes (thanks to @thingkingland )
General Features
- Reworked how definitions and instances are represented, both to make the code clearer as well as to allow caching of identical instances.
- Timing controls are now included in AST->JSON serialization (thanks to @Kuree ).
- Added initial support for generating simulation code for designs using LLVM. There's enough support here to simulate a basic "Hello World" example but not much else.
- To facilitate code generation, a mid-level IR representation was added to sit between the AST and LLVM. In the future this could grow to be useful to other consumers as well.
- Went through and removed experimental code analysis services from the repository and ported the CI build to GitHub actions, fixing the automated release and deployment pipeline in the process.
- Split slang into several component libraries to make it easier to link in only subsets of functionality.
- Added a bunch more API reference documentation.
- The remaining 3rd party dependencies have been vendored into the repo under the external/ folder. The conan package manager has been removed from the build process.
Fixes
- Fixed a bug where stringifying certain integer literals could produce garbage results.
- Improved parser error recovery in more scenarios.
- Fixed several crashes found by fuzz testing.
- Empty concatenations now correctly report an error.
- Fixed a faulty error reported when range-selecting a single bit from a big-endian vector.
- Fixed the type that is inferred for implicitly typed parameters.
- Rewrote lvalue handling in constant expressions to fix several corner cases.
- Fixed a crash in the preprocessor involving a rare case of macro replacing a token that then becomes another macro.
- Fixed parsing of cycle delays.
- Fixed ANSI color output on Windows terminals.
- Fixed variable lifetimes of task arguments.
- Packed dimensions on enum declarations were previously being ignored.
- Added additional error checking for various array creation rules.
- Fixed an infinite loop in the parser caused by unsupported statements (thanks to @thingkingland ).
- Fixed a bunch of issues with parsing new expressions.
- Fixed a bunch of issues with parsing clocking blocks.
- The error reported for non-standard character escape codes has been downgraded to a warning.
v0.3: Finish the preprocessor, fill in various missing features
Highlights
As of this release the preprocessor is 100% complete. This does not mean bug free (though I hope so!) but rather that all known features are finished, all known bugs are fixed, and there is 100% coverage in unit tests.
Language Support
- Initial support for gate instantiations in the parser and AST
- Tightened a bunch of parser rules for things like variable modifiers
- Support parsing strength and delay modifiers in continuous assignments
- Support creating implicit nets in all places allowed by the LRM
- Full support for pragma directives in the preprocessor
- $typename should now return the correct result for all types, as mandated by the LRM
- Support for the type() operator in all places type references are allowed
- Support for slicing packed and unpacked arrays across module array instantiations
- Implement all rules related to variable lifetimes (static vs automatic)
- Correctly prevent assignments to constants, nonblocking assignments to automatic variables
- Support const'() casts
- Support time literals, including all of the scaling and rounding rules
General Features
- Lots of work was done on the documentation, CI builds, and the website. Check it out!
- I removed most dependencies on 3rd party libraries that didn't do exactly what I wanted. This slims down the dependency tree and improved performance.
- A bunch of improvements were made to the AST->JSON serialization (thanks @Kuree )
- Printing of types in diagnostics was improved
- Added a general system for correcting typos. For example:
module m;
int someInt;
int foo = someIn;
endmodule
source:3:15: error: use of undeclared identifier 'someIn'; did you mean 'someInt'?
int foo = someIn;
^~~~~~
source:2:9: note: declared here
int someInt;
^
Fixes
- Lots of fixes to error recovery and error reporting in various cases
- Struct members that required looking up type names was previously broken and has now been fixed
- Fixed the check applied to enum initializers with unknown bits for 2-state base types
- Port connections were previously not being type checked; that has been fixed
- Fixed the result type of unary bitwise-not expressions
v0.2: More elaboration features and bugfixes
This release fills in a bunch of missing holes and corner cases and cleans up a bunch of bugs. The first beginnings of a more structured release process and documentation system are in place.
This is the first release as of which feature support is tracked in the documentation.
v0.1: First useful release
This is the first release of slang that is somewhat useful. The library supports lexing, preprocessing, parsing, type checking, and elaboration for a good portion of the language. The slang tool can be run on medium to large codebases and print out useful diagnostics.
There's still plenty of work to do but it seemed like a good idea to take a checkpoint.