Semantic Inconsistency in Intermediate FIRRTL File During Compilation: Incorrect reg Emission Instead of node and Loss of Memory readUnderWrite Behavior

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

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

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

評価

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

調査の方向性

ShiftResetTester、ShiftTester、SyncReadMemWriteCollisionTester のケースを実行し、生成された .fir ファイルを調べます。src/main/scala/firrtl/ir/Serializer.scala の303行目付近を読み、出力された FIRRTL を src/test/scala/chiselTests/Reg.scala および Mem.scala と比較します。生成された中間ファイルが期待される node/reg セマンティクスと readUnderWrite の動作を保持していれば完了です。

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

説明

Type of issue: Bug Report

Please provide the steps to reproduce the problem:
Chisel Version: v3.5.6
FIRRTL Version: v1.5.6
Treadle Version: v1.5.6

We ran the official tests for each of the following cases (without any modifications), and then examined the .fir files in the test_run_dir. We observed inconsistencies between the .fir files and the source code. The details are provided below.

  1. ShiftResetTester
  • Source Code: src/test/scala/chiselTests/Reg.scala, Line 54
  • Description: When n = 0, the register sr should have a constant value, which should be compiled to a node. (This is observable when emitting FIRRTL, where the translation results in a node.) However, when emitting Verilog (which generates a .fir file in the same directory), the register sr is compiled to a reg, leading to an inconsistency with the source code. Initially, the value in reg sr is either random or zero (depending on the settings), rather than the expected constant value.
  1. ShiftTester
  • Source Code: src/test/scala/chiselTests/Reg.scala, Line 44
  • Description: This issue is similar to that in ShiftResetTester.
  1. SyncReadMemWriteCollisionTester
  • Source Code: src/test/scala/chiselTests/Mem.scala, Line 37
  • Description: When emitting to Verilog, the memory readUnderWrite behavior is lost in the .fir file generated in the same directory.

What is the current behavior?
There are cases of semantic inconsistencies between the .fir intermediate files generated by Chisel's emit verilog and the source code (including incorrect compilation and loss of semantic information).

What is the expected behavior?
The semantic behavior of the .fir intermediate files generated by Chisel's emit verilog is consistent with the source code.

Please tell us about your environment:

  • version: v3.5.6
  • OS: Ubuntu 24.04 LTS

Other Information

Use emit verilog to generate the .fir in the same directory (test_run_dir) instead of directly using emit firrtl. I observed that in the FIRRTL repository source code, in src/main/scala/firrtl/ir/Serializer.scala at Line 303, the readUnderWrite field is lost during the emission.

What is the use case for changing the behavior?
I have mentioned it before: the official test code for ShiftResetTester, ShiftTester, and SyncReadMemWriteCollisionTester in the Chisel v3.5.6 repository.

主要言語
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 を短くまとめたダイジェスト。