Skip to content
Merged
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
17 changes: 12 additions & 5 deletions rtl/ibex_compressed_decoder.sv
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ module ibex_compressed_decoder #(
function automatic logic [4:0] cm_stack_adj_word(input logic [3:0] rlist,
input logic [1:0] spimm);
logic [6:0] tmp;
logic [1:0] _unused;
logic [1:0] unused_tmp;
tmp = cm_stack_adj(.rlist(rlist), .spimm(spimm));
_unused = tmp[1:0];
unused_tmp = tmp[1:0];
return tmp[6:2];
endfunction

Expand All @@ -79,8 +79,12 @@ module ibex_compressed_decoder #(
function automatic logic [31:0] cm_push_store_reg(input logic [4:0] rlist,
input logic [4:0] sp_offset);
logic [11:0] neg_offset;
logic signed [11:0] neg_offset_signed;
logic [31:0] instr;
neg_offset = ~{5'b00000, sp_offset, 2'b00} + 12'd1;
// Compute two's complement on signed variable, then cast back to unsigned
// for the part select operations below.
neg_offset_signed = -signed'({5'b00000, sp_offset, 2'b00});
neg_offset = unsigned'(neg_offset_signed);
instr[ 6: 0] /* opcode */ = OPCODE_STORE;
instr[11: 7] /* offset[4:0] */ = neg_offset[4:0];
instr[14:12] /* width */ = 3'b010; // 32 bit
Expand All @@ -105,15 +109,18 @@ module ibex_compressed_decoder #(
input logic [1:0] spimm,
input logic decr = 1'b0);
logic [11:0] imm;
logic signed [11:0] imm_signed;
logic [31:0] instr;
imm[11:7] = '0;
imm[ 6:0] = cm_stack_adj(.rlist(rlist), .spimm(spimm));
if (decr) imm = ~imm + 12'd1;
// Compute two's complement on signed variable, but as it will be used in
// unsigned targets below, it will have to be cast back to unsigned then.
imm_signed = decr ? -signed'(imm) : signed'(imm);
instr[ 6: 0] /* opcode */ = OPCODE_OP_IMM;
instr[11: 7] /* dest reg */ = 5'd2; // x2 (sp / stack pointer)
instr[14:12] /* funct3 */ = 3'b000; // addi
instr[19:15] /* src reg */ = 5'd2; // x2
instr[31:20] /* imm[11:0] */ = imm;
instr[31:20] /* imm[11:0] */ = unsigned'(imm_signed);
return instr;
endfunction

Expand Down
5 changes: 4 additions & 1 deletion rtl/ibex_core.sv
Original file line number Diff line number Diff line change
Expand Up @@ -1932,10 +1932,13 @@ module ibex_core import ibex_pkg::*; #(
end

`else
logic unused_instr_new_id, unused_instr_id_done, unused_instr_done_wb;
logic unused_instr_new_id, unused_instr_id_done, unused_instr_done_wb,
unused_instr_expanded_id, unused_instr_gets_expanded_id;
assign unused_instr_id_done = instr_id_done;
assign unused_instr_new_id = instr_new_id;
assign unused_instr_done_wb = instr_done_wb;
assign unused_instr_expanded_id = ^instr_expanded_id;
assign unused_instr_gets_expanded_id = ^instr_gets_expanded_id;
`endif

// Certain parameter combinations are not supported
Expand Down
Loading