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

ZiCond Extension #1262

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions core/alu.sv
Original file line number Diff line number Diff line change
Expand Up @@ -295,5 +295,12 @@ module alu import ariane_pkg::*;(
default: ; // default case to suppress unique warning
endcase
end

if (ariane_pkg::RCONDEXT) begin
unique case (fu_data_i.operation)
CZERO_EQZ : result_o = (fu_data_i.operand_b) ? (fu_data_i.operand_a) : (0) ; // move zero to rd if rs2 is equal to zero else rs1
CZERO_NEZ : result_o = (fu_data_i.operand_b) ? (0) : (fu_data_i.operand_a) ; // move zero to rd if rs2 is nonzero else rs1
endcase
end
end
endmodule
19 changes: 18 additions & 1 deletion core/decoder.sv
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ module decoder import ariane_pkg::*; (
);
logic illegal_instr;
logic illegal_instr_bm;
logic illegal_instr_zic;
logic illegal_instr_non_bm;
// this instruction is an environment call (ecall), it is handled like an exception
logic ecall;
Expand Down Expand Up @@ -73,6 +74,7 @@ module decoder import ariane_pkg::*; (
illegal_instr = 1'b0;
illegal_instr_non_bm = 1'b0;
illegal_instr_bm = 1'b0;
illegal_instr_zic = 1'b0;
instruction_o.pc = pc_i;
instruction_o.trans_id = '0;
instruction_o.fu = NONE;
Expand Down Expand Up @@ -543,7 +545,22 @@ module decoder import ariane_pkg::*; (
end
endcase
end
illegal_instr = (ariane_pkg::BITMANIP) ? (illegal_instr_non_bm & illegal_instr_bm) : illegal_instr_non_bm;
if (ariane_pkg::RCONDEXT) begin
unique case ({instr.rtype.funct7, instr.rtype.funct3})
//Conditional move
{7'b000_0111, 3'b101}: instruction_o.op = ariane_pkg::CZERO_EQZ; // czero.eqz
{7'b000_0111, 3'b111}: instruction_o.op = ariane_pkg::CZERO_NEZ; // czero.nez
default: begin
illegal_instr_zic = 1'b1;
end
endcase
end
unique case ({ariane_pkg::BITMANIP, ariane_pkg::RCONDEXT})
2'b00 : illegal_instr = illegal_instr_non_bm;
2'b01 : illegal_instr = illegal_instr_non_bm & illegal_instr_zic;
2'b10 : illegal_instr = illegal_instr_non_bm & illegal_instr_bm;
2'b11 : illegal_instr = illegal_instr_non_bm & illegal_instr_bm & illegal_instr_zic;
endcase
end
end

Expand Down
9 changes: 8 additions & 1 deletion core/include/ariane_pkg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,11 @@ package ariane_pkg;
// ---------------
localparam bit BITMANIP = cva6_config_pkg::CVA6ConfigBExtEn;

// ---------------
// Enable ZiCond
// ---------------
localparam bit RCONDEXT = cva6_config_pkg::CVA6ConfigCondExtEn;

// Only use struct when signals have same direction
// exception
typedef struct packed {
Expand Down Expand Up @@ -546,7 +551,9 @@ package ariane_pkg;
// Shift with Add (Bitmanip)
SH1ADD, SH2ADD, SH3ADD,
// Bitmanip Logical with negate op (Bitmanip)
ANDN, ORN, XNOR
ANDN, ORN, XNOR,
// Zicond instruction
CZERO_EQZ, CZERO_NEZ
} fu_op;

typedef struct packed {
Expand Down
1 change: 1 addition & 0 deletions core/include/cv32a60x_config_pkg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ package cva6_config_pkg;
localparam CVA6ConfigCExtEn = 1;
localparam CVA6ConfigAExtEn = 0;
localparam CVA6ConfigBExtEn = 0;
localparam CVA6ConfigCondExtEn = 0;

localparam CVA6ConfigAxiIdWidth = 4;
localparam CVA6ConfigAxiAddrWidth = 64;
Expand Down
1 change: 1 addition & 0 deletions core/include/cv32a6_embedded_config_pkg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ package cva6_config_pkg;
localparam CVA6ConfigCExtEn = 1;
localparam CVA6ConfigAExtEn = 0;
localparam CVA6ConfigBExtEn = 1;
localparam CVA6ConfigCondExtEn = 0;

localparam CVA6ConfigAxiIdWidth = 4;
localparam CVA6ConfigAxiAddrWidth = 64;
Expand Down
1 change: 1 addition & 0 deletions core/include/cv32a6_ima_sv32_fpga_config_pkg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ package cva6_config_pkg;
localparam CVA6ConfigCExtEn = 0;
localparam CVA6ConfigAExtEn = 1;
localparam CVA6ConfigBExtEn = 0;
localparam CVA6ConfigCondExtEn = 0;

localparam CVA6ConfigAxiIdWidth = 4;
localparam CVA6ConfigAxiAddrWidth = 64;
Expand Down
1 change: 1 addition & 0 deletions core/include/cv32a6_imac_sv0_config_pkg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ package cva6_config_pkg;
localparam CVA6ConfigCExtEn = 1;
localparam CVA6ConfigAExtEn = 1;
localparam CVA6ConfigBExtEn = 0;
localparam CVA6ConfigCondExtEn = 0;

localparam CVA6ConfigAxiIdWidth = 4;
localparam CVA6ConfigAxiAddrWidth = 64;
Expand Down
1 change: 1 addition & 0 deletions core/include/cv32a6_imac_sv32_config_pkg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ package cva6_config_pkg;
localparam CVA6ConfigCExtEn = 1;
localparam CVA6ConfigAExtEn = 1;
localparam CVA6ConfigBExtEn = 0;
localparam CVA6ConfigCondExtEn = 0;

localparam CVA6ConfigAxiIdWidth = 4;
localparam CVA6ConfigAxiAddrWidth = 64;
Expand Down
1 change: 1 addition & 0 deletions core/include/cv32a6_imafc_sv32_config_pkg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ package cva6_config_pkg;
localparam CVA6ConfigCExtEn = 1;
localparam CVA6ConfigAExtEn = 1;
localparam CVA6ConfigBExtEn = 0;
localparam CVA6ConfigCondExtEn = 0;

localparam CVA6ConfigAxiIdWidth = 4;
localparam CVA6ConfigAxiAddrWidth = 64;
Expand Down
1 change: 1 addition & 0 deletions core/include/cv64a6_imafdc_sv39_config_pkg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ package cva6_config_pkg;
localparam CVA6ConfigCExtEn = 1;
localparam CVA6ConfigAExtEn = 1;
localparam CVA6ConfigBExtEn = 1;
localparam CVA6ConfigCondExtEn = 1;

localparam CVA6ConfigAxiIdWidth = 4;
localparam CVA6ConfigAxiAddrWidth = 64;
Expand Down
1 change: 1 addition & 0 deletions core/include/cv64a6_imafdc_sv39_openpiton_config_pkg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ package cva6_config_pkg;
localparam CVA6ConfigCExtEn = 1;
localparam CVA6ConfigAExtEn = 1;
localparam CVA6ConfigBExtEn = 0;
localparam CVA6ConfigCondExtEn = 0;

localparam CVA6ConfigAxiIdWidth = 4;
localparam CVA6ConfigAxiAddrWidth = 64;
Expand Down