Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Squash: move into Gateway, get Scope from initial #222

Merged
merged 1 commit into from
Dec 8, 2023

Conversation

klin02
Copy link
Member

@klin02 klin02 commented Dec 6, 2023

No description provided.

@klin02 klin02 marked this pull request as draft December 6, 2023 14:40
@klin02 klin02 force-pushed the squash-in-gateway branch 2 times, most recently from c837fa9 to f9a8f1f Compare December 8, 2023 08:00
* To simplify squash logic and support replay,we move Squash into Gateway.
* Redundant fly-lines and wb_int fix has been implemented in Gateway, so
we remove it from Squash.
* We get svScope from initial rather than name string for better
portability
@klin02 klin02 force-pushed the squash-in-gateway branch from f9a8f1f to 94d5f8b Compare December 8, 2023 08:09
@klin02 klin02 marked this pull request as ready for review December 8, 2023 08:11
@klin02 klin02 requested a review from poemonsense December 8, 2023 08:13
@poemonsense
Copy link
Member

Why do we need this? Different functionalities are intentionally implemented in different classes and files.

@klin02
Copy link
Member Author

klin02 commented Dec 8, 2023

Why do we need this? Different functionalities are intentionally implemented in different classes and files.

There are two main reasons:

  1. The two classes repeatedly implement fly-lines and share wb_int, leading to additional cost.
  2. When replay feature is added, additional data paths and control condition are required between instances of Gateway and Squash in DifftestModule. Maybe it will bring more difficulties~

@poemonsense
Copy link
Member

If they are moved to Gateway, why do we need squash.scala? We should think of how the code is organized and why we need the classes.

Some simple questions to get started:

  • If all are moved to Gateway, and gateway supports squash, then what does Squash.scala implement?
  • If gateway supports squash and squash supports squash, what are their differences?
  • How to define the classes such that every class only implements their own functionalities and they can be transparent to each other. If we mix different things, the software code will not be extensible and scalable, such as the case you explained in reason 2

I'm just trying to make sure you have good understanding of the code structure. If you have clear answers for questions like those, I think it's OK to merge this PR. I'm not opposed to putting squash in gateway if the replay does need it.

@klin02
Copy link
Member Author

klin02 commented Dec 8, 2023

Perhaps the code structure can be described as follows:

  • Difftest will simply pass difftest signals to Gateway, and the processing of signals is transparent to it.
  • Gateway will handles signals as its config. It may use Squash to squash them and DPIC (or some other style) to pass them. But how signals is squashed or passed is transparent to Gateway. In a way, Gateway may be regared as wrapper of Squash.
  • It's true that some control logic is mixed in Gateway, like step, enable, dut_pos..., may be we can wrap them into another class.

Then the code flow will act as follows:

  1. When difftest signals come in Gateway, it will be gatherd (by fly-lines) and fixed first. (Maybe use another module to wrapper the fix logic, I prepare to optimize it later so it can work for multi-core.)
  2. Fixed signals come in Squash (if needed), output squashed or replayed data.
  3. Processed signals come to a control module to get step, dut_pos, enable ...
  4. Finally data along with control signals will use DPIC to transfer.

Now we expose code of 1 and 3 directly in GatewayEndpoint because it seems more flexible when code is frequently changed. I will make the code structure more clearly when relevant functions are accomplished~~

@poemonsense
Copy link
Member

You can add the above explanation in code comments. In the future, you and others could understand it more clearly.

Make it a common practice as you develop the code. Will benefit your engineering much.

@klin02 klin02 merged commit 0a3afff into OpenXiangShan:master Dec 8, 2023
3 checks passed
@klin02 klin02 deleted the squash-in-gateway branch January 15, 2024 11:59
pxk27 pushed a commit to pxk27/difftest that referenced this pull request Jan 30, 2024
* To simplify squash logic and support replay, we move Squash into Gateway.
* Redundant fly-lines and wb_int fix has been implemented in Gateway, so
we remove it from Squash.
* We get svScope from initial rather than name string for better
portability.

For the future implementation of Squash Replay, move Squash into Gateway will  help simplify the data path and control logic with other parts.

For the future code structure, we want to regard Difftest Signals as trace, and Gateway will act as a microprocessor of the trace. The flow will be gather -> preprocess -> squash -> other process -> gen control signal -> transfer by DPIC.
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.

2 participants