Allow zero length VecInit()

オープン
#4,986 コメント 5 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
42/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
scala
領域
compilers

調査の方向性

まず VecInit のエントリポイントを見つけ、現在の空値チェックが報告されたエラーをどのように発生させているかを追跡します。VecInit() がそのエラーなしで要素数 0 を受け入れ、既存の空でない場合の動作が変わらず、長さ 0 のケースがテストでカバーされれば完了です。

索引モデルが issue の本文から書いたものです。

説明

Type of issue: Feature Request

Allow zero length VecInit()

Is your feature request related to a problem? Please describe.

If I try to create a zero length VecInit(), I get "Vec hardware values are not allowed to be empty"

Describe the solution you'd like

Allow zero length VecInit()

Describe alternatives you've considered

Iffy code in modelling.

Additional context

What is the use case for implementing this feature?

Use Case: Zero-Length VecInit() in Chisel Modeling and Testbenches

Chisel’s power as a hardware DSL extends beyond synthesizable RTL—it enables expressive, parameterized modeling and testbenches.

An example is the use of zero-length VecInit():

  • Zero-length Vecs are not hardware (no wires or registers are emitted), but are useful for parameterized designs.
  • They allow you to write generic code that naturally handles edge cases (like zero ports, lanes, or slices) without special-case logic or errors.
  • This is especially valuable in non-synthesizable modeling and testbenches, where parameter sweeps and corner cases (including zero) are common.
  • Even in RTL, zero-length Vecs can simplify parameterized code, letting cases reduce to zero cleanly for some configurations.

Chisel lets you:

  • Write one unified, hardware-like model for both RTL and testbenches.
  • Use constructs like VecInit() with zero length for flexible, robust parameterization.
  • Avoid hacks, special cases, or non-hardware workarounds found in other HDLs.

Bottom line:
Chisel’s support for zero-length VecInit() is a practical example of how its modeling capabilities go beyond RTL, making it easier to write, test, and verify highly parameterized hardware

Chisel solves the underlying problem that made Verilog so hard to use for modeling and testbenches—a problem that led to a patchwork of workarounds like SystemC, cocotb, DPI/FFI hacks, and custom event loops.
Instead of relying on these ad-hoc paradigms, Chisel lets you express parallelism and hardware behavior directly and naturally, all within a unified, hardware-centric DSL.
By writing everything in Chisel, you get clearer, more maintainable, and more accurate models and testbenches—without the complexity and fragmentation of mixing

Loosely-Timed Models with DecoupledIO

Chisel makes it easy to build loosely-timed models directly in the hardware DSL using DecoupledIO.
By leveraging DecoupledIO and its built-in ready/valid handshake, you can naturally express transaction-level interfaces, backpressure, and flow control.
This allows you to model systems where timing between transactions is flexible, without needing to manually manage threads or coroutines—enabling high-level, protocol-faithful modeling that remains hardware-consistent and easy to manually manage threads or coroutines—enabling high-level, protocol-faithful modeling that remains hardware-consistent and easy to reason about.

主要言語
Scala
スター
4.8k
フォーク
669
平均マージ
1日 12時間
マージ済み PR(30日)
25

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

chipsalliance/chisel のほかの issue

chipsalliance/chisel の issue をすべて見る

似ている issue

Scala の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。