Commit Graph

104 Commits

Author SHA1 Message Date
Zachary Snow 336812ff21 fix conversion of signed struct fields accessed directly 2022-06-19 16:13:56 -04:00
Zachary Snow 5105ccbb39 use scoped errors in struct conversion 2021-10-17 21:40:12 -06:00
Zachary Snow ff241115c4 forbid bit-selects and part-selects of scalar struct fields 2021-09-27 21:52:37 -06:00
Zachary Snow b1f1b822e9 fix conversion of interface-based typedefs 2021-09-18 21:46:32 -04:00
Zachary Snow 30acc3e3f9 fix spacing of as-patterns for future GHC upgrade 2021-08-12 16:13:12 -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 ab867465da fix handling of explicitly typed struct patterns in other contexts 2021-07-21 14:31:43 -04:00
Zachary Snow 56c597e35e support explicitly typed struct patterns 2021-07-19 11:42:36 -04:00
Zachary Snow 4c7e9d0353 struct conversion uses simple association lists 2021-07-08 13:58:02 -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 9de4a3c99c simplify type and decl traversals 2021-06-30 19:13:44 -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 a6ebc0e3ff fix elaboration of struct array fields referenced hierarchically
- `expr.name[idx]` considers `expr.name` could be a struct array
- remove fallback struct type lookups which were guaranteed to fail
2021-05-09 19:24:23 -04:00
Zachary Snow 38cc25fad6 more test coverage and dead code removal 2021-03-09 15:48:10 -05:00
Zachary Snow 5080265e4d typedef, multipack, and struct conversions scope substitutions 2021-02-22 14:13:37 -05:00
Zachary Snow e9d62e01ad unify type range splitting 2021-02-19 14:50:05 -05:00
Zachary Snow 642803a707 expression traversals no longer visit types by default 2021-02-11 17:07:58 -05:00
Zachary Snow dd1a9efb40 refactor cast conversion
- delegate cast type and sign resolution to TypeOf conversion
- internal support for injecting data declarations into statements
- fix size and sign of unbased unsized literals used in casts
- avoid generating many unnecessary explicit casts
- support casts which depend on localparams within procedures
- expression traversal correctly visits types within type casts
- fix typeof on expressions of net types
- handle additional edge cases for unsized integer array patterns
- preserve signedness of implicitly flattened unpacked integer arrays
2021-02-03 16:28:53 -05:00
Zachary Snow bbb469463b fix typing bit and part selects 2020-07-23 18:23:40 -06:00
Zachary Snow 5ad8de9ef7 standardize pattern conversion 2020-07-21 18:05:27 -06:00
Zachary Snow 7eed2fc58e fix handling of multi-dimensional integer array literals (resolves #113) 2020-07-20 16:55:55 -06:00
Zachary Snow c28bb71ac5 more careful expr and type traversals 2020-07-15 18:44:57 -06:00
Zachary Snow 5667bdb589 unpacked array conversion supports generate scoped data
- added type class for looking up elements in scoped conversions
2020-07-14 22:59:59 -06:00
Zachary Snow d88c516d33 enhanced handling of number literals
- number literals are parsed rather than stored as strings
- fix array query functions used on non-trivial number literals
- more efficient expression simplification recursion
- expanded constant folding scenarios
2020-07-12 15:06:27 -06:00
Zachary Snow d2a0ba0d13 improved handling of number literals
- elaborated literals larger than 32 bits are given an explicit size
- constant folding no longer encodes illegal negative numbers
2020-07-08 21:49:50 -06:00
Zachary Snow 296e246158 fix multi-dimensional array unbased unsized pattern conversion 2020-07-06 22:26:04 -06:00
Zachary Snow 85e3d0f5b5 initial generate block scoping support
- significant refactor of struct conversion
- significant refactor of typedef conversion
- scoping support in multipack conversion
- scoping support in typeof conversion
2020-07-02 22:58:59 -06:00
Zachary Snow 1dfa9a9e7f simplify struct conversion 2020-07-01 22:37:19 -06:00
Zachary Snow 2535d689aa fix struct/interface/logic conversion interactions
- interface conversion only waits for type resolution of modports
- typeof conversion resolves struct field accesses
- logic conversion only converts logic data declarations
- struct conversion only converts within modules
- fix nested type traversal order causing premature struct conversion
2020-06-20 22:46:54 -04:00
Zachary Snow bd1c07231f experimenting with monad helpers 2020-06-20 16:41:13 -04:00
Zachary Snow 12be569742 reduce usage of maybe 2020-06-14 15:56:09 -04:00
Zachary Snow 682620b23f struct conversion includes exprs in decls 2020-06-13 22:14:53 -04:00
Zachary Snow 82703834ac constant folding for shifts 2020-06-06 22:45:17 -04:00
Zachary Snow 95524c46ad remove excess patterns from struct conversion 2020-02-21 21:03:33 -05:00
Zachary Snow a415d9eb3d fix type propagation of struct fields bit accesses 2020-02-20 00:19:14 -05:00
Zachary Snow 470fa01eb2 updated casting conventions
- explicit enum casts in source are converted to size casts
- conversion for basic pattern array literals of unsized numbers
- unsized number array literals preserve signing
- more aggressive ternary simplification
2020-02-19 18:58:25 -05:00
Zachary Snow 976f582287 push struct and multi-packed ternaries into ranges
- the ternary expressions were previously used to decide the direction
  of generated part selects
- this fixes an issue where ternaries were generated for LHSs
2020-02-18 21:25:20 -05:00
Zachary Snow 8f2d7dd5c7 fixed multiple issues with struct and multi-packed conversions
- struct conversion handles directionality of fields
- struct conversion supports minus part selects
- fixed incorrect handling of directional part selects in multi-packed
  conversion
- multi-packed conversion defines standard ranges in terms of
  directional part selects for clarity
- fixed potential loop due to overeager untagging in multi-packed
  conversion
2020-02-17 13:57:48 -05:00
Zachary Snow 5f0ccee065 conversion for unsized integer arrays 2020-02-17 12:12:51 -05:00
Zachary Snow fe8839eaec fix struct typing of ternary expressions (resolves #73) 2020-02-15 14:44:49 -05:00
Zachary Snow 4cf65dd4e2 support for struct type parameters
- param type conversion properly supports deferred param type resolution
- fixed struct conversion incomplete Subroutine traversal
- struct conversion excludes param types from conversion
- parameters are defaulted to have integer type
2020-02-09 17:31:24 -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 17e17ebd7f fix struct array pattern conversion (resolves #60) 2020-01-20 17:26:03 -08:00
Zachary Snow 6f0fa58ace simplify struct LHS handling 2020-01-14 00:23:16 -05:00
Zachary Snow 82217ec05c updated lifetime representation; struct packers use automatic 2019-12-22 12:01:05 -05:00
Zachary Snow fb5fd39388 support for inside expression ranges and wildcards 2019-12-08 17:36:25 -05:00
Zachary Snow 95299c6f56 conversion of structs with multi-dim fields (resolves #53) 2019-11-19 23:15:25 -05:00
Zachary Snow 3597f4a6be support for methods (no conversion) and interface TFs 2019-10-19 16:22:46 -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 a1cd6941ae apply patterns to substructures 2019-10-13 23:37:43 -04:00