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

[spi_device] Add support for 1r1w RAMs and parity init #20942

Merged
merged 7 commits into from
Jan 24, 2024

Conversation

a-will
Copy link
Contributor

@a-will a-will commented Jan 23, 2024

Add 1r1w RAM configuration as an option for spi_device for tech nodes where the 2p RAM configuration is not available. Make the 2p RAM have the same access controls as the 1r1w RAM, so the two behave the same way.

Also add word initialization circuitry on the SPI side, to init parity. The SPI -> core buffer for the payload uses parity and SW has no way of initializing it since the the write port is in the SPI domain. Since the SPI side writes the payload byte by byte, we need to guard against partially initialized 32bit wordd, because these could cause TL-UL bus errors upon readout. Unfortunately, an initialization circuit that initializes the entire SRAM on the SPI clock domain is infeasible since that clock is only intermittently available. Hence, we keep track of uninitialized words using a valid bit array, and upon the first write to a word, uninitialized bytes are set to zero if the write operation is a sub-word write op.

Note that in this PR, DV tests have focused much more on the 2p variant, though.

This is largely a set of cherry-picks from integrated_dev, after resolving conflicts. However, the last commit adds fixed "parameters" for DPRAM offsets and makes them available as macros to C.

Resolves #5369

Razer6 and others added 5 commits January 23, 2024 14:51
Some core files were missing, and there were also some syntax errors.

Signed-off-by: Alexander Williams <[email protected]>
@a-will a-will added Component:DV DV issue: testbench, test case, etc. Priority:P0 Priority: critical Component:RTL IP:spi_device labels Jan 23, 2024
@a-will a-will added this to the Earlgrey-PROD.M2 milestone Jan 23, 2024
@a-will a-will requested review from a team, vogelpi and msfschaffner as code owners January 23, 2024 23:03
@a-will a-will requested review from jdonjdon and HU90m and removed request for a team January 23, 2024 23:03
spi2sys_rd_req,
spi2sys_rd_addr
};
end else if (SramType == SramType1r1w) begin : ram1r1w
Copy link
Contributor

Choose a reason for hiding this comment

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

nitnit: we should fix up these block labels as the linter says

Copy link
Contributor

@msfschaffner msfschaffner left a comment

Choose a reason for hiding this comment

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

LGTM so far, - does this include the additional patches we had to make for the SRAM offset that were not quite right at the beginning (when we did this on integrated)?

@a-will
Copy link
Contributor Author

a-will commented Jan 23, 2024

LGTM so far, - does this include the additional patches we had to make for the SRAM offset that were not quite right at the beginning (when we did this on integrated)?

Yes, I squashed that all down, since it was noise.

a-will and others added 2 commits January 23, 2024 16:00
Add 1r1w RAM configuration as an option for spi_device for tech nodes
where the 2p RAM configuration is not available. Make the 2p RAM have
the same access controls as the 1r1w RAM, so the two behave the same
way.

Also add word initialization circuitry on the SPI side, to init parity.
The SPI -> core buffer for the payload uses parity and SW has no way of
initializing it since the the write port is in the SPI domain. Since the SPI
side writes the payload byte by byte, we need to guard against partially
initialized 32bit wordd, because these could cause TL-UL bus errors upon
readout. Unfortunately, an initialization circuit that initializes the entire
SRAM on the SPI clock domain is infeasible since that clock is only
intermittently available. Hence, we keep track of uninitialized words using a
valid bit array, and upon the first write to a word, uninitialized bytes are
set to zero if the write operation is a sub-word write op.

Note that in this commit, DV tests have focused much more on the 2p
variant.

Signed-off-by: Alexander Williams <[email protected]>
Co-authored-by: Michael Schaffner <[email protected]>
Add params for the DPRAM offsets so they are available in C headers for
software.

Signed-off-by: Alexander Williams <[email protected]>
Copy link
Contributor

@jdonjdon jdonjdon left a comment

Choose a reason for hiding this comment

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

Reviewed dv code. LGTM

@a-will a-will merged commit f83506b into lowRISC:master Jan 24, 2024
32 checks passed
@a-will a-will deleted the spid-sram branch January 24, 2024 06:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component:DV DV issue: testbench, test case, etc. Component:RTL IP:spi_device Priority:P0 Priority: critical
Projects
None yet
4 participants