data/full_repos/permissive/50609942/priority_vc_perInput.v
1: b'%Error: data/full_repos/permissive/50609942/priority_vc_perInput.v:8: Cannot find include file: util.v\n`include "util.v" \n         ^~~~~~~~\n        ... Looked in:\n             data/full_repos/permissive/50609942,data/full_repos/permissive/50609942/util.v\n             data/full_repos/permissive/50609942,data/full_repos/permissive/50609942/util.v.v\n             data/full_repos/permissive/50609942,data/full_repos/permissive/50609942/util.v.sv\n             util.v\n             util.v.v\n             util.v.sv\n             obj_dir/util.v\n             obj_dir/util.v.v\n             obj_dir/util.v.sv\n%Error: data/full_repos/permissive/50609942/priority_vc_perInput.v:9: Cannot find include file: constants.v\n`include "constants.v" \n         ^~~~~~~~~~~~~\n%Error: data/full_repos/permissive/50609942/priority_vc_perInput.v:10: Cannot find include file: mux1024to1.v\n`include "mux1024to1.v" \n         ^~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/50609942/priority_vc_perInput.v:13: Define or directive not defined: \'`IN_OUTPORT_CNT\'\n        output [0:`IN_OUTPORT_CNT-1] selected_inputs_out,\n                  ^~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/50609942/priority_vc_perInput.v:14: Define or directive not defined: \'`IN_OUTPORT_CNT\'\n        output [0:`IN_OUTPORT_CNT-1] selected_outputs_out,\n                  ^~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/50609942/priority_vc_perInput.v:15: Define or directive not defined: \'`FLIT_SIZE\'\n        output [1:`FLIT_SIZE * `IN_OUTPORT_CNT] outputs_out,\n                  ^~~~~~~~~~\n%Error: data/full_repos/permissive/50609942/priority_vc_perInput.v:15: syntax error, unexpected \'*\', expecting TYPE-IDENTIFIER\n        output [1:`FLIT_SIZE * `IN_OUTPORT_CNT] outputs_out,\n                             ^\n%Error: data/full_repos/permissive/50609942/priority_vc_perInput.v:15: Define or directive not defined: \'`IN_OUTPORT_CNT\'\n        output [1:`FLIT_SIZE * `IN_OUTPORT_CNT] outputs_out,\n                               ^~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/50609942/priority_vc_perInput.v:17: Define or directive not defined: \'`OCCUPIEDS_SIZE\'\n        output [0:`OCCUPIEDS_SIZE*`IN_OUTPORT_CNT-1] occupieds_out,\n                  ^~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/50609942/priority_vc_perInput.v:17: Define or directive not defined: \'`IN_OUTPORT_CNT\'\n        output [0:`OCCUPIEDS_SIZE*`IN_OUTPORT_CNT-1] occupieds_out,\n                                  ^~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/50609942/priority_vc_perInput.v:19: Define or directive not defined: \'`LOG_PORTS_CNT\'\n        input [0:`LOG_PORTS_CNT-1] port_num,\n                 ^~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/50609942/priority_vc_perInput.v:20: Define or directive not defined: \'`IN_OUTPORT_CNT\'\n        input [0:`IN_OUTPORT_CNT-1] selected_inputs_in,\n                 ^~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/50609942/priority_vc_perInput.v:21: Define or directive not defined: \'`IN_OUTPORT_CNT\'\n        input [0:`IN_OUTPORT_CNT-1] selected_outputs_in,\n                 ^~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/50609942/priority_vc_perInput.v:22: Define or directive not defined: \'`IN_OUTPORT_CNT\'\n        input [0:`IN_OUTPORT_CNT-1] nxt_routers_credit,\n                 ^~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/50609942/priority_vc_perInput.v:23: Define or directive not defined: \'`FLIT_SIZE\'\n        input [1:`FLIT_SIZE] flit_in,\n                 ^~~~~~~~~~\n%Error: data/full_repos/permissive/50609942/priority_vc_perInput.v:24: Define or directive not defined: \'`FLIT_SIZE\'\n        input [1:`FLIT_SIZE * `IN_OUTPORT_CNT] outputs_in,\n                 ^~~~~~~~~~\n%Error: data/full_repos/permissive/50609942/priority_vc_perInput.v:24: Define or directive not defined: \'`IN_OUTPORT_CNT\'\n        input [1:`FLIT_SIZE * `IN_OUTPORT_CNT] outputs_in,\n                              ^~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/50609942/priority_vc_perInput.v:25: Define or directive not defined: \'`OCCUPIEDS_SIZE\'\n        input [0:`OCCUPIEDS_SIZE*`IN_OUTPORT_CNT-1] occupieds_in,\n                 ^~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/50609942/priority_vc_perInput.v:25: Define or directive not defined: \'`IN_OUTPORT_CNT\'\n        input [0:`OCCUPIEDS_SIZE*`IN_OUTPORT_CNT-1] occupieds_in,\n                                 ^~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/50609942/priority_vc_perInput.v:26: Define or directive not defined: \'`TABLE_SIZE\'\n        input [0:`TABLE_SIZE-1]TABLE\n                 ^~~~~~~~~~~\n%Error: data/full_repos/permissive/50609942/priority_vc_perInput.v:31: syntax error, unexpected genvar\ngenvar util_genvar;\n^~~~~~\n%Error: data/full_repos/permissive/50609942/priority_vc_perInput.v:32: Define or directive not defined: \'`MAKE_ARRAY\'\n`MAKE_ARRAY(occupieds_in_array, occupieds_in, `IN_OUTPORT_CNT, `OCCUPIEDS_SIZE, GEN_OCCUPIEDS_IN)\n^~~~~~~~~~~\n%Error: data/full_repos/permissive/50609942/priority_vc_perInput.v:32: Define or directive not defined: \'`IN_OUTPORT_CNT\'\n`MAKE_ARRAY(occupieds_in_array, occupieds_in, `IN_OUTPORT_CNT, `OCCUPIEDS_SIZE, GEN_OCCUPIEDS_IN)\n                                              ^~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/50609942/priority_vc_perInput.v:32: Define or directive not defined: \'`OCCUPIEDS_SIZE\'\n`MAKE_ARRAY(occupieds_in_array, occupieds_in, `IN_OUTPORT_CNT, `OCCUPIEDS_SIZE, GEN_OCCUPIEDS_IN)\n                                                               ^~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/50609942/priority_vc_perInput.v:33: Define or directive not defined: \'`MAKE_ARRAY\'\n`MAKE_ARRAY(occupieds_out_array, occupieds_out, `IN_OUTPORT_CNT, `OCCUPIEDS_SIZE, GEN_OCCUPIEDS_OUT)\n^~~~~~~~~~~\n%Error: data/full_repos/permissive/50609942/priority_vc_perInput.v:33: Define or directive not defined: \'`IN_OUTPORT_CNT\'\n`MAKE_ARRAY(occupieds_out_array, occupieds_out, `IN_OUTPORT_CNT, `OCCUPIEDS_SIZE, GEN_OCCUPIEDS_OUT)\n                                                ^~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/50609942/priority_vc_perInput.v:33: Define or directive not defined: \'`OCCUPIEDS_SIZE\'\n`MAKE_ARRAY(occupieds_out_array, occupieds_out, `IN_OUTPORT_CNT, `OCCUPIEDS_SIZE, GEN_OCCUPIEDS_OUT)\n                                                                 ^~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/50609942/priority_vc_perInput.v:35: Define or directive not defined: \'`LOG_PORTS_CNT\'\nwire [0:`LOG_PORTS_CNT-1] dst_port_num;\n        ^~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/50609942/priority_vc_perInput.v:36: syntax error, unexpected IDENTIFIER\nmux1024to1 m(.OUT(dst_port_num),\n^~~~~~~~~~\n%Error: data/full_repos/permissive/50609942/priority_vc_perInput.v:37: Define or directive not defined: \'`FLIT_DST\'\n             .select(flit_in `FLIT_DST),\n                             ^~~~~~~~~\n%Error: data/full_repos/permissive/50609942/priority_vc_perInput.v:43: Define or directive not defined: \'`IN_OUTPORT_CNT\'\n    for(i=0;i<`IN_OUTPORT_CNT;i=i+1)\n              ^~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/50609942/priority_vc_perInput.v:47: Define or directive not defined: \'`OCCUPIED_IS_FULL\'\n                                                (occupieds_in_array[dst_port_num] `OCCUPIED_IS_FULL==1\'b0 || \n                                                                                  ^~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/50609942/priority_vc_perInput.v:48: Define or directive not defined: \'`OCCUPIED_IS_FULL\'\n                                                (occupieds_in_array[dst_port_num] `OCCUPIED_IS_FULL==1\'b1 && occupieds_in_array[dst_port_num] `OCCUPIED_PORT_NO == i)) ) ? 1\'b1\n                                                                                  ^~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/50609942/priority_vc_perInput.v:48: Define or directive not defined: \'`OCCUPIED_PORT_NO\'\n                                                (occupieds_in_array[dst_port_num] `OCCUPIED_IS_FULL==1\'b1 && occupieds_in_array[dst_port_num] `OCCUPIED_PORT_NO == i)) ) ? 1\'b1\n                                                                                                                                              ^~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/50609942/priority_vc_perInput.v:51: Define or directive not defined: \'`FLIT_SIZE\'\n        assign outputs_out[i*`FLIT_SIZE+1 : (i+1)*`FLIT_SIZE] = (i == port_num && is_new_flit ? ((selected_inputs_in[i]==1\'b0 && selected_outputs_in[dst_port_num]==1\'b0 &&\n                             ^~~~~~~~~~\n%Error: data/full_repos/permissive/50609942/priority_vc_perInput.v:51: Define or directive not defined: \'`FLIT_SIZE\'\n        assign outputs_out[i*`FLIT_SIZE+1 : (i+1)*`FLIT_SIZE] = (i == port_num && is_new_flit ? ((selected_inputs_in[i]==1\'b0 && selected_outputs_in[dst_port_num]==1\'b0 &&\n                                                  ^~~~~~~~~~\n%Error: data/full_repos/permissive/50609942/priority_vc_perInput.v:53: Define or directive not defined: \'`OCCUPIED_IS_FULL\'\n                                                (occupieds_in_array[dst_port_num] `OCCUPIED_IS_FULL==1\'b0 || \n                                                                                  ^~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/50609942/priority_vc_perInput.v:54: Define or directive not defined: \'`OCCUPIED_IS_FULL\'\n                                                (occupieds_in_array[dst_port_num] `OCCUPIED_IS_FULL && occupieds_in_array[dst_port_num] `OCCUPIED_PORT_NO == i)) ) ? flit_in\n                                                                                  ^~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/50609942/priority_vc_perInput.v:54: Define or directive not defined: \'`OCCUPIED_PORT_NO\'\n                                                (occupieds_in_array[dst_port_num] `OCCUPIED_IS_FULL && occupieds_in_array[dst_port_num] `OCCUPIED_PORT_NO == i)) ) ? flit_in\n                                                                                                                                        ^~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/50609942/priority_vc_perInput.v:55: Define or directive not defined: \'`FLIT_SIZE\'\n                                         : outputs_in[i*`FLIT_SIZE+1 : (i+1)*`FLIT_SIZE])\n                                                        ^~~~~~~~~~\n%Error: data/full_repos/permissive/50609942/priority_vc_perInput.v:55: Define or directive not defined: \'`FLIT_SIZE\'\n                                         : outputs_in[i*`FLIT_SIZE+1 : (i+1)*`FLIT_SIZE])\n                                                                             ^~~~~~~~~~\n%Error: data/full_repos/permissive/50609942/priority_vc_perInput.v:56: Define or directive not defined: \'`FLIT_SIZE\'\n                                         : outputs_in[i*`FLIT_SIZE+1 : (i+1)*`FLIT_SIZE]);\n                                                        ^~~~~~~~~~\n%Error: data/full_repos/permissive/50609942/priority_vc_perInput.v:56: Define or directive not defined: \'`FLIT_SIZE\'\n                                         : outputs_in[i*`FLIT_SIZE+1 : (i+1)*`FLIT_SIZE]);\n                                                                             ^~~~~~~~~~\n%Error: data/full_repos/permissive/50609942/priority_vc_perInput.v:59: Define or directive not defined: \'`OCCUPIED_IS_FULL\'\n                                            (occupieds_in_array[dst_port_num] `OCCUPIED_IS_FULL==1\'b0 ||\n                                                                              ^~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/50609942/priority_vc_perInput.v:60: Define or directive not defined: \'`OCCUPIED_IS_FULL\'\n                                            (occupieds_in_array[dst_port_num] `OCCUPIED_IS_FULL==1\'b1 && occupieds_in_array[dst_port_num] `OCCUPIED_PORT_NO == port_num)) ) ? 1\'b1\n                                                                              ^~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/50609942/priority_vc_perInput.v:60: Define or directive not defined: \'`OCCUPIED_PORT_NO\'\n                                            (occupieds_in_array[dst_port_num] `OCCUPIED_IS_FULL==1\'b1 && occupieds_in_array[dst_port_num] `OCCUPIED_PORT_NO == port_num)) ) ? 1\'b1\n                                                                                                                                          ^~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/50609942/priority_vc_perInput.v:65: Define or directive not defined: \'`OCCUPIED_IS_FULL\'\n                                            (occupieds_in_array[dst_port_num] `OCCUPIED_IS_FULL==1\'b0 ||\n                                                                              ^~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/50609942/priority_vc_perInput.v:66: Define or directive not defined: \'`OCCUPIED_IS_FULL\'\n                                            (occupieds_in_array[dst_port_num] `OCCUPIED_IS_FULL==1\'b1 && occupieds_in_array[dst_port_num] `OCCUPIED_PORT_NO == port_num)) ) ? (flit_in `FLIT_TAIL ? {`OCCUPIEDS_SIZE{1\'b0}} : {1\'b1,port_num[0:`LOG_PORTS_CNT-1]})\n                                                                              ^~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/50609942/priority_vc_perInput.v:66: Define or directive not defined: \'`OCCUPIED_PORT_NO\'\n                                            (occupieds_in_array[dst_port_num] `OCCUPIED_IS_FULL==1\'b1 && occupieds_in_array[dst_port_num] `OCCUPIED_PORT_NO == port_num)) ) ? (flit_in `FLIT_TAIL ? {`OCCUPIEDS_SIZE{1\'b0}} : {1\'b1,port_num[0:`LOG_PORTS_CNT-1]})\n                                                                                                                                          ^~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/50609942/priority_vc_perInput.v:66: Define or directive not defined: \'`FLIT_TAIL\'\n                                            (occupieds_in_array[dst_port_num] `OCCUPIED_IS_FULL==1\'b1 && occupieds_in_array[dst_port_num] `OCCUPIED_PORT_NO == port_num)) ) ? (flit_in `FLIT_TAIL ? {`OCCUPIEDS_SIZE{1\'b0}} : {1\'b1,port_num[0:`LOG_PORTS_CNT-1]})\n                                                                                                                                                                                       ^~~~~~~~~~\n%Error: Exiting due to too many errors encountered; --error-limit=50\n'
module  priority_vc_perInput(
        output [0:`IN_OUTPORT_CNT-1] selected_inputs_out,
        output [0:`IN_OUTPORT_CNT-1] selected_outputs_out,
        output [1:`FLIT_SIZE * `IN_OUTPORT_CNT] outputs_out,
        output credit_for_input,
        output [0:`OCCUPIEDS_SIZE*`IN_OUTPORT_CNT-1] occupieds_out,
        input is_new_flit,
        input [0:`LOG_PORTS_CNT-1] port_num,
        input [0:`IN_OUTPORT_CNT-1] selected_inputs_in,
        input [0:`IN_OUTPORT_CNT-1] selected_outputs_in,
        input [0:`IN_OUTPORT_CNT-1] nxt_routers_credit,
        input [1:`FLIT_SIZE] flit_in,
        input [1:`FLIT_SIZE * `IN_OUTPORT_CNT] outputs_in,
        input [0:`OCCUPIEDS_SIZE*`IN_OUTPORT_CNT-1] occupieds_in,
        input [0:`TABLE_SIZE-1]TABLE
);

parameter VC_NUM = 4;

genvar util_genvar;
`MAKE_ARRAY(occupieds_in_array, occupieds_in, `IN_OUTPORT_CNT, `OCCUPIEDS_SIZE, GEN_OCCUPIEDS_IN)
`MAKE_ARRAY(occupieds_out_array, occupieds_out, `IN_OUTPORT_CNT, `OCCUPIEDS_SIZE, GEN_OCCUPIEDS_OUT)

wire [0:`LOG_PORTS_CNT-1] dst_port_num;
mux1024to1 m(.OUT(dst_port_num),
             .select(flit_in `FLIT_DST),
             .TABLE(TABLE)
);

genvar i;
generate
    for(i=0;i<`IN_OUTPORT_CNT;i=i+1)
    begin : GEN_PRIORITY_VC_PERINPUT
        assign selected_inputs_out[i] = (i == port_num && is_new_flit ? ((selected_inputs_in[i]==1'b0 && selected_outputs_in[dst_port_num]==1'b0 &&
                                                nxt_routers_credit[dst_port_num]==1'b1 &&
                                                (occupieds_in_array[dst_port_num] `OCCUPIED_IS_FULL==1'b0 || 
                                                (occupieds_in_array[dst_port_num] `OCCUPIED_IS_FULL==1'b1 && occupieds_in_array[dst_port_num] `OCCUPIED_PORT_NO == i)) ) ? 1'b1
                                         : selected_inputs_in[i])
                                         : selected_inputs_in[i]);
        assign outputs_out[i*`FLIT_SIZE+1 : (i+1)*`FLIT_SIZE] = (i == port_num && is_new_flit ? ((selected_inputs_in[i]==1'b0 && selected_outputs_in[dst_port_num]==1'b0 &&
                                                nxt_routers_credit[dst_port_num]==1'b1 &&
                                                (occupieds_in_array[dst_port_num] `OCCUPIED_IS_FULL==1'b0 || 
                                                (occupieds_in_array[dst_port_num] `OCCUPIED_IS_FULL && occupieds_in_array[dst_port_num] `OCCUPIED_PORT_NO == i)) ) ? flit_in
                                         : outputs_in[i*`FLIT_SIZE+1 : (i+1)*`FLIT_SIZE])
                                         : outputs_in[i*`FLIT_SIZE+1 : (i+1)*`FLIT_SIZE]);
        assign selected_outputs_out[i] = (i == dst_port_num && is_new_flit ? ((selected_inputs_in[port_num]==1'b0 && selected_outputs_in[dst_port_num]==1'b0 &&
                                            nxt_routers_credit[dst_port_num]==1'b1 && 
                                            (occupieds_in_array[dst_port_num] `OCCUPIED_IS_FULL==1'b0 ||
                                            (occupieds_in_array[dst_port_num] `OCCUPIED_IS_FULL==1'b1 && occupieds_in_array[dst_port_num] `OCCUPIED_PORT_NO == port_num)) ) ? 1'b1
                                            :selected_outputs_in[i])
                                            :selected_outputs_in[i]);
        assign occupieds_out_array[i] = (i == dst_port_num && is_new_flit ? ((selected_inputs_in[port_num]==1'b0 && selected_outputs_in[dst_port_num]==1'b0 &&
                                            nxt_routers_credit[dst_port_num]==1'b1 && 
                                            (occupieds_in_array[dst_port_num] `OCCUPIED_IS_FULL==1'b0 ||
                                            (occupieds_in_array[dst_port_num] `OCCUPIED_IS_FULL==1'b1 && occupieds_in_array[dst_port_num] `OCCUPIED_PORT_NO == port_num)) ) ? (flit_in `FLIT_TAIL ? {`OCCUPIEDS_SIZE{1'b0}} : {1'b1,port_num[0:`LOG_PORTS_CNT-1]})
                                            :occupieds_in_array[i])
                                            :occupieds_in_array[i]);
                                            
    end
    assign credit_for_input = ((selected_inputs_in[port_num]==1'b0 && selected_outputs_in[dst_port_num]==1'b0 &&
                               nxt_routers_credit[dst_port_num]==1'b1 &&
                               (occupieds_in_array[dst_port_num] `OCCUPIED_IS_FULL==1'b0 || 
                               (occupieds_in_array[dst_port_num] `OCCUPIED_IS_FULL && occupieds_in_array[dst_port_num] `OCCUPIED_PORT_NO == port_num)) ) ? 1'b1 : 1'b0);
endgenerate

endmodule
module  priority_vc_perInput(
        output [0:`IN_OUTPORT_CNT-1] selected_inputs_out,
        output [0:`IN_OUTPORT_CNT-1] selected_outputs_out,
        output [1:`FLIT_SIZE * `IN_OUTPORT_CNT] outputs_out,
        output credit_for_input,
        output [0:`OCCUPIEDS_SIZE*`IN_OUTPORT_CNT-1] occupieds_out,
        input is_new_flit,
        input [0:`LOG_PORTS_CNT-1] port_num,
        input [0:`IN_OUTPORT_CNT-1] selected_inputs_in,
        input [0:`IN_OUTPORT_CNT-1] selected_outputs_in,
        input [0:`IN_OUTPORT_CNT-1] nxt_routers_credit,
        input [1:`FLIT_SIZE] flit_in,
        input [1:`FLIT_SIZE * `IN_OUTPORT_CNT] outputs_in,
        input [0:`OCCUPIEDS_SIZE*`IN_OUTPORT_CNT-1] occupieds_in,
        input [0:`TABLE_SIZE-1]TABLE
);


parameter VC_NUM = 4;

genvar util_genvar;
`MAKE_ARRAY(occupieds_in_array, occupieds_in, `IN_OUTPORT_CNT, `OCCUPIEDS_SIZE, GEN_OCCUPIEDS_IN)
`MAKE_ARRAY(occupieds_out_array, occupieds_out, `IN_OUTPORT_CNT, `OCCUPIEDS_SIZE, GEN_OCCUPIEDS_OUT)

wire [0:`LOG_PORTS_CNT-1] dst_port_num;
mux1024to1 m(.OUT(dst_port_num),
             .select(flit_in `FLIT_DST),
             .TABLE(TABLE)
);

genvar i;
generate
    for(i=0;i<`IN_OUTPORT_CNT;i=i+1)
    begin : GEN_PRIORITY_VC_PERINPUT
        assign selected_inputs_out[i] = (i == port_num && is_new_flit ? ((selected_inputs_in[i]==1'b0 && selected_outputs_in[dst_port_num]==1'b0 &&
                                                nxt_routers_credit[dst_port_num]==1'b1 &&
                                                (occupieds_in_array[dst_port_num] `OCCUPIED_IS_FULL==1'b0 || 
                                                (occupieds_in_array[dst_port_num] `OCCUPIED_IS_FULL==1'b1 && occupieds_in_array[dst_port_num] `OCCUPIED_PORT_NO == i)) ) ? 1'b1
                                         : selected_inputs_in[i])
                                         : selected_inputs_in[i]);
        assign outputs_out[i*`FLIT_SIZE+1 : (i+1)*`FLIT_SIZE] = (i == port_num && is_new_flit ? ((selected_inputs_in[i]==1'b0 && selected_outputs_in[dst_port_num]==1'b0 &&
                                                nxt_routers_credit[dst_port_num]==1'b1 &&
                                                (occupieds_in_array[dst_port_num] `OCCUPIED_IS_FULL==1'b0 || 
                                                (occupieds_in_array[dst_port_num] `OCCUPIED_IS_FULL && occupieds_in_array[dst_port_num] `OCCUPIED_PORT_NO == i)) ) ? flit_in
                                         : outputs_in[i*`FLIT_SIZE+1 : (i+1)*`FLIT_SIZE])
                                         : outputs_in[i*`FLIT_SIZE+1 : (i+1)*`FLIT_SIZE]);
        assign selected_outputs_out[i] = (i == dst_port_num && is_new_flit ? ((selected_inputs_in[port_num]==1'b0 && selected_outputs_in[dst_port_num]==1'b0 &&
                                            nxt_routers_credit[dst_port_num]==1'b1 && 
                                            (occupieds_in_array[dst_port_num] `OCCUPIED_IS_FULL==1'b0 ||
                                            (occupieds_in_array[dst_port_num] `OCCUPIED_IS_FULL==1'b1 && occupieds_in_array[dst_port_num] `OCCUPIED_PORT_NO == port_num)) ) ? 1'b1
                                            :selected_outputs_in[i])
                                            :selected_outputs_in[i]);
        assign occupieds_out_array[i] = (i == dst_port_num && is_new_flit ? ((selected_inputs_in[port_num]==1'b0 && selected_outputs_in[dst_port_num]==1'b0 &&
                                            nxt_routers_credit[dst_port_num]==1'b1 && 
                                            (occupieds_in_array[dst_port_num] `OCCUPIED_IS_FULL==1'b0 ||
                                            (occupieds_in_array[dst_port_num] `OCCUPIED_IS_FULL==1'b1 && occupieds_in_array[dst_port_num] `OCCUPIED_PORT_NO == port_num)) ) ? (flit_in `FLIT_TAIL ? {`OCCUPIEDS_SIZE{1'b0}} : {1'b1,port_num[0:`LOG_PORTS_CNT-1]})
                                            :occupieds_in_array[i])
                                            :occupieds_in_array[i]);
                                            
    end
    assign credit_for_input = ((selected_inputs_in[port_num]==1'b0 && selected_outputs_in[dst_port_num]==1'b0 &&
                               nxt_routers_credit[dst_port_num]==1'b1 &&
                               (occupieds_in_array[dst_port_num] `OCCUPIED_IS_FULL==1'b0 || 
                               (occupieds_in_array[dst_port_num] `OCCUPIED_IS_FULL && occupieds_in_array[dst_port_num] `OCCUPIED_PORT_NO == port_num)) ) ? 1'b1 : 1'b0);
endgenerate

endmodule