Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

codegen should not emit dangling signals for nested procs w/ combo next body

未关闭
#4,635 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
52/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
冷清
技术栈
cpp
领域
compilers

调研方向

从将嵌套 proc 解析为组合模块的 codegen 路径开始,使用 PlusOne proc 及其生成的 Verilog 作为复现。跟踪 clk 和 rst 信号的添加与连接方式,然后验证组合型嵌套 proc 不再发出未使用的信号或将其标记为未读取,同时有状态 proc 保留所需的信号。

由索引模型根据 Issue 内容生成。

描述

codegen 🧦 sox

Describe the bug
When a proc resolves to a combinational module (either intentionally: pure forwarding procs, if I/O operation get optimized away, or if it has no state), codegen will still emit a clk and rst signals for the corresponding verilog module.

While top-level proc signals can easily be marked as unread, this is more of a problem for nested sub procs as their internal clock or reset signal would still be driven from the overall proc network connections but end up never being read, hence producing potential warning/error in downstream tools.

To Reproduce
Codegen the following proc:

proc PlusOne {
  ns: chan<u8> in;
  plusones: chan<u8> out;

  config(ns: chan<u8> in, plusones: chan<u8> out) {
    (ns, plusones)
  }

  init {}

  next(state: ()) {
    let (_, n) = recv(token(), ns);
    send(token(), plusones, n + 1);
  }
}

Result in the following verilog module:

module user_module(
  input wire clk,
  input wire [7:0] _ns_data,
  input wire _ns_valid,
  input wire _plusones_ready,
  output wire _ns_ready,
  output wire [7:0] _plusones_data,
  output wire _plusones_valid
);
  wire stage_outputs_valid_0;
  wire [7:0] add_59;
  assign stage_outputs_valid_0 = _ns_valid & _plusones_ready;
  assign add_59 = _ns_data + 8'h01;
  assign _ns_ready = stage_outputs_valid_0;
  assign _plusones_data = add_59;
  assign _plusones_valid = _ns_valid;
endmodule

Expected behavior
unused internal clk or rst signal would be not emited or marked as unread using a developer provided macro.

主要语言
C++
星标
1.9k
派生
287
平均合并
1 天 23 小时
30 天内合并 PR
100

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

google/xls 的其他 Issue

查看 google/xls 的全部 Issue

相似的 Issue

更多 C++ Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。