Skip to content

sim: Fix uninitialized clusterwide cc counter#54

Open
Smephite wants to merge 1 commit intopulp-platform:mainfrom
Smephite:fix/ccCounter
Open

sim: Fix uninitialized clusterwide cc counter#54
Smephite wants to merge 1 commit intopulp-platform:mainfrom
Smephite:fix/ccCounter

Conversation

@Smephite
Copy link

@Smephite Smephite commented Dec 9, 2025

This PR fixes the tracing scripts / dasm logs of Spatz.

Before the DASM logs had the issue, the current clock cycle for any instruction was set as 'X'.
This issue stems from a unitilized cycle counter variable in the spatz_cc.sv file.
The cycle counter was initialized using a synchronous negative reset signal.
If, for any reason (e.g., clock gating), the clock was inactive during the reset assertion, the value would never be initialized.

As the specific cycle count is only used in simulation, this PR mitigates the issue by setting the default value to zero on simulation start.

Further thought could be given to using a synchronized reset signal rather than an asynchronous one.

@Smephite Smephite changed the title sim: Fix uninitialized cluster wide cc counter sim: Fix uninitialized clusterwide cc counter Dec 9, 2025
@anga93
Copy link
Member

anga93 commented Feb 3, 2026

Hi @Smephite can you rebase on the current main? Afterwards, we will review it and merge it

@anga93 anga93 requested review from DiyouS and MaoyuanCai February 3, 2026 11:31
The Cycle counter was reset using an synchronous nRST.
If using clock gating but an global reset signal, the reset was not triggered.

This fixes the traceing scripts on the dasm logs.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we directly assign a wire when declaring it in sv? I think we should assign the value to 0 at the beginning of initial block instead

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.

3 participants