1. Apr 23, 2022
  2. Apr 12, 2022
  3. Mar 26, 2022
  4. Jan 28, 2022
    • mergify[bot]'s avatar
      Fix faulty MemorySynthInit behavior (backport #2468) (#2475) · 3ad2541e
      mergify[bot] authored
      
      
      * Fix faulty MemorySynthInit behavior (#2468)
      
      - Fix & test MemorySynthInit behavior with MemoryArrayInitAnnotation and MemoryScalarInitAnnotation.
      Add test case for MemoryRandomInitAnnotation which is, on the contrary, expected not to leak any randomization statement in synthesis context.
      
      - Refactor MemoryInitSpec for improved results readability
      
      Context:
      
      PR #2166 (commit: 4530152) introduced MemorySynthInit annotation to control whether statement generated with Memory*InitAnnotation (emitted within initial begin block in verilog) should be guarded with ifndef SYNTHESIS or not.
      Unfortunately only one configuration (MemoryFileInlineAnnotation) has been tested while the others have been generating incorrect verilog statements (MemoryArrayInitAnnotation and MemoryScalarInitAnnotation).
      
      Signed-off-by: default avatarJean Bruant <jean.bruant@ovhcloud.com>
      (cherry picked from commit 475c165c
      
      )
      
      # Conflicts:
      #	src/main/scala/firrtl/backends/verilog/VerilogEmitter.scala
      
      * Fix conflict
      
      Co-authored-by: default avatarJohn's Brew <46595442+johnsbrew@users.noreply.github.com>
      Co-authored-by: default avatarJean Bruant <jean.bruant@ovhcloud.com>
      3ad2541e
  5. Jan 06, 2022
    • mergify[bot]'s avatar
      Add FileInfo to asyncResetAlwaysBlocks (#2451) (#2452) · 1ce41603
      mergify[bot] authored
      * Add FileInfo to asyncResetAlwaysBlocks
      
      Always blocks need three FileInfo (if, true, false) to show line numbers,
      but initially, every always blocks only have one FileInfo (false).
      
      RemoveReset adds the extra two FileInfo to sync always blocks,
      so sync always blocks can have line numbers.
      
      Async always blocks don't provide their only FileInfo, so there are no line numbers.
      
      This commit gives async always block the extra FileInfo to show line numbers for them.
      
      This code:
      
      ```scala
      import chisel3._
      import chisel3.stage._
      import firrtl.CustomDefaultRegisterEmission
      
      class Test extends Module with RequireAsyncReset {
        val io = IO(new Bundle {
          val in = Input(Bool())
          val out = Output(Bool())
        })
        val valid = RegInit(false.B)
        valid := io.in
        io.out := valid
      }
      
      object Test extends App {
        new ChiselStage().execute(Array(), Seq(
          ChiselGeneratorAnnotation(() => new Test()),
          CustomDefaultRegisterEmission(useInitAsPreset = false, disableRandomization = true)
        ))
      }
      ```
      
      will generate this Verilog:
      
      ```verilog
      module Test(
        input   clock,
        input   reset,
        input   io_in,
        output  io_out
      );
        reg  valid; // @[Playground.scala 10:22]
        assign io_out = valid; // @[Playground.scala 12:10]
        always @(posedge clock or posedge reset) begin
          if (reset) begin // @[Playground.scala 10:22]
            valid <= 1'h0; // @[Playground.scala 10:22]
          end else begin
            valid <= io_in; // @[Playground.scala 11:9]
          end
        end
      endmodule
      ```
      
      they have correct line numbers (10, 10, 11).
      
      * Add test for async always block line numbers
      
      * Add comment for review
      
      (cherry picked from commit 3e494b5c
      
      )
      
      Co-authored-by: default avatarsinofp <sinofp@tuta.io>
      1ce41603
  6. Dec 01, 2021
  7. Sep 24, 2021
  8. Sep 18, 2021
  9. Sep 15, 2021
  10. Sep 09, 2021
  11. Aug 27, 2021
  12. Aug 21, 2021
  13. Aug 06, 2021
    • mergify[bot]'s avatar
      Fix Specification Memory Port Types (#2319) (#2322) · f7082a4a
      mergify[bot] authored
      
      
      Correct incorrect type specified for memories in the FIRRTL
      specification.  This is important because the memory type determines
      what is a legal bundle to try to connect to a memory port.
      
      I based this off of FIRRTL accepting the following circuit:
      
          circuit MemOrder:
            module MemOrder:
              input r: {addr : UInt<3>, en : UInt<1>, clk : Clock, flip data : UInt<1>}
              input w: {addr : UInt<3>, en : UInt<1>, clk : Clock, data : UInt<1>, mask : UInt<1>}
              input rw: {addr : UInt<3>, en : UInt<1>, clk : Clock, flip rdata : UInt<1>, wmode : UInt<1>, wdata : UInt<1>, wmask : UInt<1>}
      
              mem memory:
                data-type => UInt<1>
                depth => 8
                reader => r
                writer => w
                readwriter => rw
                read-latency => 1
                write-latency => 1
                read-under-write => undefined
      
              memory.r <= r
              memory.w <= w
              memory.rw <= rw
      
      Signed-off-by: default avatarSchuyler Eldridge <schuyler.eldridge@sifive.com>
      (cherry picked from commit 8abf3085
      
      )
      
      # Conflicts:
      #	spec/spec.pdf
      
      Co-authored-by: default avatarSchuyler Eldridge <schuyler.eldridge@sifive.com>
      f7082a4a
  14. Aug 04, 2021
  15. Aug 03, 2021
  16. Jul 21, 2021
    • mergify[bot]'s avatar
      Fix memory annotation deduplication (backport #2286) (#2294) · 4181e927
      mergify[bot] authored
      
      
      * Fix memory annotation deduplication (#2286)
      
      * Add transform to deduplicate memory annotations
      * Add annotation deduplication to Dedup stage
      * ResolveAnnotationPaths and EliminateTargetPaths now invalidate the dedup annotations transform
      * Verilog emitter now throws exception when memory annotations fail to dedup
      
      Co-authored-by: default avatarJack Koenig <koenig@sifive.com>
      (cherry picked from commit 4081d9f4
      
      )
      
      * Fix binary compatibility issues with memory anno dedup transform (#2295)
      
      * Remove unused exception in dedup transform
      * Fold Annotation.dedup() into dedup transform for binary compatibility
      * ResolvedAnnotationPaths no longer invalidates any transforms
      * Use Annotation.copy() instead of constructor in dedup logic
      
      Co-authored-by: default avatarJared Barocsi <82000041+jared-barocsi@users.noreply.github.com>
      4181e927
  17. Jun 23, 2021
    • mergify[bot]'s avatar
      Add --start-from option (backport #2273) (#2274) · 97dbe29e
      mergify[bot] authored
      
      
      * Add --start-from option (#2273)
      
      Add a new option to the FIRRTL compiler, "--start-from = <form>".  If
      used, this will cause the compiler to assume that the input FIRRTL
      circuit is already in the specific form.  It will then skip unnecessary
      passes given this information.
      
      E.g., if a user requests to run "firrtl -X verilog --start-from low"
      then the compiler will only run transforms necessary to get from low
      FIRRTL to Verilog.  Transforms necessary for ingesting FIRRTL IR will be
      run if needed (checks and type/kind/flow resolution).
      
      To implement this, a CurrentFirrtlStateAnnotation is added.  Advanced
      users can use this directly to tell the FIRRTL compiler exactly what
      transforms have already been run, including the ability to ignore checks
      or type/kind/flow resolution if they so desire.
      
      Signed-off-by: default avatarSchuyler Eldridge <schuyler.eldridge@sifive.com>
      (cherry picked from commit c7eaa67d
      
      )
      
      * Waive bincompat issues that don't affect Scala
      
      Co-authored-by: default avatarSchuyler Eldridge <schuyler.eldridge@sifive.com>
      Co-authored-by: default avatarJack Koenig <koenig@sifive.com>
      Co-authored-by: default avatarmergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
      97dbe29e
    • mergify[bot]'s avatar
      Fix VerilogMemDelays use before declaration (backport #2278) (#2280) · 270c9138
      mergify[bot] authored
      * Fix VerilogMemDelays use before declaration (#2278)
      
      The pass injects pipe registers immediately after the declaration of the
      memory. This can be problematic if the clock for the associated memory
      port is defined after the declaration of the memory. For any memory port
      clocks that are driven by non-ports, we now inject a wire before the
      pipe register declarations to be sure there are no
      use-before-declaration issues.
      
      (cherry picked from commit 11128d93
      
      )
      
      # Conflicts:
      #	src/main/scala/firrtl/passes/memlib/VerilogMemDelays.scala
      
      * Fix merge conflicts
      
      Co-authored-by: default avatarJack Koenig <koenig@sifive.com>
      270c9138
  18. Jun 17, 2021
  19. Jun 15, 2021
  20. Jun 04, 2021
  21. May 22, 2021
  22. May 19, 2021
    • mergify[bot]'s avatar
      Improve performance of RenameMap in LowerTypes (backport #2233) (#2234) · 899f1f6e
      mergify[bot] authored
      * Improve performance of RenameMap in LowerTypes (#2233)
      
      LowerTypes creates a lot of mappings for the RenameMap. The built-in
      .distinct of renames becomes a performance program for designs with
      deeply nested Aggregates. Because LowerTypes does not create duplicate
      renames, it can safely eschew the safety of using .distinct via a
      private internal API.
      
      (cherry picked from commit e0844966
      
      )
      
      * Waive bincompat issue that isn't visible from Scala
      
      Co-authored-by: default avatarJack Koenig <koenig@sifive.com>
      899f1f6e
  23. May 15, 2021
  24. May 05, 2021
  25. Apr 27, 2021
  26. Apr 22, 2021
  27. Apr 17, 2021
  28. Apr 16, 2021
    • mergify[bot]'s avatar
      Fix signedness of xor const prop with zero (#2179) (#2185) · 7dfb7a12
      mergify[bot] authored
      Constant propagation of the Xor op folds `xor(a, SInt(0))` to
      `asUInt(a)`. For comparison, Or folds to `asUInt(pad(a, W))`. This can
      be a problem in the following case:
      
          circuit Foo :
            module Foo :
              input a: UInt<3>
              output b: UInt<4>
              b <= asUInt(xor(asSInt(a), SInt<4>(0)))
      
      This would emit the assignment as `b = a` instead of the sign-extended
      `b = {{1{a[2]}},a}`.
      
      This requires adjusting the `pad(e, t)` function use in const prop,
      which currently just inserts a `Pad` prim op with the requested output
      type. However, the function advertises that it pads *to the width* of
      the type `t`. Some of the folds rely on this and request the padding of
      a SInt<N> to the width of a UInt<M>. But the current implementation then
      then actually returns a `Pad` op with type UInt<M>, instead of the
      SInt<M> that was requested.
      
      (cherry picked from commit e9b2946c
      
      )
      
      Co-authored-by: default avatarFabian Schuiki <fabian@schuiki.ch>
      7dfb7a12
  29. Apr 15, 2021
  30. Apr 14, 2021
    • Jared Barocsi's avatar
      Add indent parameter to Serializer.serialize() (#2177) · 5d02b785
      Jared Barocsi authored
      
      
      Using Utils.indent() gives deprecation warnings to use Serializer instead. However,
      the Serializer class itself doesn't provide a means to manually indent a FirrtlNode
      string a certain number of times.
      
      The indent variable, previously hardcoded to 0, is now exposed as a second parameter
      for the modified serialize function, and the old serialize function just calls the
      modified serialize with indents = 0 for binary compatibility
      
      Co-authored-by: default avatarMegan Wachs <megan@sifive.com>
      (cherry picked from commit 20890bbd)
      5d02b785
  31. Apr 08, 2021
  32. Apr 07, 2021
  33. Mar 30, 2021
  34. Mar 27, 2021