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

Implementation of mnxti #506

Merged

Conversation

silabs-oysteink
Copy link
Contributor

MNXTI functionality should now be in.
Tested basic functionality of reading correct pointer addresses for pending interrupts when changing levels in the memory mapped registers.

SEC clean for SMCLIC=0

Refactored some CSR write code that access more than one CSR.

Signed-off-by: Oystein Knauserud <[email protected]>
Signed-off-by: Oystein Knauserud <[email protected]>
Signed-off-by: Oystein Knauserud <[email protected]>
Copy link
Contributor

@Silabs-ArjanB Silabs-ArjanB left a comment

Choose a reason for hiding this comment

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

(We will discuss #507 separately as that issue was not introduced with this PR)

logic [31:0] csr_rdata;
logic csr_counter_read;

// CLIC signals for returning pointer to handles
// when mnxti is accessed
logic csr_clic_pa_valid;
Copy link
Contributor

Choose a reason for hiding this comment

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

What does 'pa' stand for?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

PointerAddress, I tried to make a short name, but this is probably too short. Would 'csr_clic_ptr_addr_valid' be better perhaps?

Copy link
Contributor

Choose a reason for hiding this comment

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

You can keep this name; just add a comment on the lines where these signals are declared that contains at least the words 'pointer address'

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

// Write mpie and mpp as aliased through mcause
mstatus_n.mpie = csr_wdata_int[MCAUSE_MPIE_BIT];
mstatus_n.mpp = PRIV_LVL_M; // todo: handle priv mode for E40S
end else if (mnxti_we) begin
Copy link
Contributor

Choose a reason for hiding this comment

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

If there is a mnxti write with side effects, then both mcause_we = 1 and mnxti_we = 1 and this block of code will not get executed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's right, we'll have to check the state for both write enables in the first if block I think.

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe you can handle mnxti_we in the top/first if to get it correct?

mstatus_n.mpp = PRIV_LVL_M; // todo: handle priv mode for E40S
end else if (mnxti_we) begin
// A mnxti write writes to mstatus.mie
mstatus_n = mstatus_q;
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think these two lines are correct. The spec says 'All CSR instructions may be used with xnxti. The operation will be the same as the corresponding CSR instruction used with xstatus.', so shouldn't the already computed mstatus_n from line 571 do the trick?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed, fixed.

Connected irq_level from clic_interrupt_controller to cs_registers,
as this was left floating in the previous commit.

Signed-off-by: Oystein Knauserud <[email protected]>
@Silabs-ArjanB Silabs-ArjanB added the Component:RTL For issues in the RTL (e.g. for files in the rtl directory) label Apr 11, 2022
@Silabs-ArjanB Silabs-ArjanB merged commit f9e7cb6 into openhwgroup:master Apr 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component:RTL For issues in the RTL (e.g. for files in the rtl directory)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants