aboutsummaryrefslogtreecommitdiff
path: root/src/main/antlr4/FIRRTL.g4
AgeCommit message (Collapse)Author
2022-09-12Handle new keyword version as an identifier (#2550)Jack Koenig
2022-08-26FIRRTL version support (#2543)Zachary Yedidia
* Parse version and hardcode emitted version * Throw error if version is too high * Parse version even if rest is invalid * Change pattern match to if statement * Improve version grammar * Update tests * Remove outdated comment * Simplify grammar and use version class * Simplify and add no version test * Fix for conflicting lexer rule
2021-12-01Handle references better in ANTLR ParserJack Koenig
Tweak the grammar to handle references without left-recursion. Also split references and subreferences out from the regular expression rule to make their parsing more efficient.
2021-10-09Support parsing missing keywords as ids (#2381)Jack Koenig
Reset, AsyncReset, Interval, attach, assert, assume, and cover have all been added as keywords but not added to the allowlist for parsing as ids.
2021-02-17Allow Side Effecting Statement to have Names (#2057)Kevin Laeufer
* firrtl: add optional statement labels for stop, printf, assert, assume and cover * test: parsing of statement labels * ir: ensure that name is properly retained * SymbolTable: add support for labled statements * test: parsing statement labels * test: lower types name collisions with named statements * ignore empty names * Inline: deal with named and unnamed statements * RemoveWires: treat stop, printf and verification statements as "others" * test: fix InlineInstance tests * DeadCodeEliminations: statements are now als declarations * CheckHighForm: ensure that statement names are not used as references * CheckSpec: throw error if statement name collides * add pass to automatically add missing statement names * check: make sure that two statements cannot have the same name * stmtLabel -> stmtName * scalafmt * add statement names to spec * spec: meta data -> metadata * EnsureStatementNames: explain naming algorithm * remove returns * better namespace use * ir: add CanBeReferenced trait * ir: add newline as jack requested
2020-09-16Change to Apache 2.0 License (#1901)Chick Markley
2020-06-23Basic model checking API (#1653)Tom Alcorn
* Add assume, assert, cover statements * Assert submodule assumptions * Add warning when removing verification statements * Remove System Verilog behaviour emitter warning * Add option to disable AssertSubmoduleAssumptions * Document verification statements in the spec The syntax for the new statements is assert(clk, cond, en, msg) assume(clk, cond, en, msg) cover(clk, cond, en, msg) With assert as a representative example, the semantics is as follows: `clk` is the clock, `cond` is the expression being asserted, `en` is the enable signal (if `en` is low then the assert is not checked) and `msg` is a string message intended to be reported as an error message by the model checker if the assertion fails. In the Verilog emitter, the new statements are handled by a new `formals` map, which groups the statements by clock domain. All model checking statements are then emitted within the context of an `ifdef FORMAL` block, which allows model checking tools (like Symbiyosys) to utilize the statements while keeping them out of synthesis flows. Co-authored-by: Albert Magyar <albert.magyar@gmail.com>
2020-03-26Support octal and binary literal formats as described in the specAlbert Magyar
* Fixes #1464
2019-11-04Add explicit EOF to top-level parser rule (#1217)Albert Magyar
* Fixes #1154 * Tests that #1154 example produces SyntaxErrorsException * Generally helps catch trailing syntax errors * Performance-neutral relative to previous grammar * Recommended by antlr4 devs, can help performance in some cases * See antlr/antlr4#1540
2019-10-18Upstream intervals (#870)Adam Izraelevitz
Major features: - Added Interval type, as well as PrimOps asInterval, clip, wrap, and sqz. - Changed PrimOp names: bpset -> setp, bpshl -> incp, bpshr -> decp - Refactored width/bound inferencer into a separate constraint solver - Added transforms to infer, trim, and remove interval bounds - Tests for said features Plan to be released with 1.3
2019-09-30Improve read-under-write parameter supportAlbert Magyar
* Make the read-under-write (RUW) parameter typesafe * Add RUW support to the FIRRTL proto and CHIRRTL grammar
2019-08-13Infer reset (#1068)Jack Koenig
* Add abstract "Reset" which can be inferred to AsyncReset or UInt<1> * Enhance async reset initial value literal check to support aggregates
2019-06-28Fix typo (#1101)Leway Colin
* Fix typo * Fix simple_rest typo Co-Authored-By: jack koenig <jack.koenig3@gmail.com> * simple_reset isn't a Array due to 'simple_reset+' change to 'simple_reset' in FIRRTL.g4
2019-02-14Asynchronous Reset (#1011)Jack Koenig
Fixes #219 * Adds AsyncResetType (similar to ClockType) * Registers with reset signal of type AsyncResetType are async reset registers * Registers with async reset can only be reset to literal values * Add initialization logic for async reset registers
2018-06-11Allow escaped single quotes in RawParams (#820)Richard Lin
Escape raw params using \'
2017-04-28Add info on reset block lines to ANTLR grammar (#468)Albert Magyar
Fixes #409
2017-03-09Sint tests and change in serialization (#456)Adam Izraelevitz
SInt representation is no longer 2's complement, but instead a positive number (hex or base 10) that is optionally preceded by a sign (-+).
2017-03-01Allow nested digit fields in subfield expressionsJack Koenig
Workaround for #470. This allows parsing DoubleLits in subfield expressions.
2017-03-01Fix bug in Lexer rule for DoubleLit and add testsJack Koenig
2017-02-23Add support for bundle fields to start with digits (#462)Jack Koenig
Also remove parsing support for ids with characters not supported in Verilog nor in the Firrtl spec
2017-02-07Rework Attach to work on arbitrary Analog hierarchies (#415)Jack Koenig
* Rework Attach to work on arbitrary Analog hierarchies If there are zero or one Analog sources in an Attach (source meaning wire or parent module port), then the Attach will be emitted as a simple point to point connection. In the general case, alias is used for simulation while forwards and backwards assigns for synthesis. Verilator does not currently support the general case so an `ifdef Verilator `error is emitted. * Add helper functions for creating WRef from Reg and Wire
2016-11-04Cleanup license at top of every file (#364)Jack Koenig
Replace with more sensible comment to see LICENSE rather than including the whole license in every file
2016-10-26Add RawString ExtModule parameter supportjackkoenig
While unsafe, this supports Verilog parameter types. Tests now require Verilator 3.884+ to pass.
2016-10-26Add Support for Parameterized ExtModules and Name Overridejackkoenig
Adds support for Integer, Double/Real, and String parameters in external modules. Also add name field to extmodules so that emitted name can be different from Firrtl name. This is important because parameterized extmodules will frequently have differing IO even though they need to be emitted as instantiating the same Verilog module.
2016-10-17Add fixed point type (#322)Adam Izraelevitz
* WIP: Adding FixedType to Firrtl proper Got simple example running through width inference Checks should be ok Need to look into FixedLiteral more * Added simple test for fixed types * Added asFixedPoint to primops * Added tail case for FixedType * Added ConvertFixedToSInt.scala Added pass to MiddleToLowerFirrtl transform * Replace AsFixedType with AsSInt in fixed removal * Bugfix: constant from asFixed not deleted * Added unit test for bulk connect * Fixed partial connect bug #241 * Fixed missing case for FixedPoint in legalizeConnect * Add FixedMathSpec that demonstrates some problems with FixedPointMath * Fixed test and ConvertToSInt to pass. Negative binary points not easily supported, needs much more time to implement. * Refactored checking neg widths Make checking for negative binary points easier * Added tests for inferring many FixedType ops shl, shr, cat, bits, head, tail, setbp, shiftbp * Handle bpshl, bpshr, bpset in ConvertFixedToSInt Changed name from shiftbp -> bpshl, bpshr Change name from setbp -> bpset Added more tests * Added set binary point test that fails * Added simple test for zero binary point * gitignore fixes for antlr intermediate dir and intellij dir * removed unused imports retool the fixed point with zero binary point test * simplified example of inability to set binary point to zero * Temporary fix for zero-width binary point This fix allows for all widths to be zero, but since this is a feature I am working on next, I'm not going to bother with a more stringent check. * change version for dsp tools * Removed extra temporary file * Fixed merge bug * Fixed another merge bug * Removed commented out/unrelated files * Removed snake case
2016-09-25Spec features added: AnalogType and Attach (#295)Adam Izraelevitz
* Spec features added: AnalogType and Attach AnalogType(width: Width): - Concrete syntax: wire x: AnalogType<10> - New groundtype, very restricted in use cases. - Can only declare ports and wires with Analog type - Analog types are never equivalent, thus if x and y have Analog types: x <= y is never legal. Attach(info: Info, source: Expression, exprs: Seq[Expression]): - Concrete syntax: attach x to (y, z) - New statement - Source can be any groundtyped expression (UInt, SInt, Analog, Clock) - Exprs must have an Analog type reference an instance port - Source and exprs must have identical widths Included WDefInstanceConnector to enable emission of Verilog inout Should be mostly feature complete. Need to update spec if PR gets accepted. * Fixed bug where invalidated ports aren't handled * Bugfix for VerilogPrep Intermediate wires for invalidated instance ports were not invalidated * Bugfix: calling create_exp with name/tpe Returns unknown gender, which was passing through Caused temporary wire to not be declared Because Verilog is dumb, undeclared wires are assumed to be 1bit signals * Addressed donggyukim's style comments * Reworked pass to only allow analog types in attach Restrict source to be only wire or port kind Much simpler implementation, almost identical functionality Clearer semantics (i think?) * Fixup bugs from pulling in new changes from master * comments for type eqs and small style fixes
2016-07-21Indentation support for the ANTLR parser (as discussed in #192) (#194)Kamyar Mohajerani
Indentation support for the ANTLR parser - some clean-up of the parser code (TODO: file input could be improved, more clean-up) - get rid of Translator and specify all syntactic rules in antlr4 grammer - support for else-when shorthand in the grammar - rename Begin to Block which makes more sense
2016-05-12Implement File Infojackkoenig
2016-04-16Add more keywords to Id listjackkoenig
2016-03-09Fix StringLit to ignore escaped double quotesdavidbiancolin
2016-02-09Added license to FIRRTL filesazidar
2016-02-09Added remaining check passes. Ready for open sourcingazidar
2016-02-09CHIRRTL passes work, parser is updatedazidar
2016-02-09Bug Fixes in handling hyphens as part of IDs, proper handling of negative ↵Jack
IntLits (all IntLits handled by Parser and Visitor the same, checks come later), also delete first and last char of string literals since those characters are the quotes.
2016-02-09Adding ScalaTest for unit testing of Scala FIRRTL. Added a few basic tests ↵Jack
for the Parser. Added custom Parser exceptions for better error reporting and checking. Fixed bug in grammar not allowing most keywords as Ids
2016-01-29Changed reg syntax to new "with" semantics in Scala FIRRTLJack
2016-01-28WIP: Added support for FIRRTL 0.2.0 Memories to Scala FIRRTLjackkoenig
2016-01-28Move IntLit ANTLR lexer rule to before String lexer rule to ensure IntLit of ↵jackkoenig
form "h..." is lexed as IntLit instead of String
2016-01-27WIP Moving Scala FIRRTL to match spec 0.2.0. Not everything is implemented ↵jackkoenig
(notably stop, printf, mux, validif, ubits, sbits, readers, writers, and readwriters are incomplete)
2015-11-24In process of adding FAME-1 transformation, updated todos in grammar file, ↵jackkoenig
updated Makefile to play nicer when firrtl is a submodule, fixed bug in Translator for single line scopes, fixed firrtl-scala script to point to firrtl.Driver instead of old firrtl.Test
2015-10-15Reorganized Primops (renamed from PrimOps), added maps and functions to ↵Jack
convert object <=> string, added eqv and neqv
2015-10-12Added support for no width to mean unknown, and print nothing instead of <?> ↵Jack
for unknown width. Also added test to check this
2015-10-02Merged in Scala implementation of FIRRTL IR, parser, and serialization (ie. ↵Jack
AST -> String). Uses ANTLRv4 to generate concrete syntax parser