data/full_repos/permissive/43858668/final_verilog/verif/router/ugal_source.v
1: b'%Error: data/full_repos/permissive/43858668/final_verilog/verif/router/ugal_source.v:40: Cannot find include file: c_functions.v\n`include "c_functions.v" \n         ^~~~~~~~~~~~~~~\n        ... Looked in:\n             data/full_repos/permissive/43858668/final_verilog/verif/router,data/full_repos/permissive/43858668/c_functions.v\n             data/full_repos/permissive/43858668/final_verilog/verif/router,data/full_repos/permissive/43858668/c_functions.v.v\n             data/full_repos/permissive/43858668/final_verilog/verif/router,data/full_repos/permissive/43858668/c_functions.v.sv\n             c_functions.v\n             c_functions.v.v\n             c_functions.v.sv\n             obj_dir/c_functions.v\n             obj_dir/c_functions.v.v\n             obj_dir/c_functions.v.sv\n%Error: data/full_repos/permissive/43858668/final_verilog/verif/router/ugal_source.v:41: Cannot find include file: c_constants.v\n`include "c_constants.v" \n         ^~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/43858668/final_verilog/verif/router/ugal_source.v:87: Define or directive not defined: \'`CONNECTIVITY_FULL\'\n   parameter connectivity       = `CONNECTIVITY_FULL;\n                                  ^~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/43858668/final_verilog/verif/router/ugal_source.v:87: syntax error, unexpected \';\', expecting TYPE-IDENTIFIER\n   parameter connectivity       = `CONNECTIVITY_FULL;\n                                                    ^\n%Error: data/full_repos/permissive/43858668/final_verilog/verif/router/ugal_source.v:91: Define or directive not defined: \'`CONNECTIVITY_LINE\'\n     = ((connectivity == `CONNECTIVITY_LINE) ||\n                         ^~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/43858668/final_verilog/verif/router/ugal_source.v:91: syntax error, unexpected \')\', expecting TYPE-IDENTIFIER\n     = ((connectivity == `CONNECTIVITY_LINE) ||\n                                           ^\n%Error: data/full_repos/permissive/43858668/final_verilog/verif/router/ugal_source.v:92: Define or directive not defined: \'`CONNECTIVITY_RING\'\n (connectivity == `CONNECTIVITY_RING)) ?\n                  ^~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/43858668/final_verilog/verif/router/ugal_source.v:94: Define or directive not defined: \'`CONNECTIVITY_FULL\'\n       (connectivity == `CONNECTIVITY_FULL) ?\n                        ^~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/43858668/final_verilog/verif/router/ugal_source.v:106: Define or directive not defined: \'`ROUTING_TYPE_PHASED_DOR\'\n   parameter routing_type     = `ROUTING_TYPE_PHASED_DOR;\n                                ^~~~~~~~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/43858668/final_verilog/verif/router/ugal_source.v:106: syntax error, unexpected \';\', expecting TYPE-IDENTIFIER\n   parameter routing_type     = `ROUTING_TYPE_PHASED_DOR;\n                                                        ^\n%Error: data/full_repos/permissive/43858668/final_verilog/verif/router/ugal_source.v:109: Define or directive not defined: \'`DIM_ORDER_ASCENDING\'\n   parameter dim_order      = `DIM_ORDER_ASCENDING;\n                              ^~~~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/43858668/final_verilog/verif/router/ugal_source.v:109: syntax error, unexpected \';\', expecting TYPE-IDENTIFIER\n   parameter dim_order      = `DIM_ORDER_ASCENDING;\n                                                  ^\n%Error: data/full_repos/permissive/43858668/final_verilog/verif/router/ugal_source.v:113: Define or directive not defined: \'`ROUTING_TYPE_PHASED_DOR\'\n     = (routing_type == `ROUTING_TYPE_PHASED_DOR) ? \n                        ^~~~~~~~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/43858668/final_verilog/verif/router/ugal_source.v:113: syntax error, unexpected \')\', expecting TYPE-IDENTIFIER\n     = (routing_type == `ROUTING_TYPE_PHASED_DOR) ? \n                                                ^\n%Error: data/full_repos/permissive/43858668/final_verilog/verif/router/ugal_source.v:117: Define or directive not defined: \'`RESET_TYPE_ASYNC\'\n   parameter reset_type     = `RESET_TYPE_ASYNC;\n                              ^~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/43858668/final_verilog/verif/router/ugal_source.v:117: syntax error, unexpected \';\', expecting TYPE-IDENTIFIER\n   parameter reset_type     = `RESET_TYPE_ASYNC;\n                                               ^\n%Error: Exiting due to 16 error(s)\n'
module ugal_source(

   intm_router_address, route_min,

   clk, reset, flit_valid, flit_head, src_router_address, sel_mc, dest_info,
   credit_count
   );
   
`include "c_functions.v"
`include "c_constants.v"

   parameter ugal_threshold 	     = 3;
   

   parameter buffer_size 	     = 16;
   

   parameter num_message_classes     = 1;
   

   localparam num_resource_classes    = 2;
   

   localparam num_packet_classes     = num_message_classes * num_resource_classes;
   

   parameter num_vcs_per_class 	     = 1;
   

   localparam num_vcs 		     = num_packet_classes * num_vcs_per_class;

   parameter port_id 		     = 6;
   

   parameter num_routers_per_dim     = 4;
   

   localparam dim_addr_width 	     = clogb(num_routers_per_dim);
   

   parameter num_dimensions 	     = 2;
   

   localparam router_addr_width      = num_dimensions * dim_addr_width;
   

   parameter num_nodes_per_router    = 4;
   

   localparam node_addr_width 	     = clogb(num_nodes_per_router);
   

   localparam addr_width 	     = router_addr_width + node_addr_width;
   

   parameter connectivity 	     = `CONNECTIVITY_FULL;
   

   localparam num_neighbors_per_dim
     = ((connectivity == `CONNECTIVITY_LINE) ||
	(connectivity == `CONNECTIVITY_RING)) ?
       2 :
       (connectivity == `CONNECTIVITY_FULL) ?
       (num_routers_per_dim - 1) :
       -1;
   

   localparam num_ports
     = num_dimensions * num_neighbors_per_dim + num_nodes_per_router;
   

   localparam port_idx_width 	   = clogb(num_ports);
   

   parameter routing_type 	   = `ROUTING_TYPE_PHASED_DOR;
   

   parameter dim_order 		   = `DIM_ORDER_ASCENDING;
   

   localparam dest_info_width
     = (routing_type == `ROUTING_TYPE_PHASED_DOR) ? 
       (num_resource_classes * router_addr_width + node_addr_width) : 
       -1;
   
   parameter reset_type 	   = `RESET_TYPE_ASYNC;


   
   input clk;
   input reset;
   input flit_valid;
   input flit_head;
 
	 

   input [0:router_addr_width-1] src_router_address;

   input [0:num_message_classes-1] sel_mc;

   input [0:addr_width-1] dest_info;
   
   localparam credit_count_width  = clogb(buffer_size)+1;

   input [0:(num_ports-num_nodes_per_router)*credit_count_width-1] credit_count;
   

   output [0:router_addr_width-1] intm_router_address;

   output route_min;
   

   localparam [0:num_resource_classes-1] sel_irc
     = (1 << (num_resource_classes - 1 - 1));
   wire [0:num_ports-1] min_route_unmasked;
   wire [0:num_resource_classes-1] route_orc;
    rtr_routing_logic
      #(.num_resource_classes(num_resource_classes),
	.num_routers_per_dim(num_routers_per_dim),
	.num_vcs_per_class(num_vcs_per_class),
	.num_dimensions(num_dimensions),
	.num_nodes_per_router(num_nodes_per_router),
	.connectivity(connectivity),
	.routing_type(routing_type),
	.dim_order(dim_order))
    min_routing
      (.router_address(src_router_address),
       .sel_mc('d1),
       .sel_irc(sel_irc),
       .dest_info({src_router_address,dest_info}),
       .route_op(min_route_unmasked),
       .route_orc(route_orc));


   localparam [0:num_resource_classes-1] sel_irc_nonmin
     = (1 << (num_resource_classes - 1 - 0));

   wire [0:num_ports-1] nonmin_route_unmasked;
   wire [0:num_resource_classes-1] route_orc_nonmin;
   rtr_routing_logic
      #(.num_resource_classes(num_resource_classes),
	.num_routers_per_dim(num_routers_per_dim),
	.num_vcs_per_class(num_vcs_per_class),
	.num_dimensions(num_dimensions),
	.num_nodes_per_router(num_nodes_per_router),
	.connectivity(connectivity),
	.routing_type(routing_type),
	.dim_order(dim_order))
    nonmin_routing
      (.router_address(src_router_address),
       .sel_mc('d1),
       .sel_irc(sel_irc_nonmin),
       .dest_info({intm_router_address,dest_info}),
       .route_op(nonmin_route_unmasked),
       .route_orc(route_orc_nonmin));


   wire [0:credit_count_width-1] min_count;
   wire [0:credit_count_width-1] nonmin_count;


   c_select_1ofn
     #(
       .num_ports			(num_ports-num_nodes_per_router),
       .width				(credit_count_width))
   min_count_select
     (

      .data_out				(min_count[0:credit_count_width-1]),

      .select				(min_route_unmasked[0:num_ports-num_nodes_per_router-1]),
      .data_in				( credit_count[0:(num_ports-num_nodes_per_router)*credit_count_width-1]));
   c_select_1ofn
     #(
       .num_ports			(num_ports-num_nodes_per_router),
       .width				(credit_count_width))
   nonmin_count_select
     (

      .data_out				(nonmin_count[0:credit_count_width-1]),

      .select				(nonmin_route_unmasked[0:num_ports-num_nodes_per_router-1]),
      .data_in				( credit_count[0:(num_ports-num_nodes_per_router)*credit_count_width-1]));


   wire compare ;
   wire compare_q;


   
   wire [0:credit_count_width-1+2] ext_min_count;
   assign  ext_min_count [0:credit_count_width-1+2] = {min_count[0:credit_count_width-1],2'b0};
   wire [0:credit_count_width-1+2] ext_nonmin_count;
   assign  ext_nonmin_count [0:credit_count_width-1+2] = {1'b0,nonmin_count[0:credit_count_width-1],1'b0};
   
   assign compare 	=( (ext_nonmin_count+ugal_threshold) > ext_min_count);


   wire decision 	= (flit_head&flit_valid)?compare:compare_q;

   localparam eligible 	= num_ports-num_nodes_per_router;


   assign route_min 	= |(min_route_unmasked[eligible:num_ports-1])|decision;

   

   c_dff
     #(
       .width				(1),
       .reset_type			(reset_type),
       .reset_value			(1'b1))
   last_compare
     (

      .q				(compare_q),

      .clk				(clk),
      .reset				(reset),
      .active				(active),
      .d				((flit_head&flit_valid)?compare:compare_q));
   



   
   wire [0:router_addr_width-1] rand_value;
   wire [0:router_addr_width-1] rand_feedback;
   
   c_fbgen
     #(.width(router_addr_width),
       .index(1))
   rand_fbgen
     (.feedback(rand_feedback));
   c_lfsr
     #(

       .width			( router_addr_width),
       .iterations	       	( router_addr_width),
       .reset_type		(reset_type))
   rand_gen
     (

      .q			(rand_value[0:router_addr_width-1]),

      .clk			(clk),
      .reset			(reset),
      .load			(reset),
      .run			(flit_head&flit_valid),
      .feedback			(rand_feedback[0:router_addr_width-1]),
      .complete			(1'b0),
      .d			(rand_value[0:router_addr_width-1]));

   wire carry;

   assign {intm_router_address[0:router_addr_width-1],carry} = {src_router_address[0:router_addr_width-1],1'b0}+{rand_value[0:router_addr_width-1],1'b0}; 

   
endmodule
module ugal_source(

   intm_router_address, route_min,

   clk, reset, flit_valid, flit_head, src_router_address, sel_mc, dest_info,
   credit_count
   );

   
`include "c_functions.v"
`include "c_constants.v"

   parameter ugal_threshold 	     = 3;
   

   parameter buffer_size 	     = 16;
   

   parameter num_message_classes     = 1;
   

   localparam num_resource_classes    = 2;
   

   localparam num_packet_classes     = num_message_classes * num_resource_classes;
   

   parameter num_vcs_per_class 	     = 1;
   

   localparam num_vcs 		     = num_packet_classes * num_vcs_per_class;

   parameter port_id 		     = 6;
   

   parameter num_routers_per_dim     = 4;
   

   localparam dim_addr_width 	     = clogb(num_routers_per_dim);
   

   parameter num_dimensions 	     = 2;
   

   localparam router_addr_width      = num_dimensions * dim_addr_width;
   

   parameter num_nodes_per_router    = 4;
   

   localparam node_addr_width 	     = clogb(num_nodes_per_router);
   

   localparam addr_width 	     = router_addr_width + node_addr_width;
   

   parameter connectivity 	     = `CONNECTIVITY_FULL;
   

   localparam num_neighbors_per_dim
     = ((connectivity == `CONNECTIVITY_LINE) ||
	(connectivity == `CONNECTIVITY_RING)) ?
       2 :
       (connectivity == `CONNECTIVITY_FULL) ?
       (num_routers_per_dim - 1) :
       -1;
   

   localparam num_ports
     = num_dimensions * num_neighbors_per_dim + num_nodes_per_router;
   

   localparam port_idx_width 	   = clogb(num_ports);
   

   parameter routing_type 	   = `ROUTING_TYPE_PHASED_DOR;
   

   parameter dim_order 		   = `DIM_ORDER_ASCENDING;
   

   localparam dest_info_width
     = (routing_type == `ROUTING_TYPE_PHASED_DOR) ? 
       (num_resource_classes * router_addr_width + node_addr_width) : 
       -1;
   
   parameter reset_type 	   = `RESET_TYPE_ASYNC;


   
   input clk;
   input reset;
   input flit_valid;
   input flit_head;
 
	 

   input [0:router_addr_width-1] src_router_address;

   input [0:num_message_classes-1] sel_mc;

   input [0:addr_width-1] dest_info;
   
   localparam credit_count_width  = clogb(buffer_size)+1;

   input [0:(num_ports-num_nodes_per_router)*credit_count_width-1] credit_count;
   

   output [0:router_addr_width-1] intm_router_address;

   output route_min;
   

   localparam [0:num_resource_classes-1] sel_irc
     = (1 << (num_resource_classes - 1 - 1));
   wire [0:num_ports-1] min_route_unmasked;
   wire [0:num_resource_classes-1] route_orc;
    rtr_routing_logic
      #(.num_resource_classes(num_resource_classes),
	.num_routers_per_dim(num_routers_per_dim),
	.num_vcs_per_class(num_vcs_per_class),
	.num_dimensions(num_dimensions),
	.num_nodes_per_router(num_nodes_per_router),
	.connectivity(connectivity),
	.routing_type(routing_type),
	.dim_order(dim_order))
    min_routing
      (.router_address(src_router_address),
       .sel_mc('d1),
       .sel_irc(sel_irc),
       .dest_info({src_router_address,dest_info}),
       .route_op(min_route_unmasked),
       .route_orc(route_orc));


   localparam [0:num_resource_classes-1] sel_irc_nonmin
     = (1 << (num_resource_classes - 1 - 0));

   wire [0:num_ports-1] nonmin_route_unmasked;
   wire [0:num_resource_classes-1] route_orc_nonmin;
   rtr_routing_logic
      #(.num_resource_classes(num_resource_classes),
	.num_routers_per_dim(num_routers_per_dim),
	.num_vcs_per_class(num_vcs_per_class),
	.num_dimensions(num_dimensions),
	.num_nodes_per_router(num_nodes_per_router),
	.connectivity(connectivity),
	.routing_type(routing_type),
	.dim_order(dim_order))
    nonmin_routing
      (.router_address(src_router_address),
       .sel_mc('d1),
       .sel_irc(sel_irc_nonmin),
       .dest_info({intm_router_address,dest_info}),
       .route_op(nonmin_route_unmasked),
       .route_orc(route_orc_nonmin));


   wire [0:credit_count_width-1] min_count;
   wire [0:credit_count_width-1] nonmin_count;


   c_select_1ofn
     #(
       .num_ports			(num_ports-num_nodes_per_router),
       .width				(credit_count_width))
   min_count_select
     (

      .data_out				(min_count[0:credit_count_width-1]),

      .select				(min_route_unmasked[0:num_ports-num_nodes_per_router-1]),
      .data_in				( credit_count[0:(num_ports-num_nodes_per_router)*credit_count_width-1]));
   c_select_1ofn
     #(
       .num_ports			(num_ports-num_nodes_per_router),
       .width				(credit_count_width))
   nonmin_count_select
     (

      .data_out				(nonmin_count[0:credit_count_width-1]),

      .select				(nonmin_route_unmasked[0:num_ports-num_nodes_per_router-1]),
      .data_in				( credit_count[0:(num_ports-num_nodes_per_router)*credit_count_width-1]));


   wire compare ;
   wire compare_q;


   
   wire [0:credit_count_width-1+2] ext_min_count;
   assign  ext_min_count [0:credit_count_width-1+2] = {min_count[0:credit_count_width-1],2'b0};
   wire [0:credit_count_width-1+2] ext_nonmin_count;
   assign  ext_nonmin_count [0:credit_count_width-1+2] = {1'b0,nonmin_count[0:credit_count_width-1],1'b0};
   
   assign compare 	=( (ext_nonmin_count+ugal_threshold) > ext_min_count);


   wire decision 	= (flit_head&flit_valid)?compare:compare_q;

   localparam eligible 	= num_ports-num_nodes_per_router;


   assign route_min 	= |(min_route_unmasked[eligible:num_ports-1])|decision;

   

   c_dff
     #(
       .width				(1),
       .reset_type			(reset_type),
       .reset_value			(1'b1))
   last_compare
     (

      .q				(compare_q),

      .clk				(clk),
      .reset				(reset),
      .active				(active),
      .d				((flit_head&flit_valid)?compare:compare_q));
   



   
   wire [0:router_addr_width-1] rand_value;
   wire [0:router_addr_width-1] rand_feedback;
   
   c_fbgen
     #(.width(router_addr_width),
       .index(1))
   rand_fbgen
     (.feedback(rand_feedback));
   c_lfsr
     #(

       .width			( router_addr_width),
       .iterations	       	( router_addr_width),
       .reset_type		(reset_type))
   rand_gen
     (

      .q			(rand_value[0:router_addr_width-1]),

      .clk			(clk),
      .reset			(reset),
      .load			(reset),
      .run			(flit_head&flit_valid),
      .feedback			(rand_feedback[0:router_addr_width-1]),
      .complete			(1'b0),
      .d			(rand_value[0:router_addr_width-1]));

   wire carry;

   assign {intm_router_address[0:router_addr_width-1],carry} = {src_router_address[0:router_addr_width-1],1'b0}+{rand_value[0:router_addr_width-1],1'b0}; 

   
endmodule