data/full_repos/permissive/463481430/RTL/core/exu.v
1: b'%Error: data/full_repos/permissive/463481430/RTL/core/exu.v:6: Cannot find include file: defines.v\n`include "defines.v" \n         ^~~~~~~~~~~\n        ... Looked in:\n             data/full_repos/permissive/463481430/RTL/core,data/full_repos/permissive/463481430/defines.v\n             data/full_repos/permissive/463481430/RTL/core,data/full_repos/permissive/463481430/defines.v.v\n             data/full_repos/permissive/463481430/RTL/core,data/full_repos/permissive/463481430/defines.v.sv\n             defines.v\n             defines.v.v\n             defines.v.sv\n             obj_dir/defines.v\n             obj_dir/defines.v.v\n             obj_dir/defines.v.sv\n%Error: data/full_repos/permissive/463481430/RTL/core/exu.v:7: Cannot find include file: config.v\n`include "config.v" \n         ^~~~~~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/exu.v:21: Define or directive not defined: \'`xlen_def\'\n    input wire[`xlen_def] i_exu_op1,\n               ^~~~~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/exu.v:21: syntax error, unexpected \']\', expecting TYPE-IDENTIFIER\n    input wire[`xlen_def] i_exu_op1,\n                        ^\n%Error: data/full_repos/permissive/463481430/RTL/core/exu.v:22: Define or directive not defined: \'`xlen_def\'\n    input wire[`xlen_def] i_exu_op2,\n               ^~~~~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/exu.v:23: Define or directive not defined: \'`xlen_def\'\n    input wire[`xlen_def] i_rs2rdata,\n               ^~~~~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/exu.v:24: Define or directive not defined: \'`xlen_def\'\n    input wire[`xlen_def] i_imm,\n               ^~~~~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/exu.v:26: syntax error, unexpected input, expecting IDENTIFIER or do or final\n    input wire[`rfidxlen_def] i_rdidx,\n    ^~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/exu.v:26: Define or directive not defined: \'`rfidxlen_def\'\n    input wire[`rfidxlen_def] i_rdidx,\n               ^~~~~~~~~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/exu.v:28: Define or directive not defined: \'`csridxlen_def\'\n    input wire[`csridxlen_def] i_csridx,\n               ^~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/exu.v:29: Define or directive not defined: \'`xlen_def\'\n    input wire[`xlen_def] i_csr_rdata,\n               ^~~~~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/exu.v:30: Define or directive not defined: \'`xlen_def\'\n    input wire[`xlen_def] i_csr_zimm,\n               ^~~~~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/exu.v:32: Define or directive not defined: \'`decinfo_grplen_def\'\n    input wire[`decinfo_grplen_def] i_decinfo_grp,\n               ^~~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/exu.v:33: Define or directive not defined: \'`decinfolen_def\'\n    input wire[`decinfolen_def] i_decinfo,\n               ^~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/exu.v:34: Define or directive not defined: \'`xlen_def\'\n    input wire[`xlen_def] i_iaddr,\n               ^~~~~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/exu.v:39: syntax error, unexpected output, expecting IDENTIFIER or do or final\n    output wire[`rfidxlen_def] o_exu_rdidx0,\n    ^~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/exu.v:39: Define or directive not defined: \'`rfidxlen_def\'\n    output wire[`rfidxlen_def] o_exu_rdidx0,\n                ^~~~~~~~~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/exu.v:41: syntax error, unexpected output, expecting IDENTIFIER or do or final\n    output wire[`rfidxlen_def] o_exu_rdidx1,\n    ^~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/exu.v:41: Define or directive not defined: \'`rfidxlen_def\'\n    output wire[`rfidxlen_def] o_exu_rdidx1,\n                ^~~~~~~~~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/exu.v:43: syntax error, unexpected output, expecting IDENTIFIER or do or final\n    output wire[`rfidxlen_def] o_exu_rdidx2,\n    ^~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/exu.v:43: Define or directive not defined: \'`rfidxlen_def\'\n    output wire[`rfidxlen_def] o_exu_rdidx2,\n                ^~~~~~~~~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/exu.v:48: syntax error, unexpected output, expecting IDENTIFIER or do or final\n    output wire o_rdwen0,\n    ^~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/exu.v:49: syntax error, unexpected output, expecting IDENTIFIER or do or final\n    output wire[`rfidxlen_def] o_rdidx0,\n    ^~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/exu.v:49: Define or directive not defined: \'`rfidxlen_def\'\n    output wire[`rfidxlen_def] o_rdidx0,\n                ^~~~~~~~~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/exu.v:50: Define or directive not defined: \'`xlen_def\'\n    output wire[`xlen_def] o_rdwdata0,\n                ^~~~~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/exu.v:52: syntax error, unexpected output, expecting IDENTIFIER or do or final\n    output wire o_rdwen1,\n    ^~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/exu.v:53: syntax error, unexpected output, expecting IDENTIFIER or do or final\n    output wire[`rfidxlen_def] o_rdidx1,\n    ^~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/exu.v:53: Define or directive not defined: \'`rfidxlen_def\'\n    output wire[`rfidxlen_def] o_rdidx1,\n                ^~~~~~~~~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/exu.v:54: Define or directive not defined: \'`xlen_def\'\n    output wire[`xlen_def] o_rdwdata1,\n                ^~~~~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/exu.v:56: syntax error, unexpected output, expecting IDENTIFIER or do or final\n    output wire o_rdwen2,\n    ^~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/exu.v:57: syntax error, unexpected output, expecting IDENTIFIER or do or final\n    output wire[`rfidxlen_def] o_rdidx2,\n    ^~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/exu.v:57: Define or directive not defined: \'`rfidxlen_def\'\n    output wire[`rfidxlen_def] o_rdidx2,\n                ^~~~~~~~~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/exu.v:58: Define or directive not defined: \'`xlen_def\'\n    output wire[`xlen_def] o_rdwdata2,\n                ^~~~~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/exu.v:61: syntax error, unexpected output, expecting IDENTIFIER or do or final\n    output wire[`csridxlen_def] o_csridx,\n    ^~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/exu.v:61: Define or directive not defined: \'`csridxlen_def\'\n    output wire[`csridxlen_def] o_csridx,\n                ^~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/exu.v:62: Define or directive not defined: \'`xlen_def\'\n    output wire[`xlen_def] o_csr_wdata,\n                ^~~~~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/exu.v:66: syntax error, unexpected output, expecting IDENTIFIER or do or final\n    output wire[`xlen_def] o_exu_jaddr,\n    ^~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/exu.v:66: Define or directive not defined: \'`xlen_def\'\n    output wire[`xlen_def] o_exu_jaddr,\n                ^~~~~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/exu.v:71: syntax error, unexpected output, expecting IDENTIFIER or do or final\n    output wire o_ribm_wrcs, \n    ^~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/exu.v:72: syntax error, unexpected output, expecting IDENTIFIER or do or final\n    output wire[3:0] o_ribm_mask,  \n    ^~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/exu.v:73: syntax error, unexpected output, expecting IDENTIFIER or do or final\n    output wire[31:0] o_ribm_wdata,  \n    ^~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/exu.v:74: syntax error, unexpected input, expecting IDENTIFIER or do or final\n    input wire[31:0] i_ribm_rdata,  \n    ^~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/exu.v:75: syntax error, unexpected output, expecting IDENTIFIER or do or final\n    output wire o_ribm_req,  \n    ^~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/exu.v:76: syntax error, unexpected input, expecting IDENTIFIER or do or final\n    input wire i_ribm_gnt,  \n    ^~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/exu.v:77: syntax error, unexpected input, expecting IDENTIFIER or do or final\n    input wire i_ribm_rsp,  \n    ^~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/exu.v:78: syntax error, unexpected output, expecting IDENTIFIER or do or final\n    output wire o_ribm_rdy\n    ^~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/exu.v:89: Define or directive not defined: \'`xlen_def\'\nwire[`xlen_def] alu_rdwdata;\n     ^~~~~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/exu.v:89: syntax error, unexpected \']\', expecting TYPE-IDENTIFIER\nwire[`xlen_def] alu_rdwdata;\n              ^\n%Error: data/full_repos/permissive/463481430/RTL/core/exu.v:90: Define or directive not defined: \'`xlen_def\'\nwire[`xlen_def] alu2lsu_result;\n     ^~~~~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/exu.v:90: syntax error, unexpected \']\', expecting TYPE-IDENTIFIER\nwire[`xlen_def] alu2lsu_result;\n              ^\n%Error: Exiting due to too many errors encountered; --error-limit=50\n'
module EXU (
    input wire i_clk,
    input wire i_rstn,

    input wire i_vld,


    input wire[`xlen_def] i_exu_op1,
    input wire[`xlen_def] i_exu_op2,
    input wire[`xlen_def] i_rs2rdata,
    input wire[`xlen_def] i_imm,
    input wire i_rdwen,
    input wire[`rfidxlen_def] i_rdidx,

    input wire[`csridxlen_def] i_csridx,
    input wire[`xlen_def] i_csr_rdata,
    input wire[`xlen_def] i_csr_zimm,

    input wire[`decinfo_grplen_def] i_decinfo_grp,
    input wire[`decinfolen_def] i_decinfo,
    input wire[`xlen_def] i_iaddr,



    output wire o_exu_rdwen0,
    output wire[`rfidxlen_def] o_exu_rdidx0,
    output wire o_exu_rdwen1,
    output wire[`rfidxlen_def] o_exu_rdidx1,
    output wire o_exu_rdwen2,
    output wire[`rfidxlen_def] o_exu_rdidx2,
    output wire o_exu_resource_match,



    output wire o_rdwen0,
    output wire[`rfidxlen_def] o_rdidx0,
    output wire[`xlen_def] o_rdwdata0,
    output wire o_mdu_working,
    output wire o_rdwen1,
    output wire[`rfidxlen_def] o_rdidx1,
    output wire[`xlen_def] o_rdwdata1,
    output wire o_lsu_working,
    output wire o_rdwen2,
    output wire[`rfidxlen_def] o_rdidx2,
    output wire[`xlen_def] o_rdwdata2,

    output wire o_csr_wen,
    output wire[`csridxlen_def] o_csridx,
    output wire[`xlen_def] o_csr_wdata,


    output wire o_exu_taken,
    output wire[`xlen_def] o_exu_jaddr,



    output wire[31:0] o_ribm_addr,
    output wire o_ribm_wrcs,
    output wire[3:0] o_ribm_mask,
    output wire[31:0] o_ribm_wdata,
    input wire[31:0] i_ribm_rdata,
    output wire o_ribm_req,
    input wire i_ribm_gnt,
    input wire i_ribm_rsp,
    output wire o_ribm_rdy

);





wire alu_rdwen;
wire[`xlen_def] alu_rdwdata;
wire[`xlen_def] alu2lsu_result;
EXU_ALU u_EXU_ALU(
    .i_clk         ( i_clk         ),
    .i_rstn        ( i_rstn        ),

    .i_alu_rdidx   ( i_rdidx   ),
    .i_decinfo_grp ( i_decinfo_grp ),
    .i_aluinfo     ( i_decinfo     ),
    .i_alu_op1     ( i_exu_op1     ),
    .i_alu_op2     ( i_exu_op2     ),

    .o_alu_rdwen   ( alu_rdwen   ),
    .o_alu_rdidx   (    ),
    .o_alu_rdwdata ( alu_rdwdata ),

    .o_lsu_result  ( alu2lsu_result  )
);

wire bju_rdwen;
wire[`xlen_def] bju_rdwdata;
EXU_BJU u_EXU_BJU(
    .i_clk         ( i_clk         ),
    .i_rstn        ( i_rstn        ),

    .i_bju_rdidx   ( i_rdidx   ),
    .i_decinfo_grp ( i_decinfo_grp ),
    .i_bjuinfo     ( i_decinfo     ),
    
    .i_iaddr       ( i_iaddr       ),
    .i_imm         ( i_imm         ),
    .i_bju_op1     ( i_exu_op1     ),
    .i_bju_op2     ( i_exu_op2     ),

    .o_bju_taken   ( o_exu_taken   ),
    .o_bju_jaddr   ( o_exu_jaddr   ),

    .o_bju_rdwen   ( bju_rdwen   ),
    .o_bju_rdidx   (    ),
    .o_bju_rdwdata  ( bju_rdwdata  )
);


wire scu_rdwen;
wire[`xlen_def] scu_rdwdata;
EXU_SCU u_EXU_SCU(
    .i_clk         ( i_clk         ),
    .i_rstn        ( i_rstn        ),

    .i_decinfo_grp ( i_decinfo_grp ),
    .i_scuinfo     ( i_decinfo     ),

    .i_scu_op1     ( i_exu_op1     ),
    .i_csr_rdata   ( i_csr_rdata   ),
    .i_csr_zimm    ( i_csr_zimm    ),
    

    .o_scu_rdwen   ( scu_rdwen   ),
    .o_scu_wdata   ( scu_rdwdata   ),

    .o_csr_wen     ( o_csr_wen     ),
    .o_csr_wdata   ( o_csr_wdata   )
);
assign o_csridx = i_csridx;



assign o_rdwen0 = (alu_rdwen | bju_rdwen | scu_rdwen) & i_rdwen;
assign o_rdidx0 = i_rdidx;
assign o_rdwdata0 = alu_rdwen ? alu_rdwdata : 
                    bju_rdwen ? bju_rdwdata : 
                    scu_rdwdata;


assign o_exu_rdwen0 = (i_decinfo_grp[`decinfo_grp_lsu] | i_decinfo_grp[`decinfo_grp_mdu]) & i_rdwen;
assign o_exu_rdidx0 = i_rdidx;



wire mdu_will_rdwen;
wire[`rfidxlen_def] mdu_will_rdidx;




wire mdu_flush = (i_rdwen & mdu_will_rdwen) ? (i_rdidx == mdu_will_rdidx) : 0;

wire mdu_working;
EXU_MDU u_EXU_MDU(
    .i_clk         ( i_clk         ),
    .i_rstn        ( i_rstn        ),

    .i_vld          ( i_vld        ),
    .i_flush        ( mdu_flush    ),   

    .i_decinfo_grp ( i_decinfo_grp ),
    .i_mduinfo     ( i_decinfo     ),
    .i_mdu_rdwen   ( i_rdwen   ),
    .i_mdu_rdidx   ( i_rdidx   ),
    .i_mdu_op1     ( i_exu_op1     ),
    .i_mdu_op2     ( i_exu_op2     ),

    .o_working     ( mdu_working     ),
    .o_will_rdwen  ( mdu_will_rdwen  ),
    .o_will_rdidx  ( mdu_will_rdidx  ),

    .o_mdu_rdwen   ( o_rdwen1   ),
    .o_mdu_rdidx   ( o_rdidx1   ),
    .o_mdu_rdwdata  ( o_rdwdata1  )
);


assign o_exu_rdwen1 = mdu_will_rdwen ;
assign o_exu_rdidx1 = mdu_will_rdidx;

assign o_mdu_working = mdu_working;







wire lsu_will_rdwen;
wire[`rfidxlen_def] lsu_will_rdidx;

wire lsu_flush = (i_rdwen&lsu_will_rdwen) ? (i_rdidx == lsu_will_rdidx) : 0;
wire lsu_working;
EXU_LSU u_EXU_LSU(
    .i_clk          ( i_clk          ),
    .i_rstn         ( i_rstn         ),

    .i_vld          ( i_vld        ),
    .i_flush        ( lsu_flush    ),

    .i_decinfo_grp  ( i_decinfo_grp  ),
    .i_lsuinfo      ( i_decinfo      ),
    .i_lsu_rdwen    ( i_rdwen       ),
    .i_lsu_rdidx    ( i_rdidx         ),
    .i_lsu_rs2rdata ( i_rs2rdata     ),
    .i_lsu_addr     ( alu2lsu_result     ),

    .o_working      ( lsu_working      ),
    .o_will_rdwen   ( lsu_will_rdwen   ),
    .o_will_rdidx   ( lsu_will_rdidx   ),

    .o_lsu_rdwen    ( o_rdwen2     ),
    .o_lsu_rdidx    ( o_rdidx2    ),
    .o_lsu_rdata    ( o_rdwdata2    ),

    .o_ribm_addr    ( o_ribm_addr    ),
    .o_ribm_wrcs    ( o_ribm_wrcs    ),
    .o_ribm_mask    ( o_ribm_mask    ),
    .o_ribm_wdata   ( o_ribm_wdata   ),
    .i_ribm_rdata   ( i_ribm_rdata   ),
    .o_ribm_req     ( o_ribm_req     ),
    .i_ribm_gnt     ( i_ribm_gnt     ),
    .i_ribm_rsp     ( i_ribm_rsp     ),
    .o_ribm_rdy     ( o_ribm_rdy     )
);

assign o_exu_rdwen2 = lsu_will_rdwen;
assign o_exu_rdidx2 = lsu_will_rdidx;

assign o_lsu_working = lsu_working;


assign o_exu_resource_match = (i_decinfo_grp[`decinfo_grp_mdu] & mdu_working) |
                              (i_decinfo_grp[`decinfo_grp_lsu] & lsu_working);









    
endmodule
module EXU (
    input wire i_clk,
    input wire i_rstn,

    input wire i_vld,


    input wire[`xlen_def] i_exu_op1,
    input wire[`xlen_def] i_exu_op2,
    input wire[`xlen_def] i_rs2rdata,
    input wire[`xlen_def] i_imm,
    input wire i_rdwen,
    input wire[`rfidxlen_def] i_rdidx,

    input wire[`csridxlen_def] i_csridx,
    input wire[`xlen_def] i_csr_rdata,
    input wire[`xlen_def] i_csr_zimm,

    input wire[`decinfo_grplen_def] i_decinfo_grp,
    input wire[`decinfolen_def] i_decinfo,
    input wire[`xlen_def] i_iaddr,



    output wire o_exu_rdwen0,
    output wire[`rfidxlen_def] o_exu_rdidx0,
    output wire o_exu_rdwen1,
    output wire[`rfidxlen_def] o_exu_rdidx1,
    output wire o_exu_rdwen2,
    output wire[`rfidxlen_def] o_exu_rdidx2,
    output wire o_exu_resource_match,



    output wire o_rdwen0,
    output wire[`rfidxlen_def] o_rdidx0,
    output wire[`xlen_def] o_rdwdata0,
    output wire o_mdu_working,
    output wire o_rdwen1,
    output wire[`rfidxlen_def] o_rdidx1,
    output wire[`xlen_def] o_rdwdata1,
    output wire o_lsu_working,
    output wire o_rdwen2,
    output wire[`rfidxlen_def] o_rdidx2,
    output wire[`xlen_def] o_rdwdata2,

    output wire o_csr_wen,
    output wire[`csridxlen_def] o_csridx,
    output wire[`xlen_def] o_csr_wdata,


    output wire o_exu_taken,
    output wire[`xlen_def] o_exu_jaddr,



    output wire[31:0] o_ribm_addr,
    output wire o_ribm_wrcs,
    output wire[3:0] o_ribm_mask,
    output wire[31:0] o_ribm_wdata,
    input wire[31:0] i_ribm_rdata,
    output wire o_ribm_req,
    input wire i_ribm_gnt,
    input wire i_ribm_rsp,
    output wire o_ribm_rdy

);






wire alu_rdwen;
wire[`xlen_def] alu_rdwdata;
wire[`xlen_def] alu2lsu_result;
EXU_ALU u_EXU_ALU(
    .i_clk         ( i_clk         ),
    .i_rstn        ( i_rstn        ),

    .i_alu_rdidx   ( i_rdidx   ),
    .i_decinfo_grp ( i_decinfo_grp ),
    .i_aluinfo     ( i_decinfo     ),
    .i_alu_op1     ( i_exu_op1     ),
    .i_alu_op2     ( i_exu_op2     ),

    .o_alu_rdwen   ( alu_rdwen   ),
    .o_alu_rdidx   (    ),
    .o_alu_rdwdata ( alu_rdwdata ),

    .o_lsu_result  ( alu2lsu_result  )
);

wire bju_rdwen;
wire[`xlen_def] bju_rdwdata;
EXU_BJU u_EXU_BJU(
    .i_clk         ( i_clk         ),
    .i_rstn        ( i_rstn        ),

    .i_bju_rdidx   ( i_rdidx   ),
    .i_decinfo_grp ( i_decinfo_grp ),
    .i_bjuinfo     ( i_decinfo     ),
    
    .i_iaddr       ( i_iaddr       ),
    .i_imm         ( i_imm         ),
    .i_bju_op1     ( i_exu_op1     ),
    .i_bju_op2     ( i_exu_op2     ),

    .o_bju_taken   ( o_exu_taken   ),
    .o_bju_jaddr   ( o_exu_jaddr   ),

    .o_bju_rdwen   ( bju_rdwen   ),
    .o_bju_rdidx   (    ),
    .o_bju_rdwdata  ( bju_rdwdata  )
);


wire scu_rdwen;
wire[`xlen_def] scu_rdwdata;
EXU_SCU u_EXU_SCU(
    .i_clk         ( i_clk         ),
    .i_rstn        ( i_rstn        ),

    .i_decinfo_grp ( i_decinfo_grp ),
    .i_scuinfo     ( i_decinfo     ),

    .i_scu_op1     ( i_exu_op1     ),
    .i_csr_rdata   ( i_csr_rdata   ),
    .i_csr_zimm    ( i_csr_zimm    ),
    

    .o_scu_rdwen   ( scu_rdwen   ),
    .o_scu_wdata   ( scu_rdwdata   ),

    .o_csr_wen     ( o_csr_wen     ),
    .o_csr_wdata   ( o_csr_wdata   )
);
assign o_csridx = i_csridx;



assign o_rdwen0 = (alu_rdwen | bju_rdwen | scu_rdwen) & i_rdwen;
assign o_rdidx0 = i_rdidx;
assign o_rdwdata0 = alu_rdwen ? alu_rdwdata : 
                    bju_rdwen ? bju_rdwdata : 
                    scu_rdwdata;


assign o_exu_rdwen0 = (i_decinfo_grp[`decinfo_grp_lsu] | i_decinfo_grp[`decinfo_grp_mdu]) & i_rdwen;
assign o_exu_rdidx0 = i_rdidx;



wire mdu_will_rdwen;
wire[`rfidxlen_def] mdu_will_rdidx;




wire mdu_flush = (i_rdwen & mdu_will_rdwen) ? (i_rdidx == mdu_will_rdidx) : 0;

wire mdu_working;
EXU_MDU u_EXU_MDU(
    .i_clk         ( i_clk         ),
    .i_rstn        ( i_rstn        ),

    .i_vld          ( i_vld        ),
    .i_flush        ( mdu_flush    ),   

    .i_decinfo_grp ( i_decinfo_grp ),
    .i_mduinfo     ( i_decinfo     ),
    .i_mdu_rdwen   ( i_rdwen   ),
    .i_mdu_rdidx   ( i_rdidx   ),
    .i_mdu_op1     ( i_exu_op1     ),
    .i_mdu_op2     ( i_exu_op2     ),

    .o_working     ( mdu_working     ),
    .o_will_rdwen  ( mdu_will_rdwen  ),
    .o_will_rdidx  ( mdu_will_rdidx  ),

    .o_mdu_rdwen   ( o_rdwen1   ),
    .o_mdu_rdidx   ( o_rdidx1   ),
    .o_mdu_rdwdata  ( o_rdwdata1  )
);


assign o_exu_rdwen1 = mdu_will_rdwen ;
assign o_exu_rdidx1 = mdu_will_rdidx;

assign o_mdu_working = mdu_working;







wire lsu_will_rdwen;
wire[`rfidxlen_def] lsu_will_rdidx;

wire lsu_flush = (i_rdwen&lsu_will_rdwen) ? (i_rdidx == lsu_will_rdidx) : 0;
wire lsu_working;
EXU_LSU u_EXU_LSU(
    .i_clk          ( i_clk          ),
    .i_rstn         ( i_rstn         ),

    .i_vld          ( i_vld        ),
    .i_flush        ( lsu_flush    ),

    .i_decinfo_grp  ( i_decinfo_grp  ),
    .i_lsuinfo      ( i_decinfo      ),
    .i_lsu_rdwen    ( i_rdwen       ),
    .i_lsu_rdidx    ( i_rdidx         ),
    .i_lsu_rs2rdata ( i_rs2rdata     ),
    .i_lsu_addr     ( alu2lsu_result     ),

    .o_working      ( lsu_working      ),
    .o_will_rdwen   ( lsu_will_rdwen   ),
    .o_will_rdidx   ( lsu_will_rdidx   ),

    .o_lsu_rdwen    ( o_rdwen2     ),
    .o_lsu_rdidx    ( o_rdidx2    ),
    .o_lsu_rdata    ( o_rdwdata2    ),

    .o_ribm_addr    ( o_ribm_addr    ),
    .o_ribm_wrcs    ( o_ribm_wrcs    ),
    .o_ribm_mask    ( o_ribm_mask    ),
    .o_ribm_wdata   ( o_ribm_wdata   ),
    .i_ribm_rdata   ( i_ribm_rdata   ),
    .o_ribm_req     ( o_ribm_req     ),
    .i_ribm_gnt     ( i_ribm_gnt     ),
    .i_ribm_rsp     ( i_ribm_rsp     ),
    .o_ribm_rdy     ( o_ribm_rdy     )
);

assign o_exu_rdwen2 = lsu_will_rdwen;
assign o_exu_rdidx2 = lsu_will_rdidx;

assign o_lsu_working = lsu_working;


assign o_exu_resource_match = (i_decinfo_grp[`decinfo_grp_mdu] & mdu_working) |
                              (i_decinfo_grp[`decinfo_grp_lsu] & lsu_working);









    
endmodule