Skip to content

Commit

Permalink
Added cgethigh (still not verified due to lack of compiler support)
Browse files Browse the repository at this point in the history
  • Loading branch information
kliuMsft committed Mar 1, 2024
1 parent 029d34f commit 433bf73
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 2 deletions.
1 change: 1 addition & 0 deletions rtl/cheri_decoder.sv
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ module cheri_decoder import cheri_pkg::*; # (
cheri_operator_o[CGET_PERM] = cheri_opcode_en_i && (func3_op==0) && (func7_op==7'h7f) && (imm5_op==5'h00);
cheri_operator_o[CGET_TYPE] = cheri_opcode_en_i && (func3_op==0) && (func7_op==7'h7f) && (imm5_op==5'h01);
cheri_operator_o[CGET_BASE] = cheri_opcode_en_i && (func3_op==0) && (func7_op==7'h7f) && (imm5_op==5'h02);
cheri_operator_o[CGET_HIGH] = cheri_opcode_en_i && (func3_op==0) && (func7_op==7'h7f) && (imm5_op==5'h17);
cheri_operator_o[CGET_TOP] = cheri_opcode_en_i && (func3_op==0) && (func7_op==7'h7f) && (imm5_op==5'h18);
cheri_operator_o[CGET_LEN] = cheri_opcode_en_i && (func3_op==0) && (func7_op==7'h7f) && (imm5_op==5'h03);
cheri_operator_o[CGET_TAG] = cheri_opcode_en_i && (func3_op==0) && (func7_op==7'h7f) && (imm5_op==5'h04);
Expand Down
11 changes: 11 additions & 0 deletions rtl/cheri_ex.sv
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

module cheri_ex import cheri_pkg::*; #(
parameter bit WritebackStage = 1'b0,
parameter bit MemCapFmt = 1'b0,
parameter int unsigned HeapBase,
parameter int unsigned TSMapBase,
parameter int unsigned TSMapSize,
Expand Down Expand Up @@ -365,6 +366,16 @@ module cheri_ex import cheri_pkg::*; #(
cheri_rf_we_raw = 1'b1;
cheri_ex_valid_raw = 1'b1;
end
cheri_operator_i[CGET_HIGH]:
begin
logic [65:0] tmp66;
tmp66 = MemCapFmt ? reg2mem_fmt1(rf_rcap_a, rf_rdata_a) :
{reg2memcap_fmt0(rf_rcap_a), rf_rdata_a};
result_data_o = tmp66[64:33];
result_cap_o = NULL_REG_CAP;
cheri_rf_we_raw = 1'b1;
cheri_ex_valid_raw = 1'b1;
end
(cheri_operator_i[CSEAL] | cheri_operator_i[CUNSEAL]):
begin // cd <-- cs1; cd.otyp <-- cs2.otype; cd.sealed <-- val
result_data_o = rf_rdata_a;
Expand Down
2 changes: 1 addition & 1 deletion rtl/cheri_pkg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,7 @@ $display("--- set_bounds: b1 = %x, t1 = %x, b2 = %x, t2 = %x", base1, top1, bas
CGET_LEN = 6'h03,
CGET_TAG = 6'h04,
CGET_TOP = 6'h05,
// CGET_OFFSET = 6'h06,
CGET_HIGH = 6'h06,
CGET_ADDR = 6'h07,
CSEAL = 6'h08,
CUNSEAL = 6'h09,
Expand Down
1 change: 1 addition & 0 deletions rtl/ibex_core.sv
Original file line number Diff line number Diff line change
Expand Up @@ -874,6 +874,7 @@ module ibex_core import ibex_pkg::*; import cheri_pkg::*; #(
if (CHERIoTEn) begin : g_cheri_ex
cheri_ex #(
.WritebackStage (WritebackStage),
.MemCapFmt (MemCapFmt),
.HeapBase (HeapBase),
.TSMapBase (TSMapBase),
.TSMapSize (TSMapSize),
Expand Down
2 changes: 1 addition & 1 deletion rtl/ibex_tracer.sv
Original file line number Diff line number Diff line change
Expand Up @@ -1352,7 +1352,7 @@ module ibex_tracer import cheri_pkg::*; # (
INSN_CHGETTAG: decode_cheri_rd_cs1_insn("CH.cgettag");
INSN_CHGETSEALED: decode_cheri_rd_cs1_insn("CH.cgetseald");
INSN_CHGETADDR: decode_cheri_rd_cs1_insn("CH.cgetaddr");
INSN_CHGETTOP: decode_cheri_rd_cs1_insn("CH.cgettop");
INSN_CHGETHIGH: decode_cheri_rd_cs1_insn("CH.cgethigh");

INSN_CHSEAL: decode_cheri_cd_cs1_cs2_insn("CH.cseal");
INSN_CHUNSEAL: decode_cheri_cd_cs1_cs2_insn("CH.cunseal");
Expand Down
1 change: 1 addition & 0 deletions rtl/ibex_tracer_pkg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@ package ibex_tracer_pkg;
parameter logic [31:0] INSN_CHGETPERM = {7'h7f, 5'h0, 5'h?, 3'b000, 5'h?, {OPCODE_CHERI} };
parameter logic [31:0] INSN_CHGETTYPE = {7'h7f, 5'h1, 5'h?, 3'b000, 5'h?, {OPCODE_CHERI} };
parameter logic [31:0] INSN_CHGETBASE = {7'h7f, 5'h2, 5'h?, 3'b000, 5'h?, {OPCODE_CHERI} };
parameter logic [31:0] INSN_CHGETHIGH = {7'h7f, 5'h17, 5'h?, 3'b000, 5'h?, {OPCODE_CHERI} };
parameter logic [31:0] INSN_CHGETTOP = {7'h7f, 5'h18, 5'h?, 3'b000, 5'h?, {OPCODE_CHERI} };
parameter logic [31:0] INSN_CHGETLEN = {7'h7f, 5'h3, 5'h?, 3'b000, 5'h?, {OPCODE_CHERI} };
parameter logic [31:0] INSN_CHGETTAG = {7'h7f, 5'h4, 5'h?, 3'b000, 5'h?, {OPCODE_CHERI} };
Expand Down

0 comments on commit 433bf73

Please sign in to comment.