llvm / llvm/circt

[FIRRTL] Layers and Analog

Open
#7,649 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

FIRRTL
Dominant language
C++
Stars
2.2k
Forks
524
Avg merge
3d 2h
Merged PRs (30d)
46

Description

Consider:

FIRRTL version 4.0.0

circuit Foo :
  layer L, bind :

  extmodule Bar :
    input a : Analog<1>
  public module Foo :
    input a : Analog<1>

    layerblock L:
      inst b of Bar
      attach(b.a, a)

Presently this fails in the verifier after LowerLayers:

// -----// IR Dump Before LowerLayers (firrtl-lower-layers) //----- //
firrtl.circuit "Foo" {
  firrtl.layer @L bind {
  }
  firrtl.extmodule private @Bar(in a: !firrtl.analog<1>) attributes {convention = #firrtl<convention scalarized>}
  firrtl.module @Foo(in %a: !firrtl.analog<1>) attributes {convention = #firrtl<convention scalarized>} {
    firrtl.layerblock @L {
      %b_a = firrtl.instance b @Bar(in a: !firrtl.analog<1>)
      firrtl.attach %b_a, %a : !firrtl.analog<1>, !firrtl.analog<1>
    }
  }
}

analog-layer.fir:13:7: error: analog types may not be connected
      attach(b.a, a)
      ^
analog-layer.fir:13:7: note: see current operation: "firrtl.matchingconnect"(%0, %arg0) : (!firrtl.analog<1>, !firrtl.analog<1>) -> ()

LowerLayers should diagnose this if unsupported, or learn to emit an appropriate connect operation (attach).

Since attach is bidirectional, it seems like it should not be allowed across layer boundaries for consistency with connect in that direction.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the LowerLayers pass and the analog-layer.fir example shown in the report; trace why the lowered layerblock produces a matchingconnect for Analog values. Done means LowerLayers either emits an appropriate attach operation or gives a clear diagnostic when the connection is unsupported, with the layer-boundary behavior covered by a test.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.