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

Added support for inline constants in lsu instructions #15

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
48 changes: 42 additions & 6 deletions src/verilog/rtl/lsu/lsu.v
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@






module lsu
(/*AUTOARG*/
// Outputs
Expand Down Expand Up @@ -85,6 +91,13 @@ assign exec_rd_wfid = issue_wfid;
reg [31:0] issue_opcode_flopped;
reg [15:0] issue_lds_base_flopped;
reg [15:0] issue_imm_value0_flopped;
//pduarte: added wires and reg required for aditional logic regarding inline constants
wire [31:0] final_sgpr_source2_data;
wire op_manager_sgpr_source2_rd_en;
reg [31:0] final_sgpr_source2_data_reg;


assign final_sgpr_source2_data = final_sgpr_source2_data_reg;

wire [2047:0] calc_mem_addr;
wire gm_or_lds;
Expand Down Expand Up @@ -113,6 +126,7 @@ always@(posedge clk) begin
issue_opcode_flopped <= 32'd0;
issue_lds_base_flopped <= 16'd0;
issue_imm_value0_flopped <= 16'd0;

end
else begin
issue_opcode_flopped <= issue_opcode;
Expand All @@ -122,6 +136,25 @@ always@(posedge clk) begin

end

always @(*)//pduarte: aditional logic for inline constants
begin
if(rst) begin
final_sgpr_source2_data_reg <= 32'd0;
end
else begin

if(~issue_source_reg1[11])
begin
final_sgpr_source2_data_reg <= {{23{issue_source_reg1[8]}},issue_source_reg1[8:0]};
end
else
begin
final_sgpr_source2_data_reg <= sgpr_source2_data;
end

end
end

// The decoder requires two cycles to receive the entire opcode. On the second
// cycle it generates register read operations for getting addres values from
// the GPRs.
Expand Down Expand Up @@ -156,7 +189,7 @@ lsu_opcode_decoder lsu_opcode_decoder0(
);

lsu_op_manager lsu_op_manager0(
.lsu_wfid(issue_wfid),
.lsu_wfid(issue_wfid),
.instr_pc(issue_instr_pc),

// Signals to indicate a new memory request
Expand Down Expand Up @@ -207,9 +240,9 @@ lsu_op_manager lsu_op_manager0(
.vgpr_instr_done(vgpr_instr_done),
.lsu_done_wfid(lsu_done_wfid),
.sgpr_instr_done_wfid(sgpr_instr_done_wfid),
.vgpr_instr_done_wfid(vgpr_instr_done_wfid),

.retire_pc(tracemon_retire_pc),
.vgpr_instr_done_wfid(vgpr_instr_done_wfid),
.retire_pc(tracemon_retire_pc),
.retire_gm_or_lds(tracemon_gm_or_lds),
.tracemon_mem_addr(tracemon_mem_addr),

Expand All @@ -221,7 +254,7 @@ lsu_op_manager lsu_op_manager0(
.mem_gm_or_lds(mem_gm_or_lds),

.sgpr_source1_rd_en(sgpr_source1_rd_en),
.sgpr_source2_rd_en(sgpr_source2_rd_en),
.sgpr_source2_rd_en(op_manager_sgpr_source2_rd_en),//pduarte: if the input is an inline constant no rd_en is required, redirected output .sgpr_source2_rd_en(sgpr_source2_rd_en),
.sgpr_source1_addr(sgpr_source1_addr),
.sgpr_source2_addr(sgpr_source2_addr),

Expand All @@ -240,14 +273,17 @@ lsu_op_manager lsu_op_manager0(
lsu_addr_calculator addr_calc(
.in_vector_source_b(vgpr_source2_data),
.in_scalar_source_a(sgpr_source1_data),
.in_scalar_source_b(sgpr_source2_data),
//.in_scalar_source_b(final_sgpr_source2_data),//pduarte: second source may come from inline constant .in_scalar_source_b(sgpr_source2_data),
.in_opcode(issue_opcode_flopped),
.in_lds_base(issue_lds_base_flopped),
.in_imm_value0(issue_imm_value0_flopped),
.out_ld_st_addr(calc_mem_addr),
.out_gm_or_lds(gm_or_lds)
);


assign sgpr_source2_rd_en = op_manager_sgpr_source2_rd_en & ~issue_source_reg1[11];//pduarte: if element 11 is set then it's an inline constant

assign rfa_dest_wr_req = (|sgpr_dest_wr_en) | vgpr_dest_wr_en;

// Something of a hack, at this point it's not actually needed
Expand Down