-
Notifications
You must be signed in to change notification settings - Fork 6
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
Adding support for Scalar Cryptography Extension (Crossbar permutation instructions, Zbkx) #27
base: master
Are you sure you want to change the base?
Changes from 6 commits
8892661
7e872b9
5573e97
0347cab
82a8f63
99cfdca
1688a87
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -425,6 +425,7 @@ module cva6 | |||||
exception_t flu_exception_ex_id; | ||||||
// ALU | ||||||
logic [CVA6Cfg.NrIssuePorts-1:0] alu_valid_id_ex; | ||||||
logic [5:0] orig_instr_aes; | ||||||
// Branches and Jumps | ||||||
logic [CVA6Cfg.NrIssuePorts-1:0] branch_valid_id_ex; | ||||||
|
||||||
|
@@ -879,7 +880,8 @@ module cva6 | |||||
.stall_issue_o (stall_issue), | ||||||
//RVFI | ||||||
.rvfi_issue_pointer_o (rvfi_issue_pointer), | ||||||
.rvfi_commit_pointer_o(rvfi_commit_pointer) | ||||||
.rvfi_commit_pointer_o(rvfi_commit_pointer), | ||||||
.orig_instr_aes_bits(orig_instr_aes) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [verible-verilog-format] reported by reviewdog 🐶
Suggested change
|
||||||
); | ||||||
|
||||||
// --------- | ||||||
|
@@ -918,6 +920,7 @@ module cva6 | |||||
.flu_ready_o(flu_ready_ex_id), | ||||||
// ALU | ||||||
.alu_valid_i(alu_valid_id_ex), | ||||||
.orig_instr_aes_i(orig_instr_aes), | ||||||
// Branches and Jumps | ||||||
.branch_valid_i(branch_valid_id_ex), | ||||||
.branch_predict_i(branch_predict_id_ex), // branch predict to ex | ||||||
|
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -461,7 +461,7 @@ module decoder | |||||||||||||||||||||
// -------------------------------------------- | ||||||||||||||||||||||
// Vectorial Floating-Point Reg-Reg Operations | ||||||||||||||||||||||
// -------------------------------------------- | ||||||||||||||||||||||
if (instr.rvftype.funct2 == 2'b10) begin // Prefix 10 for all Xfvec ops | ||||||||||||||||||||||
if (!CVA6Cfg.ZKN && instr.rvftype.funct2 == 2'b10) begin // Prefix 10 for all Xfvec ops | ||||||||||||||||||||||
// only generate decoder if FP extensions are enabled (static) | ||||||||||||||||||||||
if (CVA6Cfg.FpPresent && CVA6Cfg.XFVec && fs_i != riscv::Off && ((CVA6Cfg.RVH && (!v_i || vfs_i != riscv::Off)) || !CVA6Cfg.RVH)) begin | ||||||||||||||||||||||
automatic logic allow_replication; // control honoring of replication flag | ||||||||||||||||||||||
|
@@ -782,6 +782,18 @@ module decoder | |||||||||||||||||||||
if (CVA6Cfg.ZKN) instruction_o.op = ariane_pkg::PACK_H; //packh | ||||||||||||||||||||||
else illegal_instr_bm = 1'b1; | ||||||||||||||||||||||
end | ||||||||||||||||||||||
{ | ||||||||||||||||||||||
7'b001_0100, 3'b100 | ||||||||||||||||||||||
} : begin | ||||||||||||||||||||||
if (CVA6Cfg.ZKN) instruction_o.op = ariane_pkg::XPERM8; // xperm8 | ||||||||||||||||||||||
else illegal_instr_bm = 1'b1; | ||||||||||||||||||||||
end | ||||||||||||||||||||||
{ | ||||||||||||||||||||||
7'b001_0100, 3'b010 | ||||||||||||||||||||||
} : begin | ||||||||||||||||||||||
if (CVA6Cfg.ZKN) instruction_o.op = ariane_pkg::XPERM4; // xperm4 | ||||||||||||||||||||||
else illegal_instr_bm = 1'b1; | ||||||||||||||||||||||
end | ||||||||||||||||||||||
// Zero Extend Op RV32 encoding | ||||||||||||||||||||||
{ | ||||||||||||||||||||||
7'b000_0100, 3'b100 | ||||||||||||||||||||||
|
@@ -791,6 +803,52 @@ module decoder | |||||||||||||||||||||
else if (CVA6Cfg.ZKN) instruction_o.op = ariane_pkg::PACK; // pack | ||||||||||||||||||||||
else illegal_instr_bm = 1'b1; | ||||||||||||||||||||||
end | ||||||||||||||||||||||
{ | ||||||||||||||||||||||
7'b001_1001, 3'b000 | ||||||||||||||||||||||
} : begin | ||||||||||||||||||||||
if (CVA6Cfg.ZKN) instruction_o.op = ariane_pkg::AES64ES; // aes64es | ||||||||||||||||||||||
else illegal_instr_bm = 1'b1; | ||||||||||||||||||||||
end | ||||||||||||||||||||||
{ | ||||||||||||||||||||||
7'b001_1011, 3'b000 | ||||||||||||||||||||||
} : begin | ||||||||||||||||||||||
if (CVA6Cfg.ZKN) instruction_o.op = ariane_pkg::AES64ESM; // aes64esm | ||||||||||||||||||||||
else illegal_instr_bm = 1'b1; | ||||||||||||||||||||||
end | ||||||||||||||||||||||
{ | ||||||||||||||||||||||
7'b011_1111, 3'b000 | ||||||||||||||||||||||
} : begin | ||||||||||||||||||||||
if (CVA6Cfg.ZKN) instruction_o.op = ariane_pkg::AES64KS2; // aes64ks2 | ||||||||||||||||||||||
else illegal_instr_bm = 1'b1; | ||||||||||||||||||||||
end | ||||||||||||||||||||||
{7'b0010001, 3'b000}, {7'b0110001, 3'b000}, {7'b1010001, 3'b000}, {7'b1110001, 3'b000}: begin | ||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [verible-verilog-format] reported by reviewdog 🐶
Suggested change
|
||||||||||||||||||||||
if (CVA6Cfg.ZKN) instruction_o.op = ariane_pkg::AES32ESI; // aes32esi | ||||||||||||||||||||||
else illegal_instr_bm = 1'b1; | ||||||||||||||||||||||
end | ||||||||||||||||||||||
{7'b0010011, 3'b000}, {7'b0110011, 3'b000}, {7'b1010011, 3'b000}, {7'b1110011, 3'b000}: begin | ||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [verible-verilog-format] reported by reviewdog 🐶
Suggested change
|
||||||||||||||||||||||
if (CVA6Cfg.ZKN) instruction_o.op = ariane_pkg::AES32ESMI; // aes32esmi | ||||||||||||||||||||||
else illegal_instr_bm = 1'b1; | ||||||||||||||||||||||
end | ||||||||||||||||||||||
{7'b0010101, 3'b000}, {7'b0110101, 3'b000}, {7'b1010101, 3'b000}, {7'b1110101, 3'b000}: begin | ||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [verible-verilog-format] reported by reviewdog 🐶
Suggested change
|
||||||||||||||||||||||
if (CVA6Cfg.ZKN) instruction_o.op = ariane_pkg::AES32DSI; // aes32dsi | ||||||||||||||||||||||
else illegal_instr_bm = 1'b1; | ||||||||||||||||||||||
end | ||||||||||||||||||||||
{7'b0010111, 3'b000}, {7'b0110111, 3'b000}, {7'b1010111, 3'b000}, {7'b1110111, 3'b000}: begin | ||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [verible-verilog-format] reported by reviewdog 🐶
Suggested change
|
||||||||||||||||||||||
if (CVA6Cfg.ZKN) instruction_o.op = ariane_pkg::AES32DSMI; // aes32dsmi | ||||||||||||||||||||||
else illegal_instr_bm = 1'b1; | ||||||||||||||||||||||
end | ||||||||||||||||||||||
{ | ||||||||||||||||||||||
7'b001_1101, 3'b000 | ||||||||||||||||||||||
} : begin | ||||||||||||||||||||||
if (CVA6Cfg.ZKN) instruction_o.op = ariane_pkg::AES64DS; // aes64ds | ||||||||||||||||||||||
else illegal_instr_bm = 1'b1; | ||||||||||||||||||||||
end | ||||||||||||||||||||||
{ | ||||||||||||||||||||||
7'b001_1111, 3'b000 | ||||||||||||||||||||||
} : begin | ||||||||||||||||||||||
if (CVA6Cfg.ZKN) instruction_o.op = ariane_pkg::AES64DSM; // aes64dsm | ||||||||||||||||||||||
else illegal_instr_bm = 1'b1; | ||||||||||||||||||||||
end | ||||||||||||||||||||||
default: begin | ||||||||||||||||||||||
illegal_instr_bm = 1'b1; | ||||||||||||||||||||||
end | ||||||||||||||||||||||
|
@@ -921,6 +979,10 @@ module decoder | |||||||||||||||||||||
else if (instr.instr[31:26] == 6'b001010) instruction_o.op = ariane_pkg::BSETI; | ||||||||||||||||||||||
else if (CVA6Cfg.ZKN && instr.instr[31:20] == 12'b000010001111) | ||||||||||||||||||||||
instruction_o.op = ariane_pkg::ZIP; | ||||||||||||||||||||||
// else if (CVA6Cfg.ZKN && instr.instr[31:24] == 8'b00110001) | ||||||||||||||||||||||
// instruction_o.op = ariane_pkg::AES64KS1I; | ||||||||||||||||||||||
else if (CVA6Cfg.ZKN && instr.instr[31:20] == 12'b001100000000) | ||||||||||||||||||||||
instruction_o.op = ariane_pkg::AES64IM; | ||||||||||||||||||||||
else illegal_instr_bm = 1'b1; | ||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [verible-verilog-format] reported by reviewdog 🐶
Suggested change
|
||||||||||||||||||||||
end | ||||||||||||||||||||||
3'b101: begin | ||||||||||||||||||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -228,7 +228,9 @@ module ex_stage | |||||
// Information dedicated to RVFI - RVFI | ||||||
output lsu_ctrl_t rvfi_lsu_ctrl_o, | ||||||
// Information dedicated to RVFI - RVFI | ||||||
output [CVA6Cfg.PLEN-1:0] rvfi_mem_paddr_o | ||||||
output [CVA6Cfg.PLEN-1:0] rvfi_mem_paddr_o, | ||||||
// Original instruction AES bits | ||||||
input logic [5:0] orig_instr_aes_i | ||||||
); | ||||||
|
||||||
// ------------------------- | ||||||
|
@@ -301,7 +303,8 @@ module ex_stage | |||||
.rst_ni, | ||||||
.fu_data_i (one_cycle_data), | ||||||
.result_o (alu_result), | ||||||
.alu_branch_res_o(alu_branch_res) | ||||||
.alu_branch_res_o(alu_branch_res), | ||||||
.orig_instr_aes(orig_instr_aes_i) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [verible-verilog-format] reported by reviewdog 🐶
Suggested change
|
||||||
); | ||||||
|
||||||
// 2. Branch Unit (combinatorial) | ||||||
|
@@ -468,7 +471,8 @@ module ex_stage | |||||
.rst_ni, | ||||||
.fu_data_i (alu2_data), | ||||||
.result_o (alu2_result), | ||||||
.alu_branch_res_o( /* this ALU does not handle branching */) | ||||||
.alu_branch_res_o( /* this ALU does not handle branching */), | ||||||
.orig_instr_aes() | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [verible-verilog-format] reported by reviewdog 🐶
Suggested change
|
||||||
); | ||||||
end else begin | ||||||
assign alu2_data = '0; | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[verible-verilog-format] reported by reviewdog 🐶