Commit Graph

430 Commits

Author SHA1 Message Date
Zachary Snow 3c08767b63 redesigned preprocessor and lexer 2020-02-06 23:33:13 -05:00
Zachary Snow 2dcd35ade7 support typedefs with unpacked dimensions 2020-02-02 21:40:43 -05:00
Zachary Snow a402a73477 alias macromodule to module 2020-02-01 16:45:33 -05:00
Zachary Snow 1a9068409e forbid illegal macro names 2020-02-01 16:42:25 -05:00
Zachary Snow 9694799a23 more consistent procedural assignment support 2020-02-01 15:52:52 -05:00
Zachary Snow 610d9abacf support for gates with delays 2020-01-31 20:24:37 -05:00
Zachary Snow 6e4a19d00b flatten generate blocks with one item 2020-01-31 19:43:34 -05:00
Zachary Snow dd0eb5981d added source trace comments
- Trace comments cover module items, decls, and stmts
- Added pseudo-lexer to Alex parser for monadic Position production
- Added Position to every DeclToken
- Removed Comment PackageItem
- Added CommentStmt and CommentDecl
- Fixed traversal skipping outer MIAttr ModuleItems
- Generally cleaned up Parser modules
2020-01-30 22:17:17 -05:00
Zachary Snow 9f180f91e5 improve `line error message 2020-01-27 19:23:36 -05:00
Zachary Snow ad98c14547 fix handling of macros at EOF (resolves #62) 2020-01-27 19:18:58 -05:00
Zachary Snow 17e17ebd7f fix struct array pattern conversion (resolves #60) 2020-01-20 17:26:03 -08:00
Zachary Snow cf4c2a5491 expanded support for macros in preprocessor directives 2020-01-14 23:19:39 -05:00
Zachary Snow 6f0fa58ace simplify struct LHS handling 2020-01-14 00:23:16 -05:00
Zachary Snow e62074c756 type operator full select support 2020-01-11 22:52:12 -05:00
Zachary Snow 22d6ba4927 support evaluating functions as statements 2020-01-11 21:06:09 -05:00
Zachary Snow 2bd24b6086 expand type operator support 2020-01-11 20:35:51 -05:00
Zachary Snow b58248fc2c support type operator on simple expressions 2020-01-11 16:22:07 -05:00
Zachary Snow 82217ec05c updated lifetime representation; struct packers use automatic 2019-12-22 12:01:05 -05:00
Zachary Snow 7ea5b60d0b support for inside case statements 2019-12-21 20:41:19 -05:00
Zachary Snow ba79b17bd9 pragma and line directive validation 2019-12-09 21:45:11 -05:00
Zachary Snow 7f2fe54b11 fix jump statement conversion 2019-12-09 21:17:01 -05:00
Zachary Snow fb5fd39388 support for inside expression ranges and wildcards 2019-12-08 17:36:25 -05:00
Zachary Snow 96fe986b2d cleanup case representation 2019-12-01 23:25:33 -05:00
Zachary Snow 92d827f3a5 preserve else block association, with timings 2019-11-20 20:44:09 -05:00
Zachary Snow 35a0587d2c preserve else block association (resolved #56) 2019-11-20 20:18:56 -05:00
Zachary Snow c1f027e11a $readmemh/$readmemb imply reg (resolves #57) 2019-11-19 23:41:59 -05:00
Zachary Snow 58ad1feab1 allow reading from stdin 2019-11-19 23:29:19 -05:00
Zachary Snow 95299c6f56 conversion of structs with multi-dim fields (resolves #53) 2019-11-19 23:15:25 -05:00
Zachary Snow 49e4f7872d conversion for always_latch (resolves #54) 2019-11-18 19:26:54 -05:00
Zachary Snow eebe41427e language support for final blocks 2019-10-31 20:39:11 -04:00
Zachary Snow eeb2d809fd cleanup interface conversion 2019-10-20 22:06:10 -04:00
Zachary Snow c936b39bd2 use system functions for signedness casts 2019-10-20 16:18:18 -04:00
Zachary Snow 06411d70f1 support converting interfaces with parameters 2019-10-20 15:58:37 -04:00
Zachary Snow 5843ef3879 better error messaging for missing interfaces 2019-10-20 14:53:37 -04:00
Zachary Snow 3597f4a6be support for methods (no conversion) and interface TFs 2019-10-19 16:22:46 -04:00
Zachary Snow 39f0e9b40d minor perf optimization 2019-10-19 14:38:28 -04:00
Zachary Snow 336b180d74 lexer handles carriage returns (closes #51) 2019-10-19 13:27:29 -04:00
Zachary Snow cf0e182e65 convert unpacked structs as though packed
- also expands struct literals containing repeat expressions
2019-10-14 22:01:55 -04:00
Zachary Snow 8e8d44f421 allow array struct fields 2019-10-13 23:59:36 -04:00
Zachary Snow a1cd6941ae apply patterns to substructures 2019-10-13 23:37:43 -04:00
Zachary Snow de581ecaf5 initial support for types in struct patterns 2019-10-13 19:01:42 -04:00
Zachary Snow 3979d294eb consistent size casting behavior
- also adds $clog2 localparam substitution to Simplify
2019-10-12 11:40:36 -04:00
Zachary Snow 79f9d21fe7 leave non-data-declarations at the end of modules 2019-10-12 11:18:10 -04:00
Zachary Snow c722e931fe allow time delay values 2019-10-11 22:56:16 -04:00
Zachary Snow 1e35ba269d allow repeat shorthand in patterns 2019-10-11 22:54:21 -04:00
Zachary Snow fea5ff44eb coalesce tokens across nested macros 2019-10-11 22:53:08 -04:00
Zachary Snow 37355920e0 cleaner AST output 2019-10-11 22:38:47 -04:00
Zachary Snow d86f8535a0 support for begin_keywords directive 2019-10-11 19:32:10 -04:00
Zachary Snow 3d3359d35a apply BlockDecl conversions to tasks and functions 2019-10-11 19:31:41 -04:00
Zachary Snow 5ef24d2d94 omit empty subroutine args list 2019-10-11 19:30:45 -04:00
Zachary Snow b660cfbd4e allow tabs in preprocessor directives 2019-10-10 22:10:59 -04:00
Zachary Snow 167c65db11 pass through downstream compiler directives 2019-10-10 20:53:49 -04:00
Zachary Snow 6d79e0b491 updated number literals 2019-10-10 19:01:09 -04:00
Zachary Snow 149d16d8fc add support for `line directive 2019-10-10 19:00:49 -04:00
Zachary Snow e23d68a652 discard const keyword 2019-10-09 22:16:58 -04:00
Zachary Snow 910282fbf7 allow parens around senses 2019-10-09 22:16:57 -04:00
Zachary Snow d2976170f3 allow extraneous semicolons after package items 2019-10-09 22:16:38 -04:00
Zachary Snow 9880885412 Revert "allow escaped newline in macro arguments"
This reverts commit ba7fbd5506.
2019-10-09 00:36:23 -04:00
Zachary Snow 8ae89a7bd4 support and convert jumps: break, continue, and return 2019-10-08 23:50:26 -04:00
Zachary Snow 08c38e6193 support time literals as expressions 2019-10-06 21:21:58 -04:00
Zachary Snow 1a394cff9c support mintypmax expressions 2019-10-06 16:18:15 -04:00
Zachary Snow f0368714e1 support generate for without explicit block 2019-10-06 15:36:29 -04:00
Zachary Snow a1735ffef7 fix lexing identifiers and numbers across macro boundaries 2019-10-06 15:16:48 -04:00
Zachary Snow ba7fbd5506 allow escaped newline in macro arguments 2019-10-03 23:29:49 -04:00
Zachary Snow 9524f0028b support identifier delay values 2019-10-03 20:38:38 -04:00
Zachary Snow 77dd1011e3 support multiple assignments in one `assign` 2019-10-03 19:37:42 -04:00
Zachary Snow 89de289bec simplify numeric negation 2019-10-02 23:56:34 -04:00
Zachary Snow 2b84bdb7e2 support for type param without parameter keyword 2019-10-01 22:02:30 -04:00
Zachary Snow 3807ab6736 handle adding packed dimensions to byte, shortint, and longint 2019-10-01 00:03:07 -04:00
Zachary Snow ceb384f680 support multiline strings 2019-09-30 23:53:18 -04:00
Zachary Snow c6eedb9f26 pass through named events 2019-09-30 23:22:05 -04:00
Zachary Snow e2570303d0 reject negative repeat counts 2019-09-30 23:11:16 -04:00
Zachary Snow b7959c7aa2 support for statement labels and basic fork-join 2019-09-30 23:03:55 -04:00
Zachary Snow d57c967090 added partial support for implicitly sized arrays 2019-09-28 16:57:36 -04:00
Zachary Snow 454afa97a3 major array pack and flatten update (closes #48)
- dimensions flattening conversion only flattens packed dimensions
- conversion for packing arrays when necessary (preserves memories)
- added coverage for array with multiple packed dimensions
- test runner no longer forbids multi-dim accesses after conversion
- Decl and subordinate types derive Ord
2019-09-26 23:11:59 -04:00
Zachary Snow 087841a21f fix generate default case printing 2019-09-26 00:08:20 -04:00
Zachary Snow dcca974fbc support size casts with complex size expressions 2019-09-25 23:59:47 -04:00
Zachary Snow 1584f39045 allow typename resolution of non-vector types 2019-09-25 23:45:18 -04:00
Zachary Snow 111e04f86e remove extraneous explicit unsigned in params (resolves #47) 2019-09-25 19:42:31 -04:00
Zachary Snow 76663c78a0 fix typename decl asgn lookahead (resolves #49) 2019-09-25 19:34:42 -04:00
Zachary Snow c7f51209df remove extraneous explicit unsigned (resolves #45) 2019-09-24 23:35:06 -04:00
Zachary Snow 0262a3d3c4 struct conversion visits non-asgn LHSs 2019-09-24 22:09:22 -04:00
Zachary Snow f4181aba76 added pass-through support for strings 2019-09-24 22:09:18 -04:00
Zachary Snow bce438c841 default case can be anywhere in case block 2019-09-24 22:09:08 -04:00
Zachary Snow 2d8e6bddd3 parser rejects function input decls with bad directions 2019-09-22 23:29:02 -04:00
Zachary Snow 2d81c6470f prevent genvar conflict without changing scope tree 2019-09-21 14:14:55 -04:00
Zachary Snow aa294eaad0 genvars declared in for loops retain scoping (resolves #46) 2019-09-21 13:36:33 -04:00
Zachary Snow 142df3b5f6 fixed handling of unbased unsized literals (resolves #43) 2019-09-18 23:39:09 -04:00
Zachary Snow ba4cf805ff preliminary conversion for size casts 2019-09-18 23:39:09 -04:00
Zachary Snow df3620d3a0 fix premature logic to wire conversion 2019-09-18 23:39:09 -04:00
Zachary Snow 82218848fc allow post inc/dec as first stmt in a block 2019-09-18 23:39:09 -04:00
Henner Zeller e2f044ec4a Place <file>:<line>:<col> first in an error message
This is the same as most compilers (e.g. gcc and clang) but also
verilog tools (e.g. yosys) output error mesasge in a standardized form.

This form can immediately be parsed by IDE tools that can jumping
through a list of error messages, placing the cursor at the given
file position.

This change simply re-arranges the error message printing to conform to that
standard.

Signed-off-by: Henner Zeller <h.zeller@acm.org>
2019-09-18 19:16:37 -04:00
Zachary Snow 191922e2a7 plain typedef forward declaration 2019-09-17 20:44:50 -04:00
Zachary Snow d84a4f7bb0 additional generate block simplification 2019-09-17 20:30:33 -04:00
Zachary Snow 2d034dcb73 basic support for elaboration system tasks 2019-09-17 20:30:17 -04:00
Zachary Snow 1078603bfd support complex constant expression size casts 2019-09-17 19:49:38 -04:00
Zachary Snow 512d4b1a7f support module "list of param assignments" shorthand 2019-09-17 19:48:08 -04:00
Zachary Snow bdafb60dec lexical and parse errors print to stderr 2019-09-17 19:34:56 -04:00
Zachary Snow 7267f94b0b allow signing on net types (closes #40) 2019-09-16 19:50:30 -04:00
Zachary Snow 5d80c83092 support for module attributes (resolves #39) 2019-09-15 23:17:14 -04:00
Zachary Snow bb2a8febea module item traversals visit items with attributes 2019-09-15 16:56:55 -04:00
Zachary Snow 77b9d2f085 support and conversion for foreach 2019-09-15 16:32:19 -04:00
Zachary Snow 7f701cd112 fixed dimension shorthand diretion and relevant tests 2019-09-15 16:30:53 -04:00
Zachary Snow 2ca8a022ad support and conversion for -> and <-> 2019-09-15 13:55:40 -04:00
Zachary Snow c0e38f793d updated CLI (backwards compatible) 2019-09-15 10:31:50 -04:00
Zachary Snow 2a51d20f11 package item nesting resolves across and throughout files 2019-09-14 21:00:40 -04:00
Zachary Snow c5f7f2cc5e typedef conversion gracefully skips yet-unknown typenames 2019-09-14 20:59:41 -04:00
Zachary Snow e27d6920a7 conversion for array query system functions (resolves #37) 2019-09-14 16:46:51 -04:00
Zachary Snow f5d6683422 generalization of array dimension(s) system functions 2019-09-14 12:38:26 -04:00
Zachary Snow 10feedb1af use the Unique package in a few places 2019-09-11 23:01:34 -04:00
Zachary Snow a14d078230 substitution conversion for size casts (closes #27) 2019-09-11 22:52:01 -04:00
Zachary Snow 6ddf782383 drop timeunit and timescale (closes #31) 2019-09-11 21:44:57 -04:00
Zachary Snow 295ac64929 package item conversions preserve ordering (resolves #36) 2019-09-11 21:16:55 -04:00
Zachary Snow dd3a7e687c EmptyArgs conversion skips global functions until nested 2019-09-11 21:04:57 +02:00
Zachary Snow 4d0d652c86 enum preserves alias base type dimensions 2019-09-11 20:45:41 +02:00
Zachary Snow bd2efb4201 support struct patterns with partial defaults (resolves #35) 2019-09-11 19:32:24 +02:00
Zachary Snow 46242aac5d fix combined array declarations (resolves #34) 2019-09-11 19:32:12 +02:00
Zachary Snow a0068f60f2 remove old unused grammar rules 2019-09-11 19:32:04 +02:00
Zachary Snow f8a2bcbea0 conversion for function void (resolves #32) 2019-09-11 19:31:50 +02:00
Zachary Snow 6271e16b68 functional parameter type conversion 2019-09-11 17:58:03 +02:00
Zachary Snow 4de585ec0f initial parameter type conversion 2019-09-11 09:27:18 +02:00
Zachary Snow 8df1e67faf typedef traversal only marks interfaces as such 2019-09-09 18:44:45 +02:00
Zachary Snow 677d11091b added monadic file traversal helper 2019-09-09 18:44:04 +02:00
Zachary Snow 66989b0446 language support for parameter type bindings 2019-09-09 07:38:14 +02:00
Zachary Snow d11e898edb Added ParamType decl; combined parameter and localparam under Param 2019-09-09 07:34:43 +02:00
Zachary Snow 9cc211d51e fix non-vector enum base types (closes #29) 2019-09-05 00:34:56 -04:00
Zachary Snow ad0db916cc support typedef forward declarations 2019-09-04 23:41:24 -04:00
Zachary Snow 1a6e0ce9df added support for inside expressions (closes #28) 2019-09-04 21:36:50 -04:00
Zachary Snow 33bea9e694 added remaining SV keywords 2019-09-04 21:02:02 -04:00
Zachary Snow baaffd732d remove unused import 2019-09-04 21:01:27 -04:00
Zachary Snow 41bba1b2f2 generate localparams for all package enums (closes #26) 2019-09-04 20:59:41 -04:00
Zachary Snow 92feef8759 standardized, shorter hash generation 2019-09-03 23:54:47 -04:00
Zachary Snow af4711a8cf preliminary stream conversion 2019-09-03 23:36:29 -04:00
Zachary Snow 7340464364 ParseDecl edge case 2019-09-02 22:57:57 -04:00
Zachary Snow 97fda59c51 convert needless patterns to concats 2019-09-02 22:35:36 -04:00
Zachary Snow 1f7c70dfe1 language support for LHS streaming operators 2019-09-02 20:46:35 -04:00
Zachary Snow d6c932d0fc conversion for block decls with asignments 2019-09-02 13:08:41 -04:00
Zachary Snow 04de45b08b language support for streaming operators 2019-09-01 18:42:16 -04:00
Zachary Snow 638adb3538 fixed ParseDecl mischaracterizing block decl as stmt 2019-09-01 18:40:24 -04:00
Zachary Snow 704e867c0c packed array conversion packs any unsupported unpacked dimensions 2019-09-01 18:39:01 -04:00
Zachary Snow e80f880f43 additional expression simplification special cases 2019-08-31 15:45:24 -04:00
Zachary Snow 8f7968bf37 support data declarations with automatic lifetime (closes #20) 2019-08-31 15:36:27 -04:00
Zachary Snow 243f773657 convert for loop declarations and assignments to signle assignment (closes #15) 2019-08-30 00:12:01 -04:00
Zachary Snow 1472ea0cfe convert unpacked parameter dimensions (closes #18) 2019-08-29 20:52:06 -04:00
Zachary Snow 1d216a2e0e preliminary ternary substitution simplification 2019-08-28 23:26:12 -04:00
Zachary Snow 96034eb99c support for flattening multidimensional ports (resolves #21) 2019-08-28 22:32:36 -04:00
Zachary Snow 1dad3a7502 parse and convert empty function arguments (resolves #17) 2019-08-28 20:29:35 -04:00
Zachary Snow 02ba9e95df remove comments by default; added --verbose flag 2019-08-28 19:48:25 -04:00
Zachary Snow b48ca0bb8f added package enum item name resolution (resolves #16) 2019-08-28 19:01:25 -04:00
Zachary Snow fabdc08493 fix package resolution of nested typedefs (resolves #11) 2019-08-27 21:32:03 -04:00