Commit Graph

1040 Commits

Author SHA1 Message Date
Shivam Gupta 3c75cfb25b
use # for headers instead of ====
ref: see Markdown documentation- https://guides.github.com/features/mastering-markdown/
2021-01-12 21:11:49 +05:30
Chris Lattner 09076a5762 [LowerToRTL] Fix Issue #429.
Also tighten up some assertions to catch the bug earlier next time.
2021-01-11 23:07:33 -08:00
Chris Lattner 43ad71b972 [FIRRTL] implement constant folding for AsUInt and AsSInt primitives. 2021-01-11 22:52:03 -08:00
Chris Lattner cb1a638864 [FIRRTL] rename OpFolds.cpp -> FIRRTLFolds.cpp for consistency. 2021-01-11 22:45:32 -08:00
Chris Lattner 9e875b7eb2 [FIRRTL] Fix Issue #432, a crash on a full width extract due to a sign change. 2021-01-11 22:43:38 -08:00
mikeurbach 40b6354916
[HandshakeToFIRRTL] Add MemoryOp lowering. (#417)
* [HandshakeToFIRRTL] Add MemoryOp lowering.

This adds a basic lowering from MemoryOp. The appropriate
data signals are connected and the control signals are built
similarly to the ForkOp and JoinOp. The memory uses a read
latency of 0, a write latency of 1, and returns the old value for read
under write. This is part of https://github.com/llvm/circt/issues/337.
2021-01-11 17:30:13 -07:00
Andrew Lenharth ce05aca1da
Fix failure in concat/extract canonicalization (#427) 2021-01-11 17:08:07 -06:00
John Demme ebaa8692db [Integration test] Fixing two recent breakages
Causes:
- ZExt removal
- Commandline test didn't account for capnp builds
2021-01-11 12:23:08 -08:00
John Demme 8f69a6275a
[ExportVerilog] Fixing package dimension ordering (#424)
The lint integration test which was supposed to be testing this wasn't
being emitted. Fixed that and discovered warnings.

I *think* the packed dimensions were being emitted backwards. Someone
please check me on this.
2021-01-11 10:43:19 -08:00
Andrew Lenharth f16aa4229f
Infer some types for some firrtl operations (#420)
Infer some types for some firrtl operations
2021-01-11 11:37:41 -06:00
Chris Lattner ada31f1c90 [FIRParser] Diagnose too large constants in UInt<>() and SInt<>() exprs.
This also adds verification that firrtl.constant isn't zero width.
2021-01-10 16:34:45 -08:00
Chris Lattner dd9ccecbb5 [RTL] remove the rtl.zext operator, using a concat instead.
It wasn't pulling its weight and added more complexity than it saved.
See the rationale doc for more information, as well as why sext still
makes the cut.
2021-01-10 15:58:29 -08:00
Chris Lattner 725820c594 [RTL] Split the fold/cannonicalization logic out to its own .cpp file. NFC. 2021-01-10 15:31:53 -08:00
Chris Lattner 397de12ba7 Utilize better typed getType() members in ODS to eliminate a bunch of casts. 2021-01-10 15:23:36 -08:00
Chris Lattner 62fca46856 The new LLVM merge brought in the ability to associate C++ types with
MLIR type predicates.  Start using them.  This should eliminate the
need for a bunch of casts.
2021-01-10 15:05:08 -08:00
Chris Lattner b61cded05a [RTL] Fix rtl::WireOp builder ambiguity that forced a name. NFC. 2021-01-10 14:27:22 -08:00
Chris Lattner eff675bc26 [RTL] Change order of operands to rtl::ConstantOp builder.
This makes it more consistent.  Also, remove the static type
requirement that the type be an integer type, for consistency and
ease of use.
2021-01-10 14:06:19 -08:00
Andrew Young 578a55aded
Update LLVM submodule
1. Update LLVM submodule

2. Update circt-translate help message

New version of MLIR properly prints the help message. This updates the
command line test for it.

3.Do not use methods from OpState that just forward to Operation

These methods are being removed from mlir::OpState in reviews.llvm.org/D94191

3. Use standard integer types in LLHDToLLVM

The type system for the LLVM dialect is undergoing changes to use types
from the standard dialect. This includes the removal of LLVM integer
types, removal of the common parent type LLVMType, new helpers for
working with LLVM structs, arrays, and pointers.

for more information see:
reviews.llvm.org/D94178
reviews.llvm.org/D93680
reviews.llvm.org/D93713
2021-01-10 13:38:50 -08:00
Chris Lattner 704d747f39 [LowerToRTL] Final cleanup pass. Zero width support should be complete. 2021-01-10 13:29:34 -08:00
Chris Lattner 5ad3ed1f64 [LowerToRTL] Clean up the code a bit, make testcase consistent.
The getPossiblyInoutLoweredValue contract is now much simpler, because
the stdintcast and analog cast operations don't pass non-FIRRTL operands
into them.

Change the testcase to align with what is produced by LowerToRTLModule now.
2021-01-10 13:11:46 -08:00
Chris Lattner 334af20036 [LowerToRTL] Lower wire/connect/attach when they are zero bits. 2021-01-10 12:54:46 -08:00
Chris Lattner 541794a874 [LowerToRTL] Add more zero bit arithmetic cases. 2021-01-10 12:43:08 -08:00
Chris Lattner c821a0f3d1 [LowerToRTL] Lower instances with zero bit ports. 2021-01-10 12:25:26 -08:00
Chris Lattner 1c9f776928 [LowerToRTL] Change module port lowering to drop zero-bit input/inout ports.
We can't provide a value to them on the instance side.
2021-01-10 12:05:56 -08:00
Chris Lattner 5667128404 [LowerToRTL] Add support for zero bit module ports.
We need the handle zero-bit outputs specially because we cannot
materialize a zero bit value at the RTL level (we don't have anything
like undef or poison), so we promote them to inout values.
2021-01-10 11:35:23 -08:00
Chris Lattner 5ab91b90fc [FIRRTL] Document andr/xorr/orr behavior on zero bit inputs. NFC. 2021-01-10 11:05:03 -08:00
Chris Lattner 057224ca63 [LowerToRTL] Add support for primitives that return zero bit results.
Since the lowering is the same for all primitives, we handle it
centrally, rather than making them all think about it.

This also checks in the testcase I forgot to git add.
2021-01-10 10:44:39 -08:00
Chris Lattner 0176805fec [LowerToRTL] Implement support for operands extended from zero bits.
FIRRTL has many operations that implicitly extend their operands to
a result width.  When the input has zero bits and the extended
destination is larger, then the resultant value is zero.  Implement
this, which is enough for Issue #328.

Zero width type support is still not complete, more to come.
2021-01-09 23:43:32 -08:00
Chris Lattner 4d89644884 [LowerToRTL] Add infra support for zero bit wires, and a couple ops.
This starts with andr/orr/xorr/concat, fixing Issue #319.
2021-01-09 22:16:14 -08:00
Chris Lattner 4e1b86156d [LowerToRTL] Trim out some code that was used when lowering was partial. NFC.
Now that we lower all FIRRTL operations we can upgrade things to errors and
trim out the defensive code.  This isn't exercised anyway, so NFC.
2021-01-09 21:27:54 -08:00
Schuyler Eldridge 028afefd8a
[FIRRTL] Convert register clock, reset, and init to passive during parsing (#425)
During parsing, optionally convert a register's clock, reset, or
initialization to a passive type if it is a sink. This causes CIRCT to
now accept circuits which the Scala FIRRTL Compiler (SFC) also
accepts.

Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
2021-01-10 00:21:40 -05:00
John Demme 28beb5e008 Revert "[ExportVerilog] Allow ArraySlices to be emitted inline"
This reverts commit ad023e876b.

Verilator complains (erroneously) about the width when an ADD is inside
the array slice. It doesn't when the expression is declared out-of-line.
2021-01-09 19:17:50 -08:00
Schuyler Eldridge 4cf6677a37 [FIRRTL] Use convertToPassive in parser, NFC
Use the convertToPassive utility two additional places in the parse
instead of duplicating the implementation.

Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
2021-01-09 22:09:16 -05:00
Chris Lattner f28a0c7e52 [RTL] Canonicalize concat of neighbering extracts, e.g. {A[3], A[2]} -> A[3,2] 2021-01-09 18:38:53 -08:00
Chris Lattner cb4bc4ed4c [RTL] Canonicalize concats into sext's. 2021-01-09 18:26:05 -08:00
Chris Lattner b098a7dd0c [RTL] Constant fold neighboring constants in a concat. 2021-01-09 18:18:56 -08:00
Chris Lattner 496aec1397 [RTL] canonicalize sext's into concats. 2021-01-09 18:18:56 -08:00
John Demme ad023e876b [ExportVerilog] Allow ArraySlices to be emitted inline
New ArraySlice Verilog syntax only uses the idx operator once.
2021-01-09 18:07:54 -08:00
Chris Lattner 99e47c7bdc [ExportVerilog] Emit a rtl.concat as a verilog replicate when possible. 2021-01-09 18:03:50 -08:00
Chris Lattner dd04a2e6fd [RTL] Simplify folder logic, NFC.
This makes more use of the constants the infra already passes to the
folder, instead of rechecking for them.
2021-01-09 17:52:56 -08:00
Chris Lattner 6a0235315b [RTL] Implement constant folding for rtl.concat ops. 2021-01-09 17:46:07 -08:00
Chris Lattner 48f77a9865 [RTL] Canonicalize concat(zext(op), ...stuff) -> concat(0, op, ...stuff) 2021-01-09 17:33:38 -08:00
Chris Lattner fa05e84822 [EmitVerilog] Change collectNamesEmitDecls to handle instances directly.
Before we had a division of the force between FIRRTL and RTL.  Now that
everything is consistent, they don't need to be a special case.  This
removes a bunch of code.
2021-01-09 16:57:31 -08:00
Chris Lattner a2bff094b6 [ExportVerilog] Code cleanups and simplifications, NFC
Merge emitBitSelect into its only caller.  Eliminate the duplicate
logic between "measuring" and "printing" of typedims, by printing to
temporary strings, measuring them, then ultimately emitting the string.
2021-01-09 16:44:02 -08:00
Chris Lattner 19c78896c2 Tidy up the .td files a bit, NFC.
This changes listconcat to use #, and uses string quotes more in
cases instad of [{}].  Thanks to Paul C. Anagnostopoulos for making
these cleanups possible.
2021-01-09 16:05:12 -08:00
Chris Lattner 9f04a3ef42 [ExportVerilog] Add support for zero bit ports. 2021-01-09 13:09:55 -08:00
Chris Lattner b0b29882c6 [RTL Dialect] Reject zero bit inputs/results to combinatorial operations.
This adds rationale as well.
2021-01-09 12:17:16 -08:00
Chris Lattner 023b7d7f6e [RTLTypes] Rearrange contents of this file, NFC. 2021-01-09 11:59:16 -08:00
Chris Lattner 0979b24df7 [FIRParser] Fix Issue #418, a bug I introduced in a recent refactoring. 2021-01-09 11:39:46 -08:00
Schuyler Eldridge c7064dd49a
[FIRRTL] Verify that NodeOp is passive (#416)
During parsing, add an asPassive cast to a node argument if it is
passive under an outer flip. Error if type is analog or underlying
type is not passive. Restrict a NodeOp's input to be passive.

Enables parsing of weird CHIRRTL circuits where a node is a "sink" (an
output port or an instance input).

Add test cases of this behavior.

Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com>
2021-01-08 13:48:32 -05:00