llvm / llvm/circt

[LLHD] Improve llhd-desequentialize pass

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

Nobody has claimed this yet.

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

Description

Hi! I'm trying to erase `llhd.process` by using `llhd-desequentialize` pass in this code:

```verilog
module Mod(input clk, input rstn, output logic b);
always @(posedge clk or negedge rstn)
begin
if (!rstn)
b <= 0;
else
b <= 1;
end
endmodule
```

But it thinks that there are 3 triggers and it couldn't be optimized. How can I support it? As I know, `seq.compreg` supports only one clock and one reset.

Btw, I found another misprint:

https://github.com/llvm/circt/blob/6b4bea036f0768471fa6a5e678dec03e742caf5c/lib/Dialect/LLHD/Transforms/DesequentializationPass.cpp#L655

We should check `triggers[0].kinds.size() != 1` instead of second condition.

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 in lib/Dialect/LLHD/Transforms/DesequentializationPass.cpp around line 655, then trace how llhd-desequentialize handles the Verilog example's three triggers. Correct the noted condition and make the pass support the clock/reset case; done means the example can be desequentialized without the optimization failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Feature
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.