llvm / llvm/circt

[FIRRTL] FIRRTL to RTL Memory Lowering Needs to Handle All Read Under Write Behaviors

Open
#787 7 comments 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

Add support for the "old" read-under-write FIRRTL memory behavior. Currently, this is incorrectly emitted as "new".

The FIRRTL spec defines three read-under-write behaviors for memories. A read-under-write behavior is what happens if you try to read and write the same address on the same cycle These three behaviors are:

1. New (return the value in the memory when the read was made)
2. Old (return the value when the read was requested)
3. Undefined (technically anything, but the Scala FIRRTL Compiler treats this as "compiler's choice" and chooses "New")

Note that this only matters for read latencies > 0. These can be treated as equivalent if the ~read latency == 1~ read latency == 0.

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 by tracing the FIRRTL-to-RTL memory lowering entry point and how read-under-write behaviors are represented. Add coverage for old behavior when read latency is greater than zero, while preserving the existing new and undefined behavior. Done means old returns the value requested before the same-cycle write, rather than being emitted as new.

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
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.