From 7911c58349379c0b291b0acbdff4cd306cef6347 Mon Sep 17 00:00:00 2001 From: d1duarte Date: Mon, 30 May 2016 11:57:02 +0100 Subject: [PATCH] Added support for inline constants in lsu instructions --- src/verilog/rtl/lsu/lsu.v | 48 ++++++++++++++++++++++++++++++++++----- 1 file changed, 42 insertions(+), 6 deletions(-) diff --git a/src/verilog/rtl/lsu/lsu.v b/src/verilog/rtl/lsu/lsu.v index d4db5ba..a08b0bf 100644 --- a/src/verilog/rtl/lsu/lsu.v +++ b/src/verilog/rtl/lsu/lsu.v @@ -1,3 +1,9 @@ + + + + + + module lsu (/*AUTOARG*/ // Outputs @@ -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; @@ -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; @@ -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. @@ -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 @@ -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), @@ -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), @@ -240,7 +273,7 @@ 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), @@ -248,6 +281,9 @@ lsu_addr_calculator addr_calc( .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