Commit Graph

8551 Commits

Author SHA1 Message Date
Chris Lattner 4c0bd51ae9 [emitverilog] refactor the parenthesization logic into emitSubExpr, NFC. 2020-04-22 15:29:41 -07:00
Chris Lattner a9045c0ff4 [EmitVerilog] Implement the bits/shl/shr primitives. 2020-04-22 15:12:08 -07:00
Chris Lattner 4b210ac41a [EmitVerilog] Tidy up printing of input-only port lists. 2020-04-22 14:00:17 -07:00
Chris Lattner df65777c64 [EmitVerilog] add support for instances referring to parameterized extmodules. 2020-04-22 13:52:35 -07:00
Chris Lattner 4abf063c7a [VerilogEmitter] Implement support for instances.
This doesn't handle parameters yet.
2020-04-22 13:20:39 -07:00
Chris Lattner 80a67e70f8 [FIRParser] Correctly persist extmodule defname and parameters in
the IR.
2020-04-22 11:24:24 -07:00
Chris Lattner 126b62a5cc Give the FIR parser an options struct to configure it. Change firtool
to default to ignoring @info locations for now.  I don't need firtool to
report errors pointing at Scala files right now, I need it pointing to
the .fir files.  The default can be switched back as things mature.
2020-04-22 09:44:36 -07:00
Chris Lattner c3f7b133bb [EmitVerilog] Ignore extmodules when emitting verilog. 2020-04-22 09:37:10 -07:00
Chris Lattner 56bd282978 [EmitVerilog] emit wire declarations for intermediate values
used by expressions and node declarations.  Also add a newline
between ports and wire decls and the body for clarity.
2020-04-21 22:55:25 -07:00
Chris Lattner 2289c5ca39 Drop some defaulted attribute lists, NFC. 2020-04-21 22:11:16 -07:00
Chris Lattner 0f98ce99de Introduce a new 'firtool' command with a simplified user interface. 2020-04-21 14:38:09 -07:00
Chris Lattner 69518665e0 Introduce an 'asPassive' operand to convert input values to passive
values, fixing a bug in the FIR parser when handling when conditions.

Also update some stale paths that should have been updated in a previous
patch... *shakes fist at non-hermitic ninja builds*
2020-04-20 21:05:21 -07:00
Chris Lattner 386699b142 Implement some basic casts that turn into no syntax. 2020-04-20 18:24:31 -07:00
Chris Lattner b206a59955 Implement a simple classification scheme in ExprVisitor, allowing better factoring of
code. NFC.
2020-04-20 15:28:09 -07:00
Chris Lattner cb5933029b Move syntax info into the prepass over the expression. NFC. 2020-04-20 15:19:36 -07:00
Chris Lattner 4c572ad611 Generalize the ExprVisitor to allow passing down extra values. Use this to
pass down the SubExprInfo for the current node.  NFC.
2020-04-20 15:09:44 -07:00
Chris Lattner 79cf7f52f5 Implement support for parentheses insertion in order to respect
operator precedence.
2020-04-20 14:59:00 -07:00
Chris Lattner 099efbebec Sketch out a bunch more binary operators, add testcases for some
invalid precedence and sign issues we have.
2020-04-20 11:21:45 -07:00
Chris Lattner 2d126f3772 [emitVerilog] Implement support for integer constants and remainder. 2020-04-19 18:33:45 -07:00
Chris Lattner 136ff0a547 implement skip and a few more unary operators, fill out the rest of the expr visitor. 2020-04-19 18:15:25 -07:00
Chris Lattner 1efc18e7a3 Add a testcase for multi-use expressions, which we already support. 2020-04-18 22:59:41 -07:00
Chris Lattner 359f64b77e Implement basic expression emission to verilog, starting with name
references XorR and AndR, and the error case.

This isn't correctly set up to handle signedness or precedence yet,
but that doesn't matter for these operators.
2020-04-18 22:55:03 -07:00
Chris Lattner e98d9d1429 Introduce a symbol table with proper name uniquing. Build it from
all the declarations and multiply-used expressions in a module body.
2020-04-17 17:41:12 -07:00
Chris Lattner 10a1793484 Refactor the verilog emitter into different classes, making way for
module-local state.
2020-04-17 15:38:02 -07:00
Chris Lattner b179ab36e0 Eliminate the IR subdirectory of include/spt/Dialect/FIRRTL, flattening its
contents into the parent directory.  NFC.
2020-04-17 09:53:48 -07:00
Chris Lattner 856f298cae Rearrange the firrtl dialect header and implementations, breaking them
down into a dialect/types/ops schema.  NFC.
2020-04-17 09:49:40 -07:00
Chris Lattner b418ed8044 update to mainline mlir 2020-04-15 22:05:54 -07:00
Chris Lattner da29d307e9 [EmitVerilog] Building scaffolding for the future, fix minor issues.
Implement an expression visitor for FIRRTL, fix some issues with
empty modules, make no-port modules prettier, add support for
indentation, improve the verilog emitter tests.
2020-04-15 17:12:36 -07:00
Chris Lattner cf8bff0b98 Implement support for printing out the port list in a module. 2020-04-15 14:53:38 -07:00
Chris Lattner 2b9ca28432 Completely drop 'node' definitions if their names are dropped. This
speeds up the parser by another 13%.
2020-04-15 14:04:25 -07:00
Chris Lattner e9c8af224c Introduce a simple cache of constant operations. Firrtl input has a ton
of redundant constants due to its expression oriented nature.  Caching
them avoids creating obviously pointless IR, speeding up the parser by
about 20%.
2020-04-15 13:50:18 -07:00
Chris Lattner f57236aa18 Tighten up the definition of firrtl.constant, adding verifier constraints
fixing the weird 1024 bit limitation, and tightening it up to IntType
specifically.  NFC.
2020-04-15 12:01:34 -07:00
Chris Lattner d65f385d06 Link the CSE pass into spt-opt, it deletes one half of the lines in the "low"
output I'm looking at, going from 1.2M lines of IR to 630K, largely by
eliminating duplicate constants.
2020-04-15 11:38:40 -07:00
Chris Lattner 499b89216d Start emitting the module scaffolding. 2020-04-14 21:33:23 -07:00
Chris Lattner 0d441cee3f Stub out circuit/module walking and some other boring infra. 2020-04-14 21:27:20 -07:00
Chris Lattner 628be893e0 Rename FIRToMLIR.h -> FIRParser.h, remove some dead state from FIRParser.cpp, NFC. 2020-04-14 21:01:42 -07:00
Chris Lattner c890451efc Rename FIRToMLIR.h -> FIRParser.h, remove some dead state from FIRParser. NFC. 2020-04-14 21:01:14 -07:00
Chris Lattner aa1deb3371 Stub out a (currently useless) verilog emitter. 2020-04-14 20:58:01 -07:00
Chris Lattner 46342c37bb rename the command line flag for parsing a fir file, wrap a long line
to 80 columns.
2020-04-14 20:30:24 -07:00
Chris Lattner 90b222b65a When parsing .fir files, ignore the _T* names on declarations. They
are temporary names that are not important to preserve.
2020-04-13 21:56:55 -07:00
Chris Lattner d939853cb5 Use a pretty name for constant operations to make it easier to read the IR. 2020-04-13 17:11:37 -07:00
Chris Lattner cfba8c2d08 fix a .mlir parser ambiguity with firrtl.printf, enable the
canonicalization pass in spt-opt.

Right now it seems to be doing trivial dead code elimination of
unused primitive and node operations.
2020-04-13 16:48:20 -07:00
Chris Lattner 0377defeb8 Rename test/fir to test/FIRParser to match the library name. NFC. 2020-04-13 12:48:44 -07:00
Chris Lattner 66d332fe35 Move the FIRParser out of the FIRRTL dialect directory, NFC. 2020-04-13 09:57:28 -07:00
Chris Lattner d9f26e81d7 trivial cleanup, NFC. 2020-04-13 08:52:17 -07:00
Chris Lattner a732532fcf Implement support for the validif expression. With this, we can now
parse all of my none/high/mid/low examples!
2020-04-12 16:44:47 -07:00
Chris Lattner d11f90d63a Implement support for 'mem' declarations.
This gets me from line 16703 -> 460623 of my high.fir example.
2020-04-12 16:34:50 -07:00
Chris Lattner f1d6672c03 Implement a canonical form for FlipType's, ensuring they are always
propagated to the outer level of a type when possible.
2020-04-12 11:47:08 -07:00
Chris Lattner db5ed962c6 Introduce a new IntType class, which is the common base between
SIntType and UInt type, simplifying a bunch of code.  NFC.
2020-04-12 11:21:49 -07:00
Chris Lattner 4864e0ec74 Update to latest MLIR. 2020-04-12 10:58:47 -07:00