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

[test] Add spi_passthrough support to the power virus test #17747

Merged
merged 1 commit into from
Mar 30, 2023

Conversation

bilgiday
Copy link
Contributor

@bilgiday bilgiday commented Mar 29, 2023

Add spi_device_agent_0 and spi_host_agent code to generate command-response sequence for the SPI passthrough part of the test.

The sequence:
1- spi_host_agent sends a SpiFlashReadQuad command
2- The command goes through the spi_device and spi_host_0 IPs that are configured in the passthrough mode
3- spi_device_agent_0 will respond with 2048 bytes of data.

Tested in DVSim.

@bilgiday bilgiday requested a review from a team as a code owner March 29, 2023 14:20
@bilgiday bilgiday requested review from jdonjdon, cindychip and timothytrippel and removed request for a team March 29, 2023 14:20
Copy link
Contributor

@timothytrippel timothytrippel left a comment

Choose a reason for hiding this comment

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

couple of comments, otherwise LGTM. Thanks @bilgiday !

// The sequence of opcodes used for the test.
spi_flash_cmd_e test_opcodes[$];
// Frequencies to use for testing the sequences.
time sck_periods_ps[] = '{
Copy link
Contributor

Choose a reason for hiding this comment

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

we probably only want to use the highest frequency for this test no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, right, it makes sense :) Will use 30MHz 👍

virtual function void generate_spi_flash_sequence();
// Reference: chip_sw_spi_passthrough_vseq.sv
// Keep the structure in case we need to send different commands later.
test_opcodes = '{
Copy link
Contributor

Choose a reason for hiding this comment

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

does this need to be in a function? could it just be global? (will defer to DV experts here 😃 )

Copy link
Contributor

Choose a reason for hiding this comment

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

I think like the comments in line 94, if this test plans to change the test_opcode sequence in an extended test, then we can make it a function and override it later.
If we do not intend to create any tests based on this one, I think it is easier to just make a global variable :)

Copy link
Contributor Author

@bilgiday bilgiday Mar 30, 2023

Choose a reason for hiding this comment

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

Hehe, thanks!

To make the code cleaner, I went over the whole spi_passthrough part and removed the parts which are not strictly necessary for the power virus test: Now, the code just sends a SpiFlashReadQuad command to read 2048 bytes. Please take a look at it and let me know if it makes sense :)

forever begin
`uvm_create_on(m_spi_device_seq, p_sequencer.spi_device_sequencer_hs[0]);
`uvm_send(m_spi_device_seq);
device_rsp_q.push_back(m_spi_device_seq.rsp);
Copy link
Contributor

Choose a reason for hiding this comment

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

I assume the response packets are comprised of random bits? was there a way to make them all 01010101 for maximum switching? i.e., send 0xaa repeatedly

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will check this one 👍

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Or like you did in line 130, that could work too I think

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the guidance! I updated the code based on your suggestion.

Now, the response packages are an alternating pattern of 0xaa and 0x55: All of the data lines are toggled at every SCK cycle.

spi_item device_rsp_q[$];
spi_agent_cfg agent_cfg = cfg.m_spi_host_agent_cfg;

fork begin : isolation_fork
Copy link
Contributor

@cindychip cindychip Mar 29, 2023

Choose a reason for hiding this comment

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

Under this isolation fork, do you think this structure is more clear?

fork begin : isolation_fork
  forever begin : send_spi_device_seq_forever
  end
  begin: spi_host_seq
  end
  join_any
  disable fork;
end join

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks Cindy :) I applied this change in the new version.

Add spi_device_agent_0 and spi_host_agent code to generate
command-response sequence for the SPI passthrough part of the test.

Signed-off-by: Bilgiday Yuce <[email protected]>
@cindychip cindychip merged commit a738794 into lowRISC:master Mar 30, 2023
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