llvm / llvm/circt

[FIRRTL] attach of analog under when (+ subaccess)?

Open
#4,771 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Generally, this may be more of a FIRRTL-spec consideration, but the following is accepted and only is rejected late in the pipeline:

circuit Foo :
  module Foo :
    output d : { a: UInt<2>, b: Analog<1>}
    input c : UInt<1>
    d is invalid
    when c :
      inst b of Bar
      attach(d.b, b.b.b[c])
    else :
      inst b2 of Bar
      attach(d.b, b2.b.b[c])

  extmodule Bar :
    output b : { a : UInt<2>, b : Analog<1>[2]}

Output:

analog.fir:11:11: error: operand isn't an inout type
     d.b <- b2.b.b[c]
         ^
analog.fir:11:11: note: see current operation: "firrtl.attach"(%1, %19, %11) : (!firrtl.analog<1>, !firrtl.analog<1>, !firrtl.analog<1>) -> ()
analog.fir:11:11: error: 'firrtl.attach' op LowerToHW couldn't handle this operation
     d.b <- b2.b.b[c]
         ^
analog.fir:11:11: note: see current operation: "firrtl.attach"(%1, %19, %11) : (!firrtl.analog<1>, !firrtl.analog<1>, !firrtl.analog<1>) -> () 

Does conditional attach make sense? (is it unconditional even under when?)

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 FIRRTL example in the issue and the reported LowerToHW diagnostic for the conditional attach with subaccess. Determine the intended semantics of attach under when, then establish what consistent acceptance or rejection should look like for this case.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.