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
Chris Lattner
be0cce9f0f
Reduce malloc traffic of the scoped hash tables, providing a small
...
speedup, NFC.
2020-04-11 17:42:00 -07:00
Chris Lattner
a020c0a616
Implement lexer support for floating point literals, which are used
...
in parameter declarations for extmodules.
This gets us from line 574440 through the entire 599731 lines of my
none.fir example! 🎉
2020-04-10 15:29:28 -07:00
Chris Lattner
ed004f6b4f
Expand the exp-stmt ambiguity fix beyond reg to all the other keywords
...
affected.
This gets us from line 523195 -> 574440.
2020-04-10 14:24:00 -07:00
Chris Lattner
254ade5499
implement the head primitive.
...
This gets us from line 478926 -> 523195
2020-04-10 14:12:18 -07:00
Chris Lattner
436775f583
Implement support for andr/orr/xorr primitives.
...
This gets us from line 286798 -> 455909.
2020-04-10 09:54:42 -07:00
Chris Lattner
cc624980ca
Implement support for the 'pad' primitive.
...
This gets us from line 286256 -> 286798.
2020-04-10 09:51:09 -07:00
Chris Lattner
95e8ddcbe8
Chisel has a bug where the "chirtl" emitted by the frontend violates scoping
...
rules for mports in certain cases. Detect this problem and emit workaround
logic so we get a properly scoped IR, and maintain compatiblity with whatever
Chisel is generating.
This gets us from line 280412 -> 286256 in my testcase.
2020-04-09 22:17:30 -07:00
Chris Lattner
2aafff1c4e
Implement full support for mport, as well as encoding the direction
...
in the IR as an enum.
This gets us from line 280409 -> 280412.
2020-04-09 14:34:39 -07:00
Chris Lattner
e7255fafd4
Implement support for smem, which happens to be the first op that takes an enum Attr.
...
This gets us from line 280246 -> 280409.
2020-04-09 14:16:30 -07:00
Chris Lattner
1730aa424a
Fix a bug handling the 'else' ambiguity with 'when' statement. A hanging
...
else may contain to an outer 'when' if it is less indented than the when
itself.
This gets us from line 184523 -> 280246.
2020-04-09 13:37:32 -07:00
Chris Lattner
837eb1eef8
Fix a bug where I incorrectly rejected oversized shift right primitives.
...
The spec is very clear about this - the result is a one bit value containing
a zero or sign, depending on the signedness of the input.
This gets us from line 183754 -> 184523.
2020-04-09 13:13:02 -07:00
Chris Lattner
426fd43bfb
Teach the parser how to handle the ambiguity between statements that
...
start with a keyword and statements that start with an expression whose
leading identifier is a keyword according to the lexer.
This requires one token lookahead, which is simple enough to factor into
the parser.
This gets us from line 176672 -> 183754.
2020-04-09 13:08:07 -07:00
Chris Lattner
1886e399fb
Implement the asAsyncReset() primitive and AsyncReset type, two more
...
completely undocumented things in the firrtl spec... :-/
This gets us from line 176668 -> 176672
2020-04-09 12:08:50 -07:00
Chris Lattner
952230044b
Add support for arbitrary width constants like
...
UInt<96>("hffffffffffffffffffffffff"), and up to 1024 bit constants
that have no width specified (a temporary limitation).
This gets us from line 68142 -> 176668 of my testcase.
2020-04-09 11:57:48 -07:00
Chris Lattner
d00dc982b5
Commas are actually whitespace in .fir files, a fact I completely missed!
...
Correct this in the lexer, simplifying the parser quite a bit.
2020-04-09 10:46:28 -07:00
Chris Lattner
6f95fbc65e
Implement support for mport. This operation is completely undocumented,
...
so I'm not 100% sure about its semantics, the infer case is pretty clear
though, so it is enabled and the others are disabled.
This gets us from line 16723 -> 68142.
2020-04-09 10:39:09 -07:00
Chris Lattner
a2f3c3e9a1
Rearrange the parsing logic a bit to separate statement from decl parsing. NFC.
2020-04-08 14:53:55 -07:00
Chris Lattner
5a1bbfa3c1
Implement support for cmem declarations.
...
This gets us from line 16703 to 16723.
2020-04-08 14:50:09 -07:00
Chris Lattner
bb22299024
Fix a bug in the previous commit: we should ignore flip types when checking dynamic
...
access expressions.
2020-04-08 13:55:56 -07:00
Chris Lattner
c5529e53b3
Implement dynamic subaccesses.
...
This gets us from line 15841 -> 16703.
2020-04-08 13:53:14 -07:00
Chris Lattner
66179ce4b1
Build out type system infra for working with Passive types. Change primitives
...
to always strip out directionality from their operands.
This gets us from line 6175 -> 15841 in the testcase I'm working with.
2020-04-08 13:25:46 -07:00
Chris Lattner
0e95d97f1f
Teach the mlir asmprinter to use the name attribute (when present) to
...
name the result SSA values, this makes the asmdumps waaay more readable.
2020-04-08 11:31:46 -07:00
Chris Lattner
2c987c32ff
Fix a super subtle bug: we were strlen'ing the entire buffer every time
...
we returned an lp_ keyword, which is N^2 work with a very large N
(particularly when your testcase is half a megabyte of .fir)!
This speeds up the parser from 12.75s -> 0.09s (!!!), which feels better
to me :)
2020-04-08 10:40:50 -07:00
Chris Lattner
e355599edf
Switch from isdigit/isalpha to the LLVM equivalent of these. The
...
standard C implementations have terrible wide-character support gunk in
them, which make them slow.
This seems silly, but it speeds up the firrtl parser from 16s -> 12s on
one example, a 25% reduction. You know you're doing well when you're
limited by the lexer :-)
2020-04-08 10:21:47 -07:00
Chris Lattner
2c3c4a7a73
Self referential registers are a leak of internal implementation details
...
from the Scala-FIRRTL implementation, update the code to reflect this and
remove the warning. We retain compatibility with this form though.
2020-04-08 09:48:38 -07:00
Chris Lattner
d10f71b3a8
fix some UB that was causing test failures when the optimizer is enabled.
2020-04-07 16:09:37 -07:00
Chris Lattner
e7bd39e6de
Implement IR support for extmodule. This still drops parameter and
...
defname from the IR, but they can be added later.
This gets us from line 3899 -> 6175 of my testcase.
2020-04-07 13:12:09 -07:00
Chris Lattner
cb9980acdb
Add support for instances and for Circuits to be symbol tables
...
that hold the modules.
Our testcase is still stuck at line 3899 because we don't have an IR
representation for external modules yet.
2020-04-06 22:43:43 -07:00
Chris Lattner
e1f5c2a8e3
Add a horrible hack to accept but ignore self referential registers.
...
I'll have to come back to this later.
This gets us from line 3499 -> 3899
2020-04-06 21:46:01 -07:00
Chris Lattner
2bf817db2b
Implement the tail primitive.
...
This gets us from line 3487 -> 3499.
2020-04-06 21:32:02 -07:00
Chris Lattner
2b7bc56dc2
Implement div, rem, mul, sub primitives.
...
This gets us from line 3486 -> 3487
2020-04-06 21:24:27 -07:00
Chris Lattner
93fbd90066
Implement support for registers.
...
This gets us from line 3484 to 3486.
2020-04-06 21:10:57 -07:00
Chris Lattner
92e910b574
update for mainline MLIR changes.
2020-04-06 13:49:50 -07:00
Chris Lattner
b8a16a112c
Implement a simple mux implementation for SInt/UInt/Clock/Reset. Bundles
...
and vectors are not supported yet.
This gets us from line 606 to 3484.
2020-04-06 13:15:32 -07:00
Chris Lattner
b9103ef13f
Add support for up to 64-bit constant expressions.
...
This gets us from line 473 -> 606.
2020-04-05 23:15:45 -07:00
Chris Lattner
db002bcea4
Implement cat and cvt primitives.
...
This progresses us from line 395 to line 473.
2020-04-05 20:55:25 -07:00
Chris Lattner
7af3ce2c29
Implement not and neg operators.
...
This gets us from 284 -> 395.
2020-04-05 17:36:09 -07:00
Chris Lattner
99e1c28469
implement dshl/dshr primitives.
...
This gets us from line 282 -> 284.
2020-04-05 17:31:37 -07:00
Chris Lattner
4a924aec4b
implement shl/shr primitives.
...
This gets us from 256 -> 282.
2020-04-05 17:18:55 -07:00
Chris Lattner
4bb269d91f
implement 'bits' primitive.
...
255 -> 256
2020-04-05 17:04:04 -07:00
Chris Lattner
c99cf6e954
Implement parser and IR support for 'stop'.
...
This gets us from line 253 -> 255.
2020-04-05 15:03:22 -07:00
Chris Lattner
2d04b15291
Implement support for printf.
...
This gets us from line 252 -> 253
2020-04-05 14:49:23 -07:00
Chris Lattner
aab88c0d10
add lexer support for lp keywords that are not primitives, these are
...
used for printf( and stop(. NFC.
2020-04-05 14:28:17 -07:00