Skip to content

Conversation

@klin02
Copy link
Member

@klin02 klin02 commented Jan 6, 2026

To prepare for upcoming pipeline refactoring, this change decouples clockgate
and ref_clock from fpga_sim. In addition to FPGA AXI, clockgate can now also be
reused by the Delta, enabling Difftest to process data from a single DUT cycle
across multiple cycles.

Copy link
Member

@poemonsense poemonsense left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please let @xiaokamikami have a review. I may not have enough time to review the details in the future

Suggestion:

Since now we are defining the SimTop in Chisel, some logic in top.v should be moved into Chisel under SimTop, especially the module connections. For example, the clock and clock gate can be moved into Chisel.

FileControl.write(difftestV, "DifftestMacros.svh")
}

def generateClockGate(): Unit = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For verilog modules whose design do not depend on run-time arguments, they should be put in src directory.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We originally put clockgate under generate to simplify include-path management across different build configs. It is used not only by FPGA/FPGA_SIM but also when Delta is enabled, so it may be hard to give it an appropriate path under src.

In addition, files under src need to be explicitly copied into fpga-release, it may be simplified when put it in generate.

@klin02
Copy link
Member Author

klin02 commented Jan 11, 2026

Please let @xiaokamikami have a review. I may not have enough time to review the details in the future

Suggestion:

Since now we are defining the SimTop in Chisel, some logic in top.v should be moved into Chisel under SimTop, especially the module connections. For example, the clock and clock gate can be moved into Chisel.

On FPGA, core_clock is shared by the DUT(SimTop), memories, and peripherals. And the enable condition may also consider some xdma-related signals, which are not accessible inside SimTop.
Therefore we place the clockgate outside the SimTop so that it can both observe the required XDMA signals and correctly gate the global core_clock domain for all modules.

@klin02 klin02 requested a review from xiaokamikami January 11, 2026 13:28
xiaokamikami
xiaokamikami previously approved these changes Jan 12, 2026
To prepare for upcoming pipeline refactoring, this change decouples clockgate
and ref_clock from fpga_sim. In addition to FPGA AXI, clockgate can now also be
reused by the Delta, enabling Difftest to process data from a single DUT cycle
across multiple cycles.
@klin02 klin02 merged commit c1a3783 into master Jan 12, 2026
6 checks passed
@klin02 klin02 deleted the clkgate branch January 12, 2026 06:42
@klin02
Copy link
Member Author

klin02 commented Jan 12, 2026

In this PR, since pipeline-based backpressure had not yet been introduced,
Gateway was still required to run on the gated core_clock rather than ref_clock.
However, due to an error in the fpga_sim scripts at that time, the CI tests in
this PR did not catch this failure.

The pipeline-based refactoring in PR #802 corrected the clocking to match the
intended behavior, and PR #805 fixed the fpga_sim CI tests to properly detect
such issues.

klin02 added a commit that referenced this pull request Jan 14, 2026
In PR #797, Gateway was switched to use the ungated ref_clock. Before the
pipeline-based backpressure support introduced in PR #802, this caused
fpga_sim failures.

This change temporarily reverts Gateway to use the gated clock to ensure
correct behavior. Gateway will switch back to ref_clock after the pipeline
refactoring in PR #802 is merged.
klin02 added a commit that referenced this pull request Jan 14, 2026
In PR #797, Gateway was switched to use the ungated ref_clock. Before the
pipeline-based backpressure support introduced in PR #802, this caused
fpga_sim failures.

This change temporarily reverts Gateway to use the gated clock to ensure
correct behavior. Gateway will switch back to ref_clock after the pipeline
refactoring in PR #802 is merged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants