data/full_repos/permissive/463481430/RTL/core/bpu.v
1: b'%Error: data/full_repos/permissive/463481430/RTL/core/bpu.v:7: 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/bpu.v:8: Cannot find include file: config.v\n`include "config.v" \n         ^~~~~~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/bpu.v:23: Define or directive not defined: \'`xlen_def\'\n    input wire[`xlen_def] i_iaddr,\n               ^~~~~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/bpu.v:23: syntax error, unexpected \']\', expecting TYPE-IDENTIFIER\n    input wire[`xlen_def] i_iaddr,\n                        ^\n%Error: data/full_repos/permissive/463481430/RTL/core/bpu.v:24: Define or directive not defined: \'`ilen_def\'\n                                                              : ... Suggested alternative: \'`ifndef\'\n    input wire[`ilen_def] i_data,\n               ^~~~~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/bpu.v:28: syntax error, unexpected output, expecting IDENTIFIER or do or final\n    output wire[`rfidxlen_def] o_bpu_rs1idx,\n    ^~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/bpu.v:28: Define or directive not defined: \'`rfidxlen_def\'\n    output wire[`rfidxlen_def] o_bpu_rs1idx,\n                ^~~~~~~~~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/bpu.v:30: syntax error, unexpected output, expecting IDENTIFIER or do or final\n    output wire[`rfidxlen_def] o_bpu_rs2idx,\n    ^~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/bpu.v:30: Define or directive not defined: \'`rfidxlen_def\'\n    output wire[`rfidxlen_def] o_bpu_rs2idx,\n                ^~~~~~~~~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/bpu.v:34: 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/bpu.v:34: Define or directive not defined: \'`rfidxlen_def\'\n    input wire[`rfidxlen_def] i_rdidx,\n               ^~~~~~~~~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/bpu.v:35: Define or directive not defined: \'`xlen_def\'\n    input wire[`xlen_def] i_rd_wdata,\n               ^~~~~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/bpu.v:38: syntax error, unexpected input, expecting IDENTIFIER or do or final\n    input wire[`rfidxlen_def] i_bypass_rdidx,\n    ^~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/bpu.v:38: Define or directive not defined: \'`rfidxlen_def\'\n    input wire[`rfidxlen_def] i_bypass_rdidx,\n               ^~~~~~~~~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/bpu.v:39: Define or directive not defined: \'`xlen_def\'\n    input wire[`xlen_def] i_bypass_rd_wdata,\n               ^~~~~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/bpu.v:43: syntax error, unexpected output, expecting IDENTIFIER or do or final\n    output wire[`xlen_def] o_bpu_jaddr, \n    ^~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/bpu.v:43: Define or directive not defined: \'`xlen_def\'\n    output wire[`xlen_def] o_bpu_jaddr, \n                ^~~~~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/bpu.v:47: syntax error, unexpected output, expecting IDENTIFIER or do or final\n    output wire[`xlen_def] o_exu_op1,\n    ^~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/bpu.v:47: Define or directive not defined: \'`xlen_def\'\n    output wire[`xlen_def] o_exu_op1,\n                ^~~~~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/bpu.v:48: Define or directive not defined: \'`xlen_def\'\n    output wire[`xlen_def] o_exu_op2,\n                ^~~~~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/bpu.v:49: Define or directive not defined: \'`xlen_def\'\n    output wire[`xlen_def] o_rs2rdata,\n                ^~~~~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/bpu.v:50: Define or directive not defined: \'`xlen_def\'\n    output wire[`xlen_def] o_imm,\n                ^~~~~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/bpu.v:52: syntax error, unexpected output, expecting IDENTIFIER or do or final\n    output wire[`rfidxlen_def] o_rdidx,\n    ^~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/bpu.v:52: Define or directive not defined: \'`rfidxlen_def\'\n    output wire[`rfidxlen_def] o_rdidx,\n                ^~~~~~~~~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/bpu.v:55: 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/bpu.v:55: Define or directive not defined: \'`csridxlen_def\'\n    output wire[`csridxlen_def] o_csridx,\n                ^~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/bpu.v:56: Define or directive not defined: \'`xlen_def\'\n    output wire[`xlen_def] o_csr_zimm,\n                ^~~~~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/bpu.v:58: Define or directive not defined: \'`decinfo_grplen_def\'\n    output wire[`decinfo_grplen_def] o_decinfo_grp,\n                ^~~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/bpu.v:59: Define or directive not defined: \'`decinfolen_def\'\n    output wire[`decinfolen_def] o_decinfo,\n                ^~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/bpu.v:60: Define or directive not defined: \'`xlen_def\'\n    output wire[`xlen_def] o_iaddr\n                ^~~~~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/bpu.v:65: Define or directive not defined: \'`xlen_def\'\nwire[`xlen_def] inst_pc;\n     ^~~~~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/bpu.v:65: syntax error, unexpected \']\', expecting TYPE-IDENTIFIER\nwire[`xlen_def] inst_pc;\n              ^\n%Error: data/full_repos/permissive/463481430/RTL/core/bpu.v:66: Define or directive not defined: \'`ilen_def\'\n                                                              : ... Suggested alternative: \'`ifndef\'\nwire[`ilen_def] inst;\n     ^~~~~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/bpu.v:66: syntax error, unexpected \']\', expecting TYPE-IDENTIFIER\nwire[`ilen_def] inst;\n              ^\n%Error: data/full_repos/permissive/463481430/RTL/core/bpu.v:108: Define or directive not defined: \'`rfidxlen_def\'\nwire[`rfidxlen_def] inst_rs1idx;\n     ^~~~~~~~~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/bpu.v:108: syntax error, unexpected \']\', expecting TYPE-IDENTIFIER\nwire[`rfidxlen_def] inst_rs1idx;\n                  ^\n%Error: data/full_repos/permissive/463481430/RTL/core/bpu.v:109: Define or directive not defined: \'`xlen_def\'\nwire[`xlen_def] bp_imm;\n     ^~~~~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/bpu.v:109: syntax error, unexpected \']\', expecting TYPE-IDENTIFIER\nwire[`xlen_def] bp_imm;\n              ^\n%Error: data/full_repos/permissive/463481430/RTL/core/bpu.v:112: Define or directive not defined: \'`rfidxlen_def\'\nwire[`rfidxlen_def] rs1idx;\n     ^~~~~~~~~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/bpu.v:112: syntax error, unexpected \']\', expecting TYPE-IDENTIFIER\nwire[`rfidxlen_def] rs1idx;\n                  ^\n%Error: data/full_repos/permissive/463481430/RTL/core/bpu.v:113: Define or directive not defined: \'`xlen_def\'\nwire[`xlen_def] rs1_rdata;\n     ^~~~~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/bpu.v:113: syntax error, unexpected \']\', expecting TYPE-IDENTIFIER\nwire[`xlen_def] rs1_rdata;\n              ^\n%Error: data/full_repos/permissive/463481430/RTL/core/bpu.v:115: Define or directive not defined: \'`rfidxlen_def\'\nwire[`rfidxlen_def] rs2idx;\n     ^~~~~~~~~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/bpu.v:115: syntax error, unexpected \']\', expecting TYPE-IDENTIFIER\nwire[`rfidxlen_def] rs2idx;\n                  ^\n%Error: data/full_repos/permissive/463481430/RTL/core/bpu.v:116: Define or directive not defined: \'`xlen_def\'\nwire[`xlen_def] rs2_rdata;\n     ^~~~~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/bpu.v:116: syntax error, unexpected \']\', expecting TYPE-IDENTIFIER\nwire[`xlen_def] rs2_rdata;\n              ^\n%Error: data/full_repos/permissive/463481430/RTL/core/bpu.v:117: Define or directive not defined: \'`xlen_def\'\nwire[`xlen_def] imm;\n     ^~~~~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/bpu.v:117: syntax error, unexpected \']\', expecting TYPE-IDENTIFIER\nwire[`xlen_def] imm;\n              ^\n%Error: data/full_repos/permissive/463481430/RTL/core/bpu.v:121: syntax error, unexpected IDENTIFIER\nDECODE u_DECODE(\n^~~~~~\n%Error: data/full_repos/permissive/463481430/RTL/core/bpu.v:169: Define or directive not defined: \'`xlen_def\'\nwire[`xlen_def] bp_rs1rdata; \n     ^~~~~~~~~\n%Error: Exiting due to too many errors encountered; --error-limit=50\n'
module BPU (
    input wire i_clk,
    input wire i_rstn,

    input wire i_stop,
    input wire i_flush,


    input wire i_data_vld,
    input wire[`xlen_def] i_iaddr,
    input wire[`ilen_def] i_data,


    output wire o_bpu_rs1ren,
    output wire[`rfidxlen_def] o_bpu_rs1idx,
    output wire o_bpu_rs2ren,
    output wire[`rfidxlen_def] o_bpu_rs2idx,


    input wire i_rdwen,
    input wire[`rfidxlen_def] i_rdidx,
    input wire[`xlen_def] i_rd_wdata,

    input wire i_bypass_rdwen,
    input wire[`rfidxlen_def] i_bypass_rdidx,
    input wire[`xlen_def] i_bypass_rd_wdata,


    output wire o_bpu_taken,
    output wire[`xlen_def] o_bpu_jaddr,


    output wire o_inst_vld,
    output wire[`xlen_def] o_exu_op1,
    output wire[`xlen_def] o_exu_op2,
    output wire[`xlen_def] o_rs2rdata,
    output wire[`xlen_def] o_imm,
    output wire o_rdwen,
    output wire[`rfidxlen_def] o_rdidx,

    output wire o_csr_ren,
    output wire[`csridxlen_def] o_csridx,
    output wire[`xlen_def] o_csr_zimm,

    output wire[`decinfo_grplen_def] o_decinfo_grp,
    output wire[`decinfolen_def] o_decinfo,
    output wire[`xlen_def] o_iaddr
);


wire inst_vld;
wire[`xlen_def] inst_pc;
wire[`ilen_def] inst;

`ifdef USE_AP

BPU_AP u_BPU_AP(
    .i_clk      ( i_clk      ),
    .i_rstn     ( i_rstn     ),


    .i_stop     ( i_stop ),
    .i_flush    ( i_flush   ),

    .i_data_vld ( i_data_vld ),
    .i_iaddr    ( i_iaddr    ),
    .i_data     ( i_data     ),

    .o_inst_vld ( inst_vld ),
    .o_inst_pc  ( inst_pc    ),
    .o_inst     ( inst       )
);

`else

assign inst_vld = i_data_vld;
assign inst_pc  = i_iaddr;
assign inst     = i_data;


`endif 





assign o_inst_vld = inst_vld & (~i_stop);
assign o_iaddr = inst_pc;
assign o_inst = inst;

wire bpu_bflag;
wire inst_jal;
wire inst_jalr;
wire inst_bxx;
wire[`rfidxlen_def] inst_rs1idx;
wire[`xlen_def] bp_imm;

wire rs1ren;
wire[`rfidxlen_def] rs1idx;
wire[`xlen_def] rs1_rdata;
wire rs2ren;
wire[`rfidxlen_def] rs2idx;
wire[`xlen_def] rs2_rdata;
wire[`xlen_def] imm;
wire rs1topc;
wire rs2toimm;

DECODE u_DECODE(
    .i_clk         ( i_clk         ),
    .i_rstn        ( i_rstn        ),

    .i_inst_vld    ( inst_vld    ),
    .i_inst        ( inst        ),
    .i_bpu_bflag   ( bpu_bflag   ),

    .o_inst_jal    ( inst_jal    ),
    .o_inst_jalr   ( inst_jalr   ),
    .o_inst_bxx    ( inst_bxx    ),
    .o_inst_rs1idx ( inst_rs1idx ),
    .o_bp_imm      ( bp_imm     ),

    .o_rdwen       ( o_rdwen       ),
    .o_rdidx       ( o_rdidx       ),

    .o_rs1ren      ( rs1ren      ),
    .o_rs1idx      ( rs1idx      ),

    .o_rs2ren      ( rs2ren      ),
    .o_rs2idx      ( rs2idx      ),

    .o_csr_ren     ( o_csr_ren    ),
    .o_csridx      ( o_csridx      ),

    .o_imm         ( imm           ),
    .o_zimm        ( o_csr_zimm    ),

    .o_decinfo_grp ( o_decinfo_grp ),
    .o_decinfo     ( o_decinfo     ),
    .o_rs1topc     ( rs1topc     ),
    .o_rs2toimm    ( rs2toimm    )
);

assign o_exu_op1 = rs1topc ? inst_pc : rs1_rdata;
assign o_exu_op2 = rs2toimm ?  imm : rs2_rdata;
assign o_rs2rdata = rs2_rdata;
assign o_imm = imm;

assign o_bpu_rs1ren = inst_vld&rs1ren;
assign o_bpu_rs1idx = rs1idx;
assign o_bpu_rs2ren = inst_vld&rs2ren;
assign o_bpu_rs2idx = rs2idx;


wire jalr_rs1ren = inst_jalr & (inst_rs1idx!=0);

wire[`xlen_def] bp_rs1rdata; 

BPU_BP u_BPU_BP(
    .i_clk           ( i_clk           ),
    .i_rstn          ( i_rstn          ),
    
    .i_pc            ( inst_pc         ),

    .i_inst_jal      ( inst_jal      ),
    .i_inst_jalr     ( inst_jalr     ),
    .i_inst_rs1ren   ( jalr_rs1ren   ),
    .i_inst_bxx      ( inst_bxx      ),
    .i_imm           ( bp_imm        ),

    .i_jalr_rs1rdata ( rs1_rdata ),

    .o_prdt_taken    ( o_bpu_taken    ),
    .o_prdt_pc       ( o_bpu_jaddr       )
);

assign bpu_bflag = inst_bxx & o_bpu_taken;

REGFILE u_REGFILE(
    .i_clk       ( i_clk       ),
    .i_rstn      ( i_rstn      ),
    
    .i_rdwen     ( i_rdwen     ),
    .i_rdidx     ( i_rdidx     ),
    .i_rd_wdata  ( i_rd_wdata  ),

    .i_rs1ren    ( rs1ren    ),
    .i_rs1idx    ( rs1idx    ),
    .o_rs1_rdata ( rs1_rdata ),
    .i_rs2ren    ( rs2ren    ),
    .i_rs2idx    ( rs2idx    ),
    .o_rs2_rdata  ( rs2_rdata  ),

    .i_bypass_rdwen ( i_bypass_rdwen ),
    .i_bypass_rdidx ( i_bypass_rdidx ),
    .i_bypass_rd_wdata  ( i_bypass_rd_wdata )
);







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

    input wire i_stop,
    input wire i_flush,


    input wire i_data_vld,
    input wire[`xlen_def] i_iaddr,
    input wire[`ilen_def] i_data,


    output wire o_bpu_rs1ren,
    output wire[`rfidxlen_def] o_bpu_rs1idx,
    output wire o_bpu_rs2ren,
    output wire[`rfidxlen_def] o_bpu_rs2idx,


    input wire i_rdwen,
    input wire[`rfidxlen_def] i_rdidx,
    input wire[`xlen_def] i_rd_wdata,

    input wire i_bypass_rdwen,
    input wire[`rfidxlen_def] i_bypass_rdidx,
    input wire[`xlen_def] i_bypass_rd_wdata,


    output wire o_bpu_taken,
    output wire[`xlen_def] o_bpu_jaddr,


    output wire o_inst_vld,
    output wire[`xlen_def] o_exu_op1,
    output wire[`xlen_def] o_exu_op2,
    output wire[`xlen_def] o_rs2rdata,
    output wire[`xlen_def] o_imm,
    output wire o_rdwen,
    output wire[`rfidxlen_def] o_rdidx,

    output wire o_csr_ren,
    output wire[`csridxlen_def] o_csridx,
    output wire[`xlen_def] o_csr_zimm,

    output wire[`decinfo_grplen_def] o_decinfo_grp,
    output wire[`decinfolen_def] o_decinfo,
    output wire[`xlen_def] o_iaddr
);



wire inst_vld;
wire[`xlen_def] inst_pc;
wire[`ilen_def] inst;

`ifdef USE_AP

BPU_AP u_BPU_AP(
    .i_clk      ( i_clk      ),
    .i_rstn     ( i_rstn     ),


    .i_stop     ( i_stop ),
    .i_flush    ( i_flush   ),

    .i_data_vld ( i_data_vld ),
    .i_iaddr    ( i_iaddr    ),
    .i_data     ( i_data     ),

    .o_inst_vld ( inst_vld ),
    .o_inst_pc  ( inst_pc    ),
    .o_inst     ( inst       )
);

`else

assign inst_vld = i_data_vld;
assign inst_pc  = i_iaddr;
assign inst     = i_data;


`endif 





assign o_inst_vld = inst_vld & (~i_stop);
assign o_iaddr = inst_pc;
assign o_inst = inst;

wire bpu_bflag;
wire inst_jal;
wire inst_jalr;
wire inst_bxx;
wire[`rfidxlen_def] inst_rs1idx;
wire[`xlen_def] bp_imm;

wire rs1ren;
wire[`rfidxlen_def] rs1idx;
wire[`xlen_def] rs1_rdata;
wire rs2ren;
wire[`rfidxlen_def] rs2idx;
wire[`xlen_def] rs2_rdata;
wire[`xlen_def] imm;
wire rs1topc;
wire rs2toimm;

DECODE u_DECODE(
    .i_clk         ( i_clk         ),
    .i_rstn        ( i_rstn        ),

    .i_inst_vld    ( inst_vld    ),
    .i_inst        ( inst        ),
    .i_bpu_bflag   ( bpu_bflag   ),

    .o_inst_jal    ( inst_jal    ),
    .o_inst_jalr   ( inst_jalr   ),
    .o_inst_bxx    ( inst_bxx    ),
    .o_inst_rs1idx ( inst_rs1idx ),
    .o_bp_imm      ( bp_imm     ),

    .o_rdwen       ( o_rdwen       ),
    .o_rdidx       ( o_rdidx       ),

    .o_rs1ren      ( rs1ren      ),
    .o_rs1idx      ( rs1idx      ),

    .o_rs2ren      ( rs2ren      ),
    .o_rs2idx      ( rs2idx      ),

    .o_csr_ren     ( o_csr_ren    ),
    .o_csridx      ( o_csridx      ),

    .o_imm         ( imm           ),
    .o_zimm        ( o_csr_zimm    ),

    .o_decinfo_grp ( o_decinfo_grp ),
    .o_decinfo     ( o_decinfo     ),
    .o_rs1topc     ( rs1topc     ),
    .o_rs2toimm    ( rs2toimm    )
);

assign o_exu_op1 = rs1topc ? inst_pc : rs1_rdata;
assign o_exu_op2 = rs2toimm ?  imm : rs2_rdata;
assign o_rs2rdata = rs2_rdata;
assign o_imm = imm;

assign o_bpu_rs1ren = inst_vld&rs1ren;
assign o_bpu_rs1idx = rs1idx;
assign o_bpu_rs2ren = inst_vld&rs2ren;
assign o_bpu_rs2idx = rs2idx;


wire jalr_rs1ren = inst_jalr & (inst_rs1idx!=0);

wire[`xlen_def] bp_rs1rdata; 

BPU_BP u_BPU_BP(
    .i_clk           ( i_clk           ),
    .i_rstn          ( i_rstn          ),
    
    .i_pc            ( inst_pc         ),

    .i_inst_jal      ( inst_jal      ),
    .i_inst_jalr     ( inst_jalr     ),
    .i_inst_rs1ren   ( jalr_rs1ren   ),
    .i_inst_bxx      ( inst_bxx      ),
    .i_imm           ( bp_imm        ),

    .i_jalr_rs1rdata ( rs1_rdata ),

    .o_prdt_taken    ( o_bpu_taken    ),
    .o_prdt_pc       ( o_bpu_jaddr       )
);

assign bpu_bflag = inst_bxx & o_bpu_taken;

REGFILE u_REGFILE(
    .i_clk       ( i_clk       ),
    .i_rstn      ( i_rstn      ),
    
    .i_rdwen     ( i_rdwen     ),
    .i_rdidx     ( i_rdidx     ),
    .i_rd_wdata  ( i_rd_wdata  ),

    .i_rs1ren    ( rs1ren    ),
    .i_rs1idx    ( rs1idx    ),
    .o_rs1_rdata ( rs1_rdata ),
    .i_rs2ren    ( rs2ren    ),
    .i_rs2idx    ( rs2idx    ),
    .o_rs2_rdata  ( rs2_rdata  ),

    .i_bypass_rdwen ( i_bypass_rdwen ),
    .i_bypass_rdidx ( i_bypass_rdidx ),
    .i_bypass_rd_wdata  ( i_bypass_rd_wdata )
);







endmodule