Commit Graph

430 Commits

Author SHA1 Message Date
Zachary Snow 737791aebd expose nested type traversal 2019-08-27 19:28:04 -04:00
Zachary Snow a9f502a696 traverse covers typedefs in packages and exprs in types 2019-08-26 21:08:31 -04:00
Zachary Snow 086826714d nicer error message for missing struct fields 2019-08-26 20:20:38 -04:00
Zachary Snow 89e4f2a248 allow newlines before left paren of macro arguments 2019-08-11 17:55:42 -04:00
Zachary Snow 81f5fb500f added conversion for packed unions 2019-08-08 23:12:49 -04:00
Zachary Snow 8a67a91166 added language support for (untagged) unions 2019-08-08 23:12:06 -04:00
Zachary Snow ae239f16b7 updated usage documentation 2019-08-07 22:10:03 -04:00
Zachary Snow 9b7d003ea4 support for empty packages (resolves #9) 2019-08-07 21:58:20 -04:00
Zachary Snow 4fd7b6c2f2 better support for struct array parameters
This includes support for
- parsing dimensioned alias parameters
- flattening non-var decls with multiple packed dimensions
- converting arrays of structs
- inferring struct types for decls with initializations
2019-08-06 23:11:09 -04:00
Zachary Snow e82537fa97 add support for localparams in module parameter list (resolves #7) 2019-08-06 19:53:19 -04:00
Zachary Snow 90bc30d4be add --oneunit, which treats all input files as being part of one compilation unit 2019-08-05 22:00:04 -04:00
Zachary Snow 9c160c3d20 added support for package imports in module headers 2019-08-03 21:50:26 -04:00
Zachary Snow 35ac09aa75 struct conversion handles complex expression nesting 2019-05-16 10:51:57 -04:00
Dave Eckhardt dadcd6ae24 Wording tweaks in comments. 2019-05-15 23:02:52 -04:00
Zachary Snow 3bef2b9cdb struct conversion handles alternate and mixed integer vector field types 2019-05-10 10:41:31 -04:00
Zachary Snow 44ea16e3eb ensure, rather than check, traverseScopesM invariant (perf optimization) 2019-05-01 13:37:50 -04:00
Zachary Snow 04337988cc standardized handling of resolution across source files 2019-04-30 15:44:52 -04:00
Zachary Snow d2c06b58bc initial work towards fleshing out package conversion 2019-04-30 01:57:04 -04:00
Zachary Snow fc3e79ddd0 basic conversion for int, byte, shortint, and longint 2019-04-24 14:00:08 -04:00
Zachary Snow 2d003c6ded conversion for package-scoped tasks, functions, and typenames 2019-04-24 04:01:33 -04:00
Zachary Snow bc23aebc55 added language support for package-scoped calls and typenames 2019-04-24 03:37:47 -04:00
Zachary Snow 9373f3049a added note about state of package conversion 2019-04-23 20:37:59 -04:00
Zachary Snow 2aa39289a3 added preliminary package conversion 2019-04-23 20:22:03 -04:00
Zachary Snow 33dc4b3f88 conversions are applied per-file
- NestTF refactored to cover all package items
- fixed issue where type traverse skipped typedefs
2019-04-23 18:51:39 -04:00
Zachary Snow da38776d73 decls are now package items 2019-04-23 17:12:56 -04:00
Zachary Snow d01df6110b preliminary language support for packages 2019-04-23 15:53:51 -04:00
Zachary Snow 4178751b22 interface conversion handles decls with unpacked dimensions 2019-04-23 15:48:25 -04:00
Zachary Snow 4e34217472 struct conversion handles decls with unpacked dimensions 2019-04-23 15:48:25 -04:00
Zachary Snow 85d22d8d03 support for generate constructs outside of generate regions and genvar declarations in generate loops 2019-04-23 14:38:44 -04:00
Zachary Snow d36ae19e4c fix $bits resolution of params/localparams 2019-04-23 01:35:21 -04:00
Zachary Snow 925f11cf31 expression traversal visits LHS range and bit expressions 2019-04-23 01:16:57 -04:00
Zachary Snow 04983b0cd5 fixed off by 1 in logic conversion 2019-04-23 00:33:41 -04:00
Zachary Snow c8894cebde random documentation and cleanup 2019-04-23 00:23:32 -04:00
Zachary Snow 88579c6d1f logic conversion fixes produced reg-to-output bindings
- generally cleaned up and documented the Logic conversion
- made exprToLHS a shared helper function, now uses Maybe
- ported existing local exprToLHS helpers to the new one
2019-04-22 20:44:35 -04:00
Zachary Snow 55a5443786 logic conversion makes continuous assignments procedural where necessary 2019-04-22 15:10:34 -04:00
Zachary Snow d41dcb2bc9 struct conversion supports struct literals as task/function args 2019-04-22 13:58:14 -04:00
Zachary Snow addc550028 minor code cleanup for struct conversion 2019-04-22 02:48:22 -04:00
Zachary Snow a8f2cbbe29 struct conversion supports complex shadowing 2019-04-22 02:33:24 -04:00
Zachary Snow 05b7bdb99c added conversion which moves top-level tasks and functions into modules 2019-04-22 01:18:25 -04:00
Zachary Snow acebba58c9 struct conversion omits unused packing functions 2019-04-21 22:22:33 -04:00
Zachary Snow d5a369baa0 struct conversion uses packing functions to force field width 2019-04-21 21:56:23 -04:00
Zachary Snow c5fdf38612 added conversion which adds names to unnamed blocks with decls 2019-04-19 19:08:52 -04:00
Zachary Snow b0eedfe318 $bits conversion handles basic expressions 2019-04-19 13:32:25 -04:00
Zachary Snow 73f831122f trim empty blocks; remove extra space in implicitly typed decls 2019-04-19 02:55:40 -04:00
Zachary Snow 8298e83f1e enum conversion only produces localparams for enum items that are used 2019-04-19 02:14:21 -04:00
Zachary Snow 9fcc8e3478 enum generate localparam values are also explicitly sized to avoid implicit cast/warnings 2019-04-19 01:02:07 -04:00
Zachary Snow a5ebb1e822 minor output cleanup 2019-04-18 23:32:49 -04:00
Zachary Snow 4cbfd8fa1a enum conversion explicitly sizes generated params and supports partial types 2019-04-18 21:01:29 -04:00
Zachary Snow 093a4d4dd9 fix Struct conversion handling of default patterns with struct arrays 2019-04-18 21:00:48 -04:00
Zachary Snow 68b6eae484 updated documentation 2019-04-18 19:33:16 -04:00
Zachary Snow 9305c0f43b PackedArray conversion supports complex shadowing 2019-04-18 15:51:39 -04:00
Zachary Snow 96e0aff7f4 handle TF decl shadowing within packed array conversion 2019-04-17 20:05:55 -04:00
Zachary Snow 8d77856b1e StmtLHS traversal includes LHSs for loop parts 2019-04-17 17:44:12 -04:00
Zachary Snow 07b64bd1f2 clearer messaging surrounding unsupported interface conversion features 2019-04-17 01:44:03 -04:00
Zachary Snow 369e9f2f19 updated Stack snapshot; handled pattern matching failure issues introduced in GHC 8.6 2019-04-16 15:52:38 -04:00
Zachary Snow 75e2fba597 explicitly size literals in converted default struct patterns 2019-04-15 23:28:03 -04:00
Zachary Snow da9452bd26 fix PackedArray handling of bit select followed by range select 2019-04-11 18:29:30 -04:00
Zachary Snow 88c537c93f fixed handling of 3+ dimensional packed arrays 2019-04-11 17:30:29 -04:00
Zachary Snow 55aebec3ad flatten generate blocks into their parent description where trivially possible 2019-04-11 15:42:46 -04:00
Zachary Snow 231b7f9936 interface conversion respects port direction when inlining bindings 2019-04-11 14:08:50 -04:00
Zachary Snow c168ec4794 added some error checking for struct pattern conversion 2019-04-10 18:33:33 -04:00
Zachary Snow 377600078a struct conversion attempts to size unsized constants when packing patterns 2019-04-10 14:07:38 -04:00
Zachary Snow 006e0e0830 fixed struct pattern field ordering 2019-04-10 14:06:44 -04:00
Zachary Snow e4cd8f4c09 simplify handles division and unsized decimal constants 2019-04-09 13:07:43 -04:00
Zachary Snow 2ee837f7b0 restore port-decl hoisting for cleaner output 2019-04-09 12:50:56 -04:00
Zachary Snow dca3a55fa6 support for indexed part select in first procedural Stmt 2019-04-08 22:02:49 -04:00
Zachary Snow 9b51d7566b more expression simplification 2019-04-08 21:57:50 -04:00
Zachary Snow 9a38225b1d several major fixes surrounding packed arrays
- entirely new PackedArray conversion (always flattens)
- typedef and struct correctly order packed ranges when combining types
- Stmt LHS traversal no longer traverses nested statements to avoid double conversion
- Logic conversion applies to `initial` blocks`
- new and modified tests to cover these cases
2019-04-08 21:28:33 -04:00
Zachary Snow fb3d68e339 propper support for indexed part select addressing 2019-04-05 13:53:52 -04:00
Zachary Snow 011d88b544 PackedArray conversion supports arbitrary endianness 2019-04-04 19:40:19 -04:00
Zachary Snow f47446653d Updated README 2019-04-03 23:40:28 -04:00
Zachary Snow f9d46d548e cleanup of Enum conversion; additional test 2019-04-03 21:31:56 -04:00
Zachary Snow 383754fa7a final major round of splitting and cleanup in the SystemVerilog module 2019-04-03 20:24:09 -04:00
Zachary Snow 6d0f7dd0a7 significantly stronger support, and proper handling of assertions 2019-04-03 19:08:30 -04:00
Zachary Snow e79c95c5f0 some cleanup throughout the SystemVerilog module 2019-04-03 13:45:43 -04:00
Zachary Snow 39f377e022 lexer has useful tagging of tokens from a macro expansion 2019-04-03 13:05:33 -04:00
Zachary Snow 2f91e25aa2 more lexer tests 2019-04-03 00:16:30 -04:00
Zachary Snow a18270a3bd many lexer fixes
- added support for macros with default arguments
- fixed bug where nested preprocessor conditionals would not be skipped
- macro expansion respects escaped quotation marks
- macro expansion considers whole identifiers, rather than substituting in wildly
2019-04-02 23:05:42 -04:00
Zachary Snow f59ed11ef5 add support for specifying compile-time defines 2019-04-02 16:19:59 -04:00
Zachary Snow 5351dee80a minor scoping/ordering fixes for pesky VCS restrictions 2019-04-02 15:36:29 -04:00
Zachary Snow ba7ffdf14d $bits conversion handles types with more than 1 dimension 2019-04-02 13:44:47 -04:00
Zachary Snow 86195d9ea1 interface conversion obeys function/task identifier shadowing 2019-04-02 13:35:15 -04:00
Zachary Snow f13275bfa1 fix Struct and Interface conversion for expressions within LHSs 2019-04-02 01:00:02 -04:00
Zachary Snow c53b39319d added support and conversion handling of the $bits system function
This also entailed further fleshing out the expression traversal helper
to cover expressions in generate blocks, which could, of course, use
$bits.
2019-04-02 00:16:09 -04:00
Zachary Snow 5ea2ec9ddf added conversion for name task and function arguments 2019-04-01 13:16:21 -04:00
Zachary Snow f1ac4fc04f fixed PackedArray conversion assigning to reg for Local arrays 2019-04-01 02:45:36 -04:00
Zachary Snow 00d12c7ae5 fixed combined ranges incorrect upper bound calculation 2019-04-01 02:26:40 -04:00
Zachary Snow 9b8a95029b more robust and full-featured interface conversion 2019-04-01 01:23:44 -04:00
Zachary Snow 0a3e9f4f49 more range-bit edge cases in Struct conversion 2019-03-31 17:35:00 -04:00
Zachary Snow 650c602be9 struct conversion handles bit expressions and expressions outside of assignments 2019-03-31 17:00:55 -04:00
Zachary Snow b8d31d2a41 support for packed array flattening in tasks and functions 2019-03-31 16:43:19 -04:00
Zachary Snow b148117935 fix conversion ordering 2019-03-31 15:57:28 -04:00
Zachary Snow 7883e263f9 several conversion bug fixes
- convert default pattern used to fill a vector
- convert Logic in parameter and localparam types
- interface conversion should happen early for type resolution later on
- interface conversion handles renaming of usages of inlined decls
2019-03-31 15:01:10 -04:00
Zachary Snow dc759dbb68 support for parameters of all types; fix named argument display bug 2019-03-31 14:25:09 -04:00
Zachary Snow c8e776265c fix ports bound to decls inlined from an interface expansion 2019-03-30 22:15:48 -04:00
Zachary Snow a059b6e83c fix silly bug preventing structs from being converting 2019-03-30 03:32:08 -04:00
Zachary Snow 317994ed3a faster lexing by storing tokens in reverse order 2019-03-30 03:21:56 -04:00
Zachary Snow b45217bae9 hacky support for 'part-select addressing' 2019-03-30 02:50:45 -04:00
Zachary Snow abd7ccf49a don't prematurely unpack structs with complex types; support for convert patterns that use `default` 2019-03-30 02:33:31 -04:00
Zachary Snow dd89e5c9ea minor fixes 2019-03-30 01:56:57 -04:00
Zachary Snow c4f5718f51 support for binary xnor 2019-03-30 01:33:49 -04:00
Zachary Snow 2314f97a96 support for call args with unnamed and named arguments 2019-03-30 01:27:48 -04:00
Zachary Snow a432d75939 additional SystemVerilog language support
- unique0 and priority
- uniqueness on if statements
- preliminary discard-only parsing of assertions
- parameters with alias typenames
2019-03-30 00:47:42 -04:00
Zachary Snow 17fd6f8ce5 proper handling of single-line comments in macro definitions 2019-03-29 19:08:44 -04:00
Zachary Snow c4449fd9ca better support for macros with arguments 2019-03-29 18:55:45 -04:00
Zachary Snow e49cb3536e beginning work to support macros with arguments; lex posn fix 2019-03-29 17:02:49 -04:00
Zachary Snow 1a170f41c2 allow for stray semicolons in module items; allow for multiple struct field declarations on one line 2019-03-29 16:48:58 -04:00
Zachary Snow 5dc049b9e5 cleanup pass over Lex.x 2019-03-29 13:59:51 -04:00
Zachary Snow d578aee5d9 conflate the preprocessor and lexer
This should make it much easier to add support for ``, `", macros with
arguments, etc., in the future.
2019-03-29 05:33:17 -04:00
Zachary Snow e69895af54 initial setup for combining pre-processor and lexer 2019-03-29 01:10:46 -04:00
Zachary Snow 0d9ed3e1fa updated CLI to support include dirs and multiple files 2019-03-28 19:55:53 -04:00
Zachary Snow 7e37fe4338 fix nested conditional preprocessor directives 2019-03-28 18:04:28 -04:00
Zachary Snow 848f8cbd61 support for ++ and -- as bare Stmts 2019-03-28 15:08:05 -04:00
Zachary Snow e4efb4803b fix broken for inits parsing; beefed up relong test script to catch such mistakes 2019-03-27 03:33:28 -04:00
Zachary Snow 713fb8a658 support for more complex for loop components 2019-03-27 01:53:26 -04:00
Zachary Snow 1c1740f1e3 support for constant size casts 2019-03-27 00:34:17 -04:00
Zachary Snow 5de77ab62d fix function and task input types 2019-03-26 23:51:31 -04:00
Zachary Snow edaff3dcf6 added conversion to make functions and tasks use only one statement 2019-03-26 21:43:27 -04:00
Zachary Snow 6cc4654ad6 support for real numbers 2019-03-26 15:21:06 -04:00
Zachary Snow 39f6bbb3d8 preliminary support for extern and module/interface lifetimes 2019-03-26 15:10:16 -04:00
Zachary Snow 0352414e0f surprisingly non-disgusting addition of attribute instances to module items and statements 2019-03-26 01:54:16 -04:00
Zachary Snow 0e2658fdca fix string literal lexing 2019-03-25 19:42:20 -04:00
Zachary Snow a2d0872d6f support for delays on continuous assignments 2019-03-25 19:31:06 -04:00
Zachary Snow ec06b2b97a support for basic event triggers 2019-03-25 19:06:54 -04:00
Zachary Snow a803284be8 support for instantiations with a range 2019-03-25 19:06:35 -04:00
Zachary Snow ed816ac5dc fix silly bugs from AST reorg 2019-03-25 14:40:57 -04:00
Zachary Snow 8907ac861d split out Decl, LHS, and Stmt into separate AST modules 2019-03-25 13:29:35 -04:00
Zachary Snow 77f0d23d4b starting work to clean up and segment AST 2019-03-22 19:39:28 -04:00
Zachary Snow cecd141e57 revamped support system with most SystemVerilog types and signed types 2019-03-22 17:45:31 -04:00
Zachary Snow 45d16a30db support non-blocking assignments with delay or event controls 2019-03-22 02:47:25 -04:00
Zachary Snow 9259fef249 tolerate spaces in numeric literals in line with the spec 2019-03-22 02:01:48 -04:00
Zachary Snow 90bd6b3492 added support for n-input gates and n-output gates 2019-03-22 01:32:43 -04:00
Zachary Snow 7f8c2e336b simple conversion for unbased unsized literals 2019-03-19 13:40:25 -04:00
Zachary Snow 071d56a1ea more accurate handling of tagged blocks 2019-03-18 14:41:09 -04:00
Zachary Snow 35d8644f2a fix PackedArray with whole array uses by allowing top-level Expr and LHS traversal 2019-03-18 14:27:14 -04:00
Zachary Snow 1d2eccb32a preliminary support for defparam 2019-03-18 12:37:46 -04:00
Zachary Snow acfbdb07f8 completely rewrote preprocessor; more extensive directive support (include, timescale) 2019-03-18 05:00:23 -04:00
Zachary Snow 73b11b3662 move interface conversion assign bindings to be after inlining 2019-03-08 18:23:38 -05:00
Zachary Snow e187de5623 support for commas in event expressions 2019-03-08 17:29:44 -05:00
Zachary Snow 4bc3eb8d2c more gracefully unknown type handling in Struct conversion 2019-03-08 17:17:30 -05:00
Zachary Snow bddb8ceaff fix multiple instantiations on one line 2019-03-08 17:01:49 -05:00
Zachary Snow b5b9fdb37e support for null call arguments 2019-03-08 16:55:03 -05:00
Zachary Snow b4b6ea348d support for "unbased_unsized_literal" 2019-03-08 16:37:20 -05:00
Zachary Snow 943b7adc08 support for more complex LHSs with dots in decl token parser 2019-03-08 16:26:47 -05:00
Zachary Snow 2150e8a4bb support optional tags in more places 2019-03-08 16:03:29 -05:00
Zachary Snow f40c71dc03 ParseDecl forbids non-EQ assignment operators in declarations 2019-03-08 14:47:20 -05:00
Zachary Snow d7f641b850 pivoted to general Verilog-2005 targeting 2019-03-08 11:02:40 -05:00
Zachary Snow 9f0857d68e some fixes for 'VTR' targetted conversions 2019-03-07 20:03:35 -05:00
Zachary Snow b2b1c9e52c allow .* as element of partial port bindings 2019-03-07 18:20:34 -05:00
Zachary Snow f97e069ef0 fix DT parsing of ports with implicit types 2019-03-07 18:16:38 -05:00
Zachary Snow 9ec9435cb0 support for binary blocking assignment operators in statements 2019-03-07 18:16:28 -05:00
Zachary Snow dd5b03431d allow block item declarations for un-named blocks 2019-03-07 15:39:19 -05:00
Zachary Snow e006e36ddc preliminary support for tasks 2019-03-07 13:58:20 -05:00
Zachary Snow 0f4a60be1d functions and typedefs can now appear at the top level 2019-03-07 13:19:31 -05:00
Zachary Snow e8ed885f2c support for single-expr implicit dimensions 2019-03-07 01:38:42 -05:00
Zachary Snow d7b36a033b removed enum complex type cast hack 2019-03-07 00:59:02 -05:00
Zachary Snow 710da1a62f fix PackedArray ident prefix conditions 2019-03-06 23:25:02 -05:00
Zachary Snow 15d85b461b completed preliminary interface conversion 2019-03-06 21:55:27 -05:00
Zachary Snow ccd0bf879a fix Struct conversion paving over LHSDot 2019-03-06 20:49:53 -05:00
Zachary Snow 1d79c27963 first half of interface conversion 2019-03-06 20:30:47 -05:00
Zachary Snow 64a2610b76 explicitly default function input types to 2019-03-06 15:07:22 -05:00
Zachary Snow 4c49bd1138 function return type logic to implicit conversion 2019-03-06 14:36:16 -05:00
Zachary Snow 9699f5bf16 preliminary struct conversion; return conversion 2019-03-06 01:13:36 -05:00
Zachary Snow 4d3669d356 added support for other procedural loops 2019-03-04 21:34:32 -05:00
Zachary Snow de728f3060 added some support for a few key non-synthesizable constructs 2019-03-04 21:04:22 -05:00
Zachary Snow ff81267132 added conversion for genvar iteration AsgnOps 2019-03-04 19:58:54 -05:00
Zachary Snow 460c0ee497 broader operator support; other parser cleanup 2019-03-04 18:25:14 -05:00
Zachary Snow 4394dc1737 Fix PackedArray conversion after recursive Expr and LHS 2019-03-04 16:10:01 -05:00
Zachary Snow e1799de5f9 Expr bits and ranges are recursive (as they should have been) 2019-03-04 15:46:21 -05:00
Zachary Snow 59efba06ac LHSs are recursive (as they should have been) 2019-03-04 15:16:53 -05:00
Zachary Snow b95af2b6d1 support for automatic functions 2019-03-04 14:25:38 -05:00
Zachary Snow 729a75cd11 support for interfaces; new "declaration parser" 2019-03-04 02:58:00 -05:00
Zachary Snow b2e0c4fa97 preliminary support for structs 2019-03-01 20:32:46 -05:00
Zachary Snow ab91eaafd7 initial version of enum conversion 2019-02-28 22:44:31 -05:00
Zachary Snow 816d959fc8 rewrite Typedef conversion to use Traverse 2019-02-28 20:30:21 -05:00
Zachary Snow fd0bccfbd8 rewrote PackedArray to properly handle the various scenarios 2019-02-28 19:48:58 -05:00
Zachary Snow a6cd3626f5 small pre-refactor PackedArray fixes 2019-02-28 18:04:34 -05:00
Zachary Snow e1d6da00dd moved some expression traversal logic from PackedArray to Traverse 2019-02-28 17:12:37 -05:00
Zachary Snow 945923b3fd cleaned up command line args module a bit 2019-02-28 14:06:35 -05:00
Zachary Snow 7bc81ef67b directory re-org; streamline build setup 2019-02-28 13:52:31 -05:00