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

Implemented all C0 instructions from Zc v 0.70.1. #528

Merged

Conversation

silabs-oysteink
Copy link
Contributor

SEC clean when ZC_EXT=0.

Signed-off-by: Oystein Knauserud [email protected]

SEC clean when ZC_EXT=0.

Signed-off-by: Oystein Knauserud <[email protected]>
Signed-off-by: Oystein Knauserud <[email protected]>
@silabs-oysteink silabs-oysteink added the Component:RTL For issues in the RTL (e.g. for files in the rtl directory) label May 3, 2022
3'b001: begin
if (ZC_EXT) begin
if (instr[12]) begin
// cm.lh -> lh rd', imm(rs1')
Copy link
Contributor

Choose a reason for hiding this comment

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

cm.lh has some codes designated for custom use. These need to set illegal_instr_o = 1'b1

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

if (ZC_EXT) begin
unique case (instr[12:10])
3'b000: begin
// c.lbu -> lbu rd', imm(rs1')
Copy link
Contributor

Choose a reason for hiding this comment

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

Not all cm.lbu codes are legal.

Copy link
Contributor Author

@silabs-oysteink silabs-oysteink May 3, 2022

Choose a reason for hiding this comment

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

Agreed, but for this specific line (c.lbu vs cm.lbu) there is no illegal encodings. Fixing for the actual cm.lbu once that gets implemented

end
3'b001: begin
// c.lh -> lh rd', imm(rs1')
// c.lhu -> lhu rd', imm(rs1')
Copy link
Contributor

Choose a reason for hiding this comment

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

cm.lhu has some codes designated for custom use. These need to set illegal_instr_o = 1'b1

Copy link
Contributor Author

Choose a reason for hiding this comment

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

cm.lhu is not yet implemented (will be part of PR for C2 instructions. This line is for c.lhu, which does not seem to have any reserved encodings.

// cm.sh -> sh rs2', imm(rs1')
instr_o.bus_resp.rdata = {7'b0, 2'b01, instr[4:2], 2'b01, instr[9:7], 3'b001, instr[11:10], instr[6:5], 1'b0, OPCODE_STORE};
end else begin
// cm.sb -> sb rs2', imm(rs1')
Copy link
Contributor

Choose a reason for hiding this comment

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

cm.sb has some codes designated for custom use. These need to set illegal_instr_o = 1'b1

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

3'b101: begin
if (ZC_EXT) begin
if (instr[12]) begin
// cm.sh -> sh rs2', imm(rs1')
Copy link
Contributor

Choose a reason for hiding this comment

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

cm.sh has some codes designated for custom use. These need to set illegal_instr_o = 1'b1

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

@@ -25,6 +25,9 @@
////////////////////////////////////////////////////////////////////////////////

module cv32e40x_compressed_decoder import cv32e40x_pkg::*;
#(
parameter bit ZC_EXT = 0 // todo: remove once fully implemented
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 remove the todo here and some levels up. We will in the end make it a localparam set within the core level.

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

- Marking cm.lh, cm.sh and cm.sb as illegal if encoding (of immediates) is reserved.
- Removed todo for ZC_EXT parameter except at the very toplevel.

Signed-off-by: Oystein Knauserud <[email protected]>
@Silabs-ArjanB Silabs-ArjanB merged commit 65ddb27 into openhwgroup:master May 3, 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