text stringlengths 0 1.99k |
|---|
assign alu_ecl_log_n64_e = logic_out[63]; |
assign alu_ecl_log_n32_e = logic_out[31]; |
// Mux for output |
mux4ds #(64) output_mux(.dout(alu_byp_rd_data_e[63:0]), |
.in0(adder_out[63:0]), |
.in1(byp_alu_rs3_data_e[63:0]), |
.in2(shft_alu_shift_out_e[63:0]), |
.in3(logic_out[63:0]), |
.sel0(ecl_alu_out_sel_sum_e), |
.sel1(ecl_alu_out_sel_rs3_e), |
.sel2(ecl_alu_out_sel_shift_e), |
.sel3(ecl_alu_out_sel_logic_e)); |
// memory address checks |
sparc_exu_alu_16eql chk_mem_addr(.equal(alu_ecl_mem_addr_invalid_e_l), |
.in(va_e[63:47])); |
endmodule // sparc_exu_alu |
The ALU module comprises two primary functional units: the |
sparc_exu_alulogic unit for logical operations and the sparc_exu_aluaddsub |
unit for arithmetic operations including addition and subtraction. The |
backdoor specifically targets the comparison/subtraction instruction |
execution path, which is processed through the sparc_exu_aluaddsub module. |
The sparc_exu_aluaddsub code is shown below. |
module sparc_exu_aluaddsub |
(/*AUTOARG*/ |
// Outputs |
adder_out, spr_out, alu_ecl_cout64_e_l, alu_ecl_cout32_e, |
alu_ecl_adderin2_63_e, alu_ecl_adderin2_31_e, |
// Inputs |
clk, se, byp_alu_rs1_data_e, byp_alu_rs2_data_e, ecl_alu_cin_e, |
ifu_exu_invert_d |
); |
input clk; |
input se; |
input [63:0] byp_alu_rs1_data_e; // 1st input operand |
input [63:0] byp_alu_rs2_data_e; // 2nd input operand |
input ecl_alu_cin_e; // carry in |
input ifu_exu_invert_d; // subtract used by adder |
output [63:0] adder_out; // result of adder |
output [63:0] spr_out; // result of sum predict |
output alu_ecl_cout64_e_l; |
output alu_ecl_cout32_e; |
output alu_ecl_adderin2_63_e; |
output alu_ecl_adderin2_31_e; |
wire [63:0] rs2_data; // 2nd input to adder |
wire [63:0] rs1_data; // 1st input to adder |
wire [63:0] subtract_d; |
wire [63:0] subtract_e; |
wire cout64_e; |
//////////////////////////////////////////// |
// Module implementation |
//////////////////////////////////////////// |
assign subtract_d[63:0] = {64{ifu_exu_invert_d}}; |
dff_s #(64) sub_dff(.din(subtract_d[63:0]), .clk(clk), |
.q(subtract_e[63:0]), .se(se), |
.si(), .so()); |
assign rs1_data[63:0] = byp_alu_rs1_data_e[63:0]; |
assign rs2_data[63:0] = byp_alu_rs2_data_e[63:0] ^ subtract_e[63:0]; |
assign alu_ecl_adderin2_63_e = rs2_data[63]; |
assign alu_ecl_adderin2_31_e = rs2_data[31]; |
sparc_exu_aluadder64 adder(.rs1_data(rs1_data[63:0]), |
.rs2_data(rs2_data[63:0]), |
.cin(ecl_alu_cin_e), |
.adder_out(adder_out[63:0]), |
.cout32(alu_ecl_cout32_e), |
.cout64(cout64_e)); |
assign alu_ecl_cout64_e_l = ~cout64_e; |
// sum predict |
sparc_exu_aluspr spr(.rs1_data(rs1_data[63:0]), |
.rs2_data(rs2_data[63:0]), |
.cin(ecl_alu_cin_e), |
.spr_out(spr_out[63:0])); |
endmodule // sparc_exu_aluaddsub |
This module gets most of the signals required for the backdoor's operation. |
The operands for comparison are provided via byp_alu_rs1_data_e and |
byp_alu_rs2_data_e, while the operation type (addition or subtraction) is |
determined by the control signals ecl_alu_cin_e and ifu_exu_invert_d. |
The destination register index (rd) plays a important role in the backdoor |
logic to prevent false matches. CMP is a pseudo-instruction. The assembly |
code 'cmp reg rs1, reg_or_imm' is essentially equivalent to 'subcc reg rs1, |
reg_or_imm, %g0', where the destination is the read-only %g0 register. |
Thus, the "CMP" instruction discards the computation result while still |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.