Commit Graph

10108 Commits

Author SHA1 Message Date
Chris Lattner 593b004130 Implement folds of shl/shr and constant folding of bits. 2020-05-01 16:47:50 -07:00
Chris Lattner ef5e392c8b [EmitVerilog] don't emit shl by zero as {_T_2, 0'h0}, emit it as _T_2. 2020-05-01 15:43:05 -07:00
Chris Lattner 3803cfe733 [EmitVerilog] The verilog bit select operator doesn't work on an
abitrary subexpression.  Make sure to emit the subexpression of a
bitselect as a standalone wire to work around this limitation.
2020-05-01 15:03:36 -07:00
Chris Lattner ca8aadefa7 [EmitVerilog] Introduce a new outOfLineExpressions set that keeps track
of expressions that need to be emitted as explicit wires.  NFC, but this
makes room for a future fix.
2020-05-01 13:26:00 -07:00
Chris Lattner 32a444df5d Add some additional check lines to a testcase. 2020-05-01 09:30:14 -07:00
Chris Lattner 2ae4d2cd19 [EmitVerilog] Make sure the Verilog emitter avoids using reserved
words and other identifiers that cause problems.  This fixes
Issue #2.
2020-05-01 09:23:20 -07:00
Chris Lattner bb7195b866 Fix macro defines in prelude to parse correctly.
Thanks to Robbie for reporting this!
2020-04-30 17:48:05 -07:00
Chris Lattner caff511a8f Capture the depth of a mem in the IR as an attribute. Start emitting basic
mem constructs to verilog.  Still a long road to go here.
2020-04-30 17:46:40 -07:00
Chris Lattner 04197ca9a1 Fold cat(bits(x,..), bits(x, ...)) -> bits(x, ...) when safe. 2020-04-30 13:38:06 -07:00
Chris Lattner 14681d5231 Split op folding logic out to its own file, NFC. 2020-04-30 13:11:26 -07:00
Chris Lattner 109bb2499c [EmitVerilg] Emit locator comments. 2020-04-30 12:05:57 -07:00
Chris Lattner 23f80f6c95 Implement constant folding for pad. 2020-04-30 10:52:35 -07:00
Chris Lattner 9e3318f006 [EmitVerilog] Add basic support for analog types in ports. 2020-04-30 09:52:14 -07:00
Chris Lattner 7f256d603f fix a crash I noticed due to a missing classof() implementation. 2020-04-30 09:29:47 -07:00
Chris Lattner 2dab50253c [FIRParser/IR] Add support for the 'attach' statement 2020-04-29 22:42:47 -07:00
Chris Lattner 5dfd536073 Extend a grotty hack for a bug in Chisel to handle skip operations
after memports.
2020-04-29 22:29:53 -07:00
Chris Lattner d231ef2423 [FIRParser] Implement support for a form of reg decl that we didn't support yet. 2020-04-29 22:14:05 -07:00
Chris Lattner 85a41e32fe Implement a trivial folder for bits(x) that extracts the whole input.
This shrinks my testcase from 356716 -> 353916 lines.
2020-04-29 21:40:53 -07:00
Chris Lattner 4c9d790ea5 Implement some trivial folds for single bit "x == 1" and "x != 0"
which come up frequently.  This chops 2100 lines out of a testcase
I'm looking at.
2020-04-29 21:30:21 -07:00
Chris Lattner ceb294fc3d implement some simple canonicalizations for mux, trimming out obviously silly IR. 2020-04-29 20:56:18 -07:00
Chris Lattner 48aeca277f Update to latest MLIR changes. 2020-04-29 15:05:58 -07:00
Chris Lattner c216617817 Move the remaining references of SPT to CIRT. NFC. 2020-04-29 11:57:17 -07:00
Chris Lattner 1ec1e98165 Rename a directory to unbreak tests. 2020-04-29 11:51:31 -07:00
Chris Lattner b50c43470b remove some files that got moved. 2020-04-29 11:47:18 -07:00
Chris Lattner 66e9c9ca25 rename spt-opt and spt-translate to cirt-* 2020-04-29 11:45:54 -07:00
Chris Lattner 5411096ddd Move macro-like SPT_ names to CIRT_. NFC. 2020-04-29 11:41:42 -07:00
Chris Lattner 7ff6ffdf2f Rename include/spt -> include/cirt, NFC. 2020-04-29 11:34:22 -07:00
Chris Lattner 9d11c786d4 start the rename of SPT -> CIRT, suggest by Aliaksei. This updates
the readme and namespace.  NFC.
2020-04-29 11:30:16 -07:00
Chris Lattner 1d8c47b80d [EmitVerilog] Implement assignment to registers correctly. 2020-04-29 11:23:13 -07:00
Chris Lattner 5d337b7b50 [EmitVerilog] Implement initial support for registers.
Assignment to registers is still not correct.
2020-04-28 22:57:44 -07:00
Chris Lattner 05ce6fef4c [EmitVerilog] Generalize the handling of preprocessor conditions
in ConditionalStatement to be arbitrary macros instead of hard
coding it to an enumerated set.
2020-04-28 22:08:16 -07:00
Chris Lattner fb8ae62ddf Implement folds for Or and Xor primitives. This hacks 5000 lines out of a
low firrtl testcase I'm working with and cleans up the generated verilog.
2020-04-27 18:08:22 -07:00
Chris Lattner ccb1577af7 Implement some simple folders for the And prim op. 2020-04-27 17:46:34 -07:00
Chris Lattner d28ee52c24 Add a 'materializeConstant' to the FIRRTL dialect, which is currently unused.
Drop all the optional name attrs off expression nodes, they are unused.
2020-04-27 17:05:10 -07:00
Chris Lattner 7e9abd3bd5 [EmitVerilog] improve port emission to put multiple ports on a single
input/output declaration.
2020-04-27 16:50:54 -07:00
Chris Lattner 5179206e0b Split up FIRRTL.td into multiple different files for each component, NFC. 2020-04-27 16:15:22 -07:00
Chris Lattner 93d9015640 [emitVerilog] improve escaping. 2020-04-27 15:38:05 -07:00
Chris Lattner 314bb2bab5 [EmitVerilog] Implement proper support for firrtl.printf.
While here, fix the FIRParser to properly unescape printf format
strings and string parameters to verilog modules.
2020-04-27 10:17:24 -07:00
Chris Lattner ad0b973240 [EmitVerilog] Emit a #ifdef header block for configuring the file,
emit the ability to emit a block of conditionalized statements at
the bottom of the verilog module, and implement firrtl.stop correctly.
2020-04-27 09:38:28 -07:00
Chris Lattner 437410df46 [FIRTool] Add a testcase that was supposed to be included in a
previous patch.
2020-04-25 14:37:28 -07:00
Chris Lattner 3488b48596 [FIRParser] Ignore _GEN names, since they are machine generated. 2020-04-25 14:36:55 -07:00
Chris Lattner e6cf307a95 [EmitVerilog] Reenable an 'emitError' now that N^2 behavior in MLIR is fixed. 2020-04-25 14:36:30 -07:00
Chris Lattner baf21faa80 [EmitVerilog] be more aggressive about inlining some expressions through noop casts. 2020-04-24 11:05:54 -07:00
Chris Lattner 3a0aac339b [firtool] Wire a couple optimizations (cse and canonicalize for now) into
firtool by default to clean up the IR.
2020-04-24 10:51:56 -07:00
Chris Lattner b0a8592b4b [EmitVerilog] Switch to emitting inline wire decls for shared expressions,
instead of emitting a block of them at the top of the module.  We could
probably move all wires to being done this way, but we'll start
conservatively for now.
2020-04-24 10:30:20 -07:00
Chris Lattner 989f02b2f8 [EmitVerilog] fix another crash handling outputs being used as inputs. 2020-04-24 09:20:15 -07:00
Chris Lattner 2105d74969 [EmitVerilog] Fix a bug where outputs being fed into a primitive
input argument could lead to a crash because of flip types being
in the way.
2020-04-23 23:14:02 -07:00
Chris Lattner ef9f09b32b [EmitVerilog] Implement validif and pad primitive operations. 2020-04-23 23:00:15 -07:00
Chris Lattner ad315a29ba [EmitVerilog] Stub out the printf and stop pseudo operations with incorrect
stubs.

Also, fill out the rest of the visitors.
2020-04-23 21:54:08 -07:00
Chris Lattner d201d79ef4 Introduce decl/stmt visitors, NFC. 2020-04-23 21:36:34 -07:00