llvm / llvm/circt

[FIREmitter] Add support for multibit_mux

Open
#2,966 2 comments 0 reactions 0 assignees View on GitHub
FIRRTL
Dominant language
C++
Stars
2.2k
Forks
524
Avg merge
3d 2h
Merged PRs (30d)
46

Description

The FIR emitter currently does not support the `firrtl.multibit_mux` operation:
```mlir
firrtl.circuit "Foo" {
firrtl.module @Foo(
in %s: !firrtl.uint<1>,
in %a: !firrtl.uint<42>,
in %b: !firrtl.uint<42>
) {
%0 = firrtl.multibit_mux %s, %a, %b : !firrtl.uint<1>, !firrtl.uint<42>
%n = firrtl.node %0 : !firrtl.uint<42>
}
}
```
run through `circt-translate --export-firrtl` yields:
```
error: 'firrtl.multibit_mux' op not supported as expression
```
This can probably be implemented pretty easily by emitting these as trees of two-way multiplexers, or an array index operation.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the FIR emitter expression-handling path exercised by circt-translate --export-firrtl, using the provided firrtl.multibit_mux example to reproduce the unsupported-operation error. Implement support for the operation and verify that the example translates without that error, either as a tree of two-way multiplexers or an array index operation.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 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.