[FIRRTL] smem with read address from port does not work
- Dominant language
- C++
- Stars
- 2.2k
- Forks
- 524
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 46
Description
Consider the following FIRRTL:
```firrtl
FIRRTL version 4.0.0
circuit Top :
public module Top :
input clock : Clock
input raddr : UInt<6>
input waddr : UInt<6>
input wdata : UInt<8>
output rdata : UInt<8>
smem ram : UInt<8>[64]
write mport w = ram[waddr], clock
connect w, wdata
read mport r = ram[raddr], clock
connect rdata, r
```
Compile this with firtool 1.93.1 and you will get:
```
test.fir:16:5: warning: memory port is never enabled
read mport r = ram[raddr], clock
^
test.fir:16:5: note: see current operation: %r_data, %r_port = chirrtl.memoryport Read %ram {name = "r"} : (!chirrtl.cmemory, 64>) -> (!firrtl.uint<8>, !chirrtl.cmemoryport)
// Generated by CIRCT firtool-1.93.1
module Top(
input clock,
input [5:0] raddr,
waddr,
input [7:0] wdata,
output [7:0] rdata
);
assign rdata = 8'h0;
endmodule
```
If you simply add a node to use as the read address instead of the input port, it works. That is, just change the read port to:
```firrtl
node readAddr = raddr
read mport r = ram[readAddr], clock
connect rdata, r
```
Then the emitted Verilog has a memory instantiated as expected.
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the FIRRTL example with firtool 1.93.1, then compare it with the variant that assigns raddr to readAddr before the read mport. Trace handling of the direct read-port address and verify that the fixed behavior emits a memory and preserves the read data path in Verilog.
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
- Clearly specified
- Newbie friendliness
- 45/100