data/full_repos/permissive/511902453/instr_decode.v
1: b'%Error: data/full_repos/permissive/511902453/instr_decode.v:1: Cannot find include file: define.v\n`include "define.v" \n         ^~~~~~~~~~\n        ... Looked in:\n             data/full_repos/permissive/511902453,data/full_repos/permissive/511902453/define.v\n             data/full_repos/permissive/511902453,data/full_repos/permissive/511902453/define.v.v\n             data/full_repos/permissive/511902453,data/full_repos/permissive/511902453/define.v.sv\n             define.v\n             define.v.v\n             define.v.sv\n             obj_dir/define.v\n             obj_dir/define.v.v\n             obj_dir/define.v.sv\n%Error: data/full_repos/permissive/511902453/instr_decode.v:30: Define or directive not defined: \'`jalr\'\n    assign i_type=(instr[6:0]==`jalr)|(instr[6:0]==`load)|(instr[6:0]==`i_type);\n                               ^~~~~\n%Error: data/full_repos/permissive/511902453/instr_decode.v:30: syntax error, unexpected \')\', expecting TYPE-IDENTIFIER\n    assign i_type=(instr[6:0]==`jalr)|(instr[6:0]==`load)|(instr[6:0]==`i_type);\n                                    ^\n%Error: data/full_repos/permissive/511902453/instr_decode.v:30: Define or directive not defined: \'`load\'\n    assign i_type=(instr[6:0]==`jalr)|(instr[6:0]==`load)|(instr[6:0]==`i_type);\n                                                   ^~~~~\n%Error: data/full_repos/permissive/511902453/instr_decode.v:30: Define or directive not defined: \'`i_type\'\n    assign i_type=(instr[6:0]==`jalr)|(instr[6:0]==`load)|(instr[6:0]==`i_type);\n                                                                       ^~~~~~~\n%Error: data/full_repos/permissive/511902453/instr_decode.v:31: Define or directive not defined: \'`lui\'\n    assign u_type=(instr[6:0]==`lui)|(instr[6:0]==`auipc);\n                               ^~~~\n%Error: data/full_repos/permissive/511902453/instr_decode.v:31: syntax error, unexpected \')\', expecting TYPE-IDENTIFIER\n    assign u_type=(instr[6:0]==`lui)|(instr[6:0]==`auipc);\n                                   ^\n%Error: data/full_repos/permissive/511902453/instr_decode.v:31: Define or directive not defined: \'`auipc\'\n    assign u_type=(instr[6:0]==`lui)|(instr[6:0]==`auipc);\n                                                  ^~~~~~\n%Error: data/full_repos/permissive/511902453/instr_decode.v:32: Define or directive not defined: \'`jal\'\n    assign j_type=(instr[6:0]==`jal);\n                               ^~~~\n%Error: data/full_repos/permissive/511902453/instr_decode.v:32: syntax error, unexpected \')\', expecting TYPE-IDENTIFIER\n    assign j_type=(instr[6:0]==`jal);\n                                   ^\n%Error: data/full_repos/permissive/511902453/instr_decode.v:33: Define or directive not defined: \'`b_type\'\n    assign b_type=(instr[6:0]==`b_type);\n                               ^~~~~~~\n%Error: data/full_repos/permissive/511902453/instr_decode.v:33: syntax error, unexpected \')\', expecting TYPE-IDENTIFIER\n    assign b_type=(instr[6:0]==`b_type);\n                                      ^\n%Error: data/full_repos/permissive/511902453/instr_decode.v:34: Define or directive not defined: \'`store\'\n    assign s_type=(instr[6:0]==`store);\n                               ^~~~~~\n%Error: data/full_repos/permissive/511902453/instr_decode.v:34: syntax error, unexpected \')\', expecting TYPE-IDENTIFIER\n    assign s_type=(instr[6:0]==`store);\n                                     ^\n%Error: Exiting due to 14 error(s)\n'
module instr_decode(
    input [31:0] instr,
    output [6:0] opcode,
    output [2:0] func3,
    output func7,
    output [4:0] rs1,
    output [4:0] rs2,
    output [4:0] rd,
    output [31:0] imme);
    
    wire i_type;
    wire u_type;
    wire j_type;
    wire b_type;
    wire s_type;
    
    wire [31:0] i_imme;
    wire [31:0] u_imme;
    wire [31:0] j_imme;
    wire [31:0] b_imme;
    wire [31:0] s_imme;
    
    assign opcode=instr[6:0];
    assign func3=instr[14:12];
    assign rs1=instr[19:15];
    assign rs2=instr[24:20];
    assign rd=instr[11:7];
    
    assign i_type=(instr[6:0]==`jalr)|(instr[6:0]==`load)|(instr[6:0]==`i_type);
    assign u_type=(instr[6:0]==`lui)|(instr[6:0]==`auipc);
    assign j_type=(instr[6:0]==`jal);
    assign b_type=(instr[6:0]==`b_type);
    assign s_type=(instr[6:0]==`store);
    
    assign i_imme={{20{instr[31]}},instr[31:20]};
    assign u_imme={instr[31:12],{12{1'b0}}};
    assign j_imme={{12{instr[31]}},instr[19:12],instr[20],instr[30:21],1'b0};
    assign b_imme={{20{instr[31]}},instr[7],instr[30:25],instr[11:8],1'b0};
    assign s_imme={{20{instr[31]}},instr[31:25],instr[11:7]};
    
    assign imme= i_type?i_imme:
                 u_type?u_imme:
                 j_type?j_imme:
                 b_type?b_imme:
                 s_type?s_imme:32'd0;
endmodule
module instr_decode(
    input [31:0] instr,
    output [6:0] opcode,
    output [2:0] func3,
    output func7,
    output [4:0] rs1,
    output [4:0] rs2,
    output [4:0] rd,
    output [31:0] imme);

    
    wire i_type;
    wire u_type;
    wire j_type;
    wire b_type;
    wire s_type;
    
    wire [31:0] i_imme;
    wire [31:0] u_imme;
    wire [31:0] j_imme;
    wire [31:0] b_imme;
    wire [31:0] s_imme;
    
    assign opcode=instr[6:0];
    assign func3=instr[14:12];
    assign rs1=instr[19:15];
    assign rs2=instr[24:20];
    assign rd=instr[11:7];
    
    assign i_type=(instr[6:0]==`jalr)|(instr[6:0]==`load)|(instr[6:0]==`i_type);
    assign u_type=(instr[6:0]==`lui)|(instr[6:0]==`auipc);
    assign j_type=(instr[6:0]==`jal);
    assign b_type=(instr[6:0]==`b_type);
    assign s_type=(instr[6:0]==`store);
    
    assign i_imme={{20{instr[31]}},instr[31:20]};
    assign u_imme={instr[31:12],{12{1'b0}}};
    assign j_imme={{12{instr[31]}},instr[19:12],instr[20],instr[30:21],1'b0};
    assign b_imme={{20{instr[31]}},instr[7],instr[30:25],instr[11:8],1'b0};
    assign s_imme={{20{instr[31]}},instr[31:25],instr[11:7]};
    
    assign imme= i_type?i_imme:
                 u_type?u_imme:
                 j_type?j_imme:
                 b_type?b_imme:
                 s_type?s_imme:32'd0;
endmodule