Commit Graph

331 Commits

Author SHA1 Message Date
Zachary Snow c17d859988 tolerate escaped vendor comments within macros 2021-08-16 18:22:04 -06:00
Zachary Snow 581a7911de support for deferred immediate assertion statements 2021-08-16 17:50:23 -06:00
Zachary Snow 4ded2a598d apply implicit port directions to tasks and functions 2021-08-15 12:25:32 -07:00
Zachary Snow 30acc3e3f9 fix spacing of as-patterns for future GHC upgrade 2021-08-12 16:13:12 -06:00
Zachary Snow 306d71334b refactor sizing and truncation of integer literals
- use iverilog's -gstrict-expr-width throughout test suite
- add warnings for excess bits or padding zeroes in number literals
- add new --oversized-numbers parameter to retain support for unsized
  numbers wider than 32 bits
- localized use of oversized numbers to new truncate test suite which
  verifies the behavior of both modes, and compares against the known
  behavior of iverilog
2021-08-09 22:10:29 -06:00
Zachary Snow 5e5ddca444 fix broken two's complement logic 2021-08-08 21:36:36 -06:00
Zachary Snow 59d37468a4 fix internal interpretation of negative number literals
- detect and forbid non-positive size casts
- detect and forbid negative struct pattern literal indices
- avoid invalid constant folding of negative based literals
2021-08-07 21:11:35 -06:00
Zachary Snow 7e9fb3379c refactor internal frontend interface
- add unified frontend configuration record to make adding future
  options easier
- use ExceptT throughout, rather than using runExceptT at internal
  boundaries
2021-08-06 22:23:34 -06:00
Zachary Snow e0d425d976 default implicit output ports to logic 2021-07-27 17:20:09 -04:00
Zachary Snow 56c597e35e support explicitly typed struct patterns 2021-07-19 11:42:36 -04:00
Zachary Snow 836536c362 remove newly unneeded Ord instances 2021-07-18 20:19:39 -04:00
Zachary Snow dd951740e7 remove some dead code 2021-07-16 12:30:35 -04:00
Zachary Snow d6d3938d20 fix codegen for assertion property and sequence expressions
- updated representation and added codegen for sequence match items
- fix incorrect codegen for `iff` property expression
2021-07-16 09:54:05 -04:00
Zachary Snow bfd0cee0dc improved handling of procedural for loops
- convert loops with no or many incrementations
- restrict AST node to only contain traditional initializations
- parser elaborates for loop decls into a synthetic block
- decl list codegen is now specific to parameter decl lists
- update jump conversion special cases for new representation
- first experiments with bimapM
2021-07-14 15:50:12 -04:00
Zachary Snow ac548cacfc improved source position trace comments
- remove needless comments generated during interface conversion
- filter null statements even in verbose mode
- hoist trace comment statements if doing so would prevent the need to
  wrap a task or function body in a block
- add traces for global declarations
- add traces for parameter declaration lists
- add traces for module items within generate blocks
- avoid generating duplicate traces before declarations
2021-07-11 20:43:30 -04:00
Zachary Snow 103db6741f constant folding for size casts of number literals
- standardize number casting
- fix extension of casts of unsized literals to 32 bits
2021-07-10 12:38:55 -04:00
Zachary Snow 3eefd03c8d additional declaration parsing errors
- general refactoring in decl parsing
- restrict charge strength to trireg
- require const vars to be initialized
- forbid const net declarations
- disallow run-on declarations in packages and classes
2021-07-09 15:41:17 -04:00
Zachary Snow 183580632c restrict unbased unsized bit representation 2021-07-09 12:21:46 -04:00
Zachary Snow 1f03c64e9f convert Token to use record syntax 2021-07-08 18:54:48 -04:00
Zachary Snow 91e3ac0fb1 normalize trailing whitespace in escaped identifiers 2021-07-08 17:17:45 -04:00
Zachary Snow 9aa8b7033e fix handling of comments, quotes, and trailing whitespace in macro arguments 2021-07-08 16:30:02 -04:00
Zachary Snow 25fe57f75a fix lexing of whitespace in number literals
In places where an optional space was previously allowed, allow any
number of arbitrary whitespace characters, in line with the spec and
other tools.
2021-07-08 13:53:29 -04:00
Zachary Snow 190c2488cc remove unused typeclass derivations 2021-07-07 22:15:51 -04:00
Zachary Snow 2f860ff220 fix trivial hash collisions
Data.Hashable can produce hashes differing little in their upper bits if
only the last character of the string is changed. Because we were using
the upper bits of the hash in shortHash, this could lead to avoidable
hash collisions. This change includes minor simplification optimizations
which surfaced this collision in the existing struct_ident_scope test.
2021-07-07 20:14:11 -04:00
Zachary Snow a863321dd7 combine handling of concatenation LHSs 2021-07-06 21:20:44 -04:00
Zachary Snow 6381c3e050 minor type cleanup and fixes
- remove outdated flexible partial type eq and show instances
- properly disallow incomplete declarations
- disallow var after net type
- remove unused edge case in InterfaceT representation
2021-07-06 12:12:59 -04:00
Zachary Snow 5fd21ebfb0 improved parsing in declaration contexts
- support for additional assignment statements in loop initializations
- greatly improved error messaging in these contexts
- decl parser takes in the ending token; significant related refactoring
- pass through elaboration system tasks
- removed non-blocking assignment operator precedence hack
- preliminary nosim test suite for features unsupported by iverilog
2021-07-05 18:00:12 -04:00
Zachary Snow 6ee558b6b9 initial pass improving decl parsing error messages
- all decl tokens are given an accurate starting position
- key grammar productions return token positions to facilitate the above
- helpers for standardized parse error generation
- replaced annoying pattern-matching type argument restrictions
- moving away from dumping raw decl tokens in error messages
2021-07-03 13:23:33 -04:00
Zachary Snow ff0c7b026c properly distinguish nets and variables internally
- new net decl to replace net pseudo-type
- support nets with complex base types, including typenames
- support var declaration type prefix for all data types
- support var as lone type shorthand
- refactor AST representation of strengths
- traversal helpers for treating nets as variables
- use decl traversals where appropriate
2021-07-02 17:59:21 -04:00
Zachary Snow 9d7f917608 handle naming and scoping of unnamed generate blocks 2021-06-30 14:24:35 -04:00
Zachary Snow c7375d9016 fix pass-through codegen and parsing issues
- automatic pass-through test suite coverage
- fix codegen for interface based typedefs
- allow declaration of generic interface ports in module body
- fix codegen for comments within for loop initialization
- fix codegen of class param decls
2021-06-25 12:53:03 -06:00
Zachary Snow 3f20055cd6 proper support for static class methods 2021-06-24 22:15:46 -06:00
Zachary Snow a15b0c735f fix codegen for binop size cast 2021-06-21 15:49:23 -04:00
Zachary Snow dbbf71c65a revised struct pattern representation
- pattern keys now represented as TypeOrExpr
- support for simple integer struct pattern keys
2021-06-20 15:32:12 -04:00
Zachary Snow 108852060e prefix bare generate blocks with conditionals in codegen 2021-06-17 15:27:51 -04:00
Zachary Snow c0cb401abe fix handling of end labels
- disallow using end label alone on blocks
- improved parse error for mismatches
- add label checking for non-block constructs
- allow generate block to have label before begin
2021-06-15 17:47:32 -04:00
Zachary Snow a47afa96b8 don't force int types to be regs 2021-06-05 16:44:56 -04:00
Zachary Snow ecaaec9c00 minor codegen cleanup 2021-06-04 15:38:51 -04:00
Zachary Snow 13c84e4c7a refactor parameter binding resolution
- fix type/expr ambiguity for interface and class parameters
- check for parameter kind mismatch up front
- centralize key logic in ResolveBindings
2021-05-31 14:13:49 -04:00
Zachary Snow 0a65abd614 full support for package and class subroutine invocations 2021-05-29 22:34:03 -04:00
Zachary Snow c0282862ea error if procedural block has a decl after a stmt 2021-05-29 21:55:50 -04:00
Zachary Snow 280d3dc5a6 fix codegen for generic interface types 2021-05-25 22:10:33 -04:00
Zachary Snow 315733f293 output unpacked localparam types as typedefs 2021-05-24 23:06:07 -04:00
Zachary Snow 74a10a8e13 fix else branch association in verbose mode 2021-05-23 15:54:49 -04:00
Zachary Snow 801955ffab support for empty port connections 2021-05-21 14:08:12 -04:00
Zachary Snow 12c57ecc24 preprocessor cleanup and extended test coverage 2021-05-06 16:14:41 -04:00
Zachary Snow 2885e21cdd fix handling of preproc conditionals within macros
- preproc reads identifiers unconditionally
- drop leading whitespace for default macro args
- very minor preproc cleanup
2021-05-04 16:19:07 -04:00
Zachary Snow c59334ceb8 allow preproc idents to begin with macro arguments 2021-05-03 17:53:41 -04:00
Zachary Snow 10b30d7d1e detect infinite include loops 2021-05-01 21:12:00 -04:00
Zachary Snow 5cc4dce01f refactor positional binding checking and resolution 2021-04-30 14:10:09 -04:00