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

Question about cqen flag in detecting the state of command queue #368

Closed
viktoryou opened this issue Jul 1, 2024 · 2 comments
Closed

Question about cqen flag in detecting the state of command queue #368

viktoryou opened this issue Jul 1, 2024 · 2 comments

Comments

@viktoryou
Copy link

In the code of the model, cqcsr.cqen is not used in checking the state of command queue. Is that correct?

From the spec,

When cqen is changed from 1 to 0, the command queue may stay active (with busy asserted) until the commands already fetched from the command-queue are being processed and/or there are outstanding implicit loads from the command-queue. When the command-queue turns off the cqon bit reads 0.

Should the fetch of new commands stop since cqen is changed from 1 to 0, or the fetch would be always active until the command queue becomes empty(seems like the behavior of the model)?

@ved-rivos
Copy link
Collaborator

ved-rivos commented Jul 1, 2024

Should the fetch of new commands stop since cqen is changed from 1 to 0, or the fetch would be always active until the command queue becomes empty(seems like the behavior of the model)?

When cqen is set to 0, the cqon goes to 0. The command queue is no longer active and will stop fetching any more commands. An implementation may observe the cqen write in between two commands i.e. complete the commands that have been already fetched and then mark itself as off by setting cqon to 0. When cqon is 0, the model does not fetch commands anymore. In the reference model, this turning off of cqon occurs instantaneously since the model cannot observe a cqen write while a command is in progress. However for making this concept more explicit we could add cqen into this. Added this in #369 to illustrate the concept.

  if ( (g_reg_file.cqcsr.cqon == 0) || 
+      (g_reg_file.cqcsr.cqen == 0) ||
       (g_reg_file.cqcsr.cqmf != 0) ||

Waiting till its empty is also an acceptable behavior but not a desirable behavior.

@ved-rivos
Copy link
Collaborator

The model was however missing the case where there might be a IOFENCE pending and the cqon clearing should be delayed. This is updated in #370 .

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

No branches or pull requests

2 participants