data/full_repos/permissive/43858668/final_verilog/src/vcr_sw_alloc_sep_if.v
1: b'%Error: data/full_repos/permissive/43858668/final_verilog/src/vcr_sw_alloc_sep_if.v:36: Cannot find include file: c_functions.v\n`include "c_functions.v" \n         ^~~~~~~~~~~~~~~\n        ... Looked in:\n             data/full_repos/permissive/43858668/final_verilog/src,data/full_repos/permissive/43858668/c_functions.v\n             data/full_repos/permissive/43858668/final_verilog/src,data/full_repos/permissive/43858668/c_functions.v.v\n             data/full_repos/permissive/43858668/final_verilog/src,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/src/vcr_sw_alloc_sep_if.v:37: Cannot find include file: c_constants.v\n`include "c_constants.v" \n         ^~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/43858668/final_verilog/src/vcr_sw_alloc_sep_if.v:38: Cannot find include file: vcr_constants.v\n`include "vcr_constants.v" \n         ^~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/43858668/final_verilog/src/vcr_sw_alloc_sep_if.v:47: Define or directive not defined: \'`ARBITER_TYPE_ROUND_ROBIN_BINARY\'\n   parameter arbiter_type = `ARBITER_TYPE_ROUND_ROBIN_BINARY;\n                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/43858668/final_verilog/src/vcr_sw_alloc_sep_if.v:47: syntax error, unexpected \';\', expecting TYPE-IDENTIFIER\n   parameter arbiter_type = `ARBITER_TYPE_ROUND_ROBIN_BINARY;\n                                                            ^\n%Error: data/full_repos/permissive/43858668/final_verilog/src/vcr_sw_alloc_sep_if.v:50: Define or directive not defined: \'`SW_ALLOC_SPEC_TYPE_REQ\'\n   parameter spec_type = `SW_ALLOC_SPEC_TYPE_REQ;\n                         ^~~~~~~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/43858668/final_verilog/src/vcr_sw_alloc_sep_if.v:50: syntax error, unexpected \';\', expecting TYPE-IDENTIFIER\n   parameter spec_type = `SW_ALLOC_SPEC_TYPE_REQ;\n                                                ^\n%Error: data/full_repos/permissive/43858668/final_verilog/src/vcr_sw_alloc_sep_if.v:52: 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/src/vcr_sw_alloc_sep_if.v:52: syntax error, unexpected \';\', expecting TYPE-IDENTIFIER\n   parameter reset_type = `RESET_TYPE_ASYNC;\n                                           ^\n%Error: data/full_repos/permissive/43858668/final_verilog/src/vcr_sw_alloc_sep_if.v:148: Define or directive not defined: \'`SW_ALLOC_SPEC_TYPE_PRIO\'\n    if(spec_type != `SW_ALLOC_SPEC_TYPE_PRIO)\n                    ^~~~~~~~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/43858668/final_verilog/src/vcr_sw_alloc_sep_if.v:148: syntax error, unexpected \')\', expecting TYPE-IDENTIFIER\n    if(spec_type != `SW_ALLOC_SPEC_TYPE_PRIO)\n                                            ^\n%Error: data/full_repos/permissive/43858668/final_verilog/src/vcr_sw_alloc_sep_if.v:204: Define or directive not defined: \'`SW_ALLOC_SPEC_TYPE_NONE\'\n    if(spec_type != `SW_ALLOC_SPEC_TYPE_NONE)\n                    ^~~~~~~~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/43858668/final_verilog/src/vcr_sw_alloc_sep_if.v:204: syntax error, unexpected \')\', expecting TYPE-IDENTIFIER\n    if(spec_type != `SW_ALLOC_SPEC_TYPE_NONE)\n                                            ^\n%Error: data/full_repos/permissive/43858668/final_verilog/src/vcr_sw_alloc_sep_if.v:230: Define or directive not defined: \'`SW_ALLOC_SPEC_TYPE_PRIO\'\n  if(spec_type == `SW_ALLOC_SPEC_TYPE_PRIO)\n                  ^~~~~~~~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/43858668/final_verilog/src/vcr_sw_alloc_sep_if.v:230: syntax error, unexpected \')\', expecting TYPE-IDENTIFIER\n  if(spec_type == `SW_ALLOC_SPEC_TYPE_PRIO)\n                                          ^\n%Error: data/full_repos/permissive/43858668/final_verilog/src/vcr_sw_alloc_sep_if.v:252: syntax error, unexpected end\n    end\n    ^~~\n%Error: data/full_repos/permissive/43858668/final_verilog/src/vcr_sw_alloc_sep_if.v:285: Define or directive not defined: \'`SW_ALLOC_SPEC_TYPE_REQ\'\n         `SW_ALLOC_SPEC_TYPE_REQ:\n         ^~~~~~~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/43858668/final_verilog/src/vcr_sw_alloc_sep_if.v:285: syntax error, unexpected \':\', expecting endcase\n         `SW_ALLOC_SPEC_TYPE_REQ:\n                                ^\n%Error: data/full_repos/permissive/43858668/final_verilog/src/vcr_sw_alloc_sep_if.v:295: syntax error, unexpected end\n    end\n    ^~~\n%Error: data/full_repos/permissive/43858668/final_verilog/src/vcr_sw_alloc_sep_if.v:297: Define or directive not defined: \'`SW_ALLOC_SPEC_TYPE_GNT\'\n         `SW_ALLOC_SPEC_TYPE_GNT:\n         ^~~~~~~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/43858668/final_verilog/src/vcr_sw_alloc_sep_if.v:331: syntax error, unexpected end\n      end\n      ^~~\n%Error: data/full_repos/permissive/43858668/final_verilog/src/vcr_sw_alloc_sep_if.v:343: syntax error, unexpected end\n end\n ^~~\n%Error: data/full_repos/permissive/43858668/final_verilog/src/vcr_sw_alloc_sep_if.v:397: syntax error, unexpected generate\n   generate\n   ^~~~~~~~\n%Error: data/full_repos/permissive/43858668/final_verilog/src/vcr_sw_alloc_sep_if.v:401: Define or directive not defined: \'`SW_ALLOC_SPEC_TYPE_NONE\'\n `SW_ALLOC_SPEC_TYPE_NONE, `SW_ALLOC_SPEC_TYPE_PRIO:\n ^~~~~~~~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/43858668/final_verilog/src/vcr_sw_alloc_sep_if.v:401: Define or directive not defined: \'`SW_ALLOC_SPEC_TYPE_PRIO\'\n `SW_ALLOC_SPEC_TYPE_NONE, `SW_ALLOC_SPEC_TYPE_PRIO:\n                           ^~~~~~~~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/43858668/final_verilog/src/vcr_sw_alloc_sep_if.v:407: syntax error, unexpected end\n   end\n   ^~~\n%Error: data/full_repos/permissive/43858668/final_verilog/src/vcr_sw_alloc_sep_if.v:409: Define or directive not defined: \'`SW_ALLOC_SPEC_TYPE_REQ\'\n `SW_ALLOC_SPEC_TYPE_REQ:\n ^~~~~~~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/43858668/final_verilog/src/vcr_sw_alloc_sep_if.v:421: Define or directive not defined: \'`BINARY_OP_NOR\'\n   .op(`BINARY_OP_NOR))\n       ^~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/43858668/final_verilog/src/vcr_sw_alloc_sep_if.v:434: Define or directive not defined: \'`BINARY_OP_NOR\'\n   .op(`BINARY_OP_NOR))\n       ^~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/43858668/final_verilog/src/vcr_sw_alloc_sep_if.v:439: syntax error, unexpected end\n   end\n   ^~~\n%Error: data/full_repos/permissive/43858668/final_verilog/src/vcr_sw_alloc_sep_if.v:441: Define or directive not defined: \'`SW_ALLOC_SPEC_TYPE_GNT\'\n `SW_ALLOC_SPEC_TYPE_GNT:\n ^~~~~~~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/43858668/final_verilog/src/vcr_sw_alloc_sep_if.v:450: Define or directive not defined: \'`BINARY_OP_NOR\'\n   .op(`BINARY_OP_NOR))\n       ^~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/43858668/final_verilog/src/vcr_sw_alloc_sep_if.v:462: Define or directive not defined: \'`BINARY_OP_NOR\'\n   .op(`BINARY_OP_NOR))\n       ^~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/43858668/final_verilog/src/vcr_sw_alloc_sep_if.v:467: syntax error, unexpected end\n   end\n   ^~~\n%Error: data/full_repos/permissive/43858668/final_verilog/src/vcr_sw_alloc_sep_if.v:510: Define or directive not defined: \'`SW_ALLOC_SPEC_TYPE_PRIO\'\n    if(spec_type != `SW_ALLOC_SPEC_TYPE_PRIO)\n                    ^~~~~~~~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/43858668/final_verilog/src/vcr_sw_alloc_sep_if.v:510: syntax error, unexpected \')\', expecting TYPE-IDENTIFIER\n    if(spec_type != `SW_ALLOC_SPEC_TYPE_PRIO)\n                                            ^\n%Error: data/full_repos/permissive/43858668/final_verilog/src/vcr_sw_alloc_sep_if.v:537: Define or directive not defined: \'`SW_ALLOC_SPEC_TYPE_NONE\'\n    if(spec_type != `SW_ALLOC_SPEC_TYPE_NONE)\n                    ^~~~~~~~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/43858668/final_verilog/src/vcr_sw_alloc_sep_if.v:537: syntax error, unexpected \')\', expecting TYPE-IDENTIFIER\n    if(spec_type != `SW_ALLOC_SPEC_TYPE_NONE)\n                                            ^\n%Error: data/full_repos/permissive/43858668/final_verilog/src/vcr_sw_alloc_sep_if.v:554: Define or directive not defined: \'`SW_ALLOC_SPEC_TYPE_PRIO\'\n  if(spec_type == `SW_ALLOC_SPEC_TYPE_PRIO)\n                  ^~~~~~~~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/43858668/final_verilog/src/vcr_sw_alloc_sep_if.v:554: syntax error, unexpected \')\', expecting TYPE-IDENTIFIER\n  if(spec_type == `SW_ALLOC_SPEC_TYPE_PRIO)\n                                          ^\n%Error: data/full_repos/permissive/43858668/final_verilog/src/vcr_sw_alloc_sep_if.v:576: syntax error, unexpected end\n    end\n    ^~~\n%Error: data/full_repos/permissive/43858668/final_verilog/src/vcr_sw_alloc_sep_if.v:609: syntax error, unexpected end\n    end\n    ^~~\n%Error: data/full_repos/permissive/43858668/final_verilog/src/vcr_sw_alloc_sep_if.v:617: syntax error, unexpected end\n      end\n      ^~~\n%Error: data/full_repos/permissive/43858668/final_verilog/src/vcr_sw_alloc_sep_if.v:636: syntax error, unexpected end\n end\n ^~~\n%Error: Cannot continue\n'
module vcr_sw_alloc_sep_if
  (clk, reset, active_ip, active_op, route_ip_ivc_op, req_nonspec_ip_ivc, 
   req_spec_ip_ivc, gnt_ip, sel_ip_ivc, gnt_op, sel_op_ip, sel_op_ivc);
   
`include "c_functions.v"
`include "c_constants.v"
`include "vcr_constants.v"
   

   parameter num_vcs = 4;
   

   parameter num_ports = 5;
   

   parameter arbiter_type = `ARBITER_TYPE_ROUND_ROBIN_BINARY;
   

   parameter spec_type = `SW_ALLOC_SPEC_TYPE_REQ;
   
   parameter reset_type = `RESET_TYPE_ASYNC;
   
   input clk;
   input reset;
   

   input [0:num_ports-1] active_ip;
   input [0:num_ports-1] active_op;
   

   input [0:num_ports*num_vcs*num_ports-1] route_ip_ivc_op;
   

   input [0:num_ports*num_vcs-1] 	   req_nonspec_ip_ivc;
   

   input [0:num_ports*num_vcs-1] 	   req_spec_ip_ivc;
   

   output [0:num_ports-1] 		   gnt_ip;
   wire [0:num_ports-1] 		   gnt_ip;
   

   output [0:num_ports*num_vcs-1] 	   sel_ip_ivc;
   wire [0:num_ports*num_vcs-1] 	   sel_ip_ivc;
   

   output [0:num_ports-1] 		   gnt_op;
   wire [0:num_ports-1] 		   gnt_op;
   

   output [0:num_ports*num_ports-1] 	   sel_op_ip;
   wire [0:num_ports*num_ports-1] 	   sel_op_ip;
   

   output [0:num_ports*num_vcs-1] 	   sel_op_ivc;
   wire [0:num_ports*num_vcs-1] 	   sel_op_ivc;
   
   



   
   wire [0:num_ports*num_ports-1] 	   req_in_nonspec_ip_op;   
   wire [0:num_ports*num_ports-1] 	   req_out_nonspec_ip_op;
   wire [0:num_ports*num_ports-1] 	   gnt_out_nonspec_ip_op;
   
   wire [0:num_ports*num_ports-1] 	   req_out_spec_ip_op;
   wire [0:num_ports*num_ports-1] 	   gnt_out_spec_ip_op;
   
   wire [0:num_ports-1] 		   unused_by_nonspec_ip;
   wire [0:num_ports-1] 		   unused_by_nonspec_op;
   
   



   
   generate
      
      genvar 				   ip;
      
      for(ip = 0; ip < num_ports; ip = ip + 1)
	begin:ips
	   
	   wire active;
	   assign active = active_ip[ip];
	   
	   wire [0:num_vcs*num_ports-1] route_ivc_op;
	   assign route_ivc_op
	     = route_ip_ivc_op[ip*num_vcs*num_ports:(ip+1)*num_vcs*num_ports-1];
	   
	   



	   
	   wire [0:num_ports-1] 	gnt_out_nonspec_op;
	   assign gnt_out_nonspec_op
	     = gnt_out_nonspec_ip_op[ip*num_ports:(ip+1)*num_ports-1];
	   
	   wire 			gnt_out_nonspec;
	   assign gnt_out_nonspec = |gnt_out_nonspec_op;
	   
	   wire 			update_arb_nonspec;
	   assign update_arb_nonspec = gnt_out_nonspec;
	   
	   wire [0:num_vcs-1] 		req_nonspec_ivc;
	   assign req_nonspec_ivc
	     = req_nonspec_ip_ivc[ip*num_vcs:(ip+1)*num_vcs-1];
	   
	   wire [0:num_vcs-1] 		req_in_nonspec_ivc;
	   assign req_in_nonspec_ivc = req_nonspec_ivc;
	   
	   wire [0:num_vcs-1] 		gnt_in_nonspec_ivc;
	   
	   if(spec_type != `SW_ALLOC_SPEC_TYPE_PRIO)
	     begin
		
		c_arbiter
		  #(.num_ports(num_vcs),
		    .num_priorities(1),
		    .reset_type(reset_type),
		    .arbiter_type(arbiter_type))
		gnt_in_nonspec_ivc_arb
		  (.clk(clk),
		   .reset(reset),
		   .active(active),
		   .update(update_arb_nonspec),
		   .req_pr(req_in_nonspec_ivc),
		   .gnt_pr(gnt_in_nonspec_ivc),
		   .gnt());
		
	     end
	   
	   wire [0:num_ports-1] req_in_nonspec_op;
	   c_select_mofn
	     #(.width(num_ports),
	       .num_ports(num_vcs))
	   req_in_nonspec_ip_op_sel
	     (.select(req_in_nonspec_ivc),
	      .data_in(route_ivc_op),
	      .data_out(req_in_nonspec_op));
	   
	   assign req_in_nonspec_ip_op[ip*num_ports:(ip+1)*num_ports-1]
	     = req_in_nonspec_op;
	   



	   
	   wire [0:num_ports-1] req_out_nonspec_op;
	   c_select_mofn
	     #(.width(num_ports),
	       .num_ports(num_vcs))
	   req_out_nonspec_op_sel
	     (.select(gnt_in_nonspec_ivc),
	      .data_in(route_ivc_op),
	      .data_out(req_out_nonspec_op));
	   
	   assign req_out_nonspec_ip_op[ip*num_ports:(ip+1)*num_ports-1]
	     = req_out_nonspec_op;
	   
	   



	   
	   wire [0:num_ports-1] req_out_spec_op;
	   wire 		gnt;
	   wire [0:num_vcs-1] 	sel_ivc;
	   
	   if(spec_type != `SW_ALLOC_SPEC_TYPE_NONE)
	     begin
		



		
		wire [0:num_ports-1] gnt_out_spec_op;
		assign gnt_out_spec_op
		  = gnt_out_spec_ip_op[ip*num_ports:(ip+1)*num_ports-1];
		
		wire 		     gnt_out_spec;
		assign gnt_out_spec = |gnt_out_spec_op;
		
		wire 		     update_arb_spec;
		assign update_arb_spec = gnt_out_spec;
		
		wire [0:num_vcs-1]   req_spec_ivc;
		assign req_spec_ivc
		  = req_spec_ip_ivc[ip*num_vcs:(ip+1)*num_vcs-1];
		
		wire [0:num_vcs-1]   req_in_spec_ivc;
		assign req_in_spec_ivc = req_spec_ivc;
		
		wire [0:num_vcs-1]   gnt_in_spec_ivc;
		
		if(spec_type == `SW_ALLOC_SPEC_TYPE_PRIO)
		  begin
		     
		     wire update_arb;
		     assign update_arb = update_arb_spec | update_arb_nonspec;
		     
		     c_arbiter
		       #(.num_ports(num_vcs),
			 .num_priorities(2),
			 .reset_type(reset_type),
			 .arbiter_type(arbiter_type))
		     gnt_in_ivc_arb
		       (.clk(clk),
			.reset(reset),
			.active(active),
			.update(update_arb),
			.req_pr({req_in_nonspec_ivc, req_in_spec_ivc}),
			.gnt_pr({gnt_in_nonspec_ivc, gnt_in_spec_ivc}),
			.gnt(sel_ivc));
		     
		     assign gnt = gnt_out_nonspec | gnt_out_spec;
		     
		  end
		else
		  begin
		     
		     c_arbiter
		       #(.num_ports(num_vcs),
			 .num_priorities(1),
			 .reset_type(reset_type),
			 .arbiter_type(arbiter_type))
		     gnt_in_spec_ivc_arb
		       (.clk(clk),
			.reset(reset),
			.active(active),
			.update(update_arb_spec),
			.req_pr(req_in_spec_ivc),
			.gnt_pr(gnt_in_spec_ivc),
			.gnt());
		     
		     wire unused_by_nonspec;
		     assign unused_by_nonspec = unused_by_nonspec_ip[ip];
		     
		     wire [0:num_ports-1] gnt_out_spec_qual_op;
		     assign gnt_out_spec_qual_op
		       = gnt_out_spec_op & unused_by_nonspec_op &
			 {num_ports{unused_by_nonspec}};
		     
		     wire 		  gnt_out_spec_qual;
		     assign gnt_out_spec_qual = |gnt_out_spec_qual_op;
		     
		     assign gnt = gnt_out_nonspec | gnt_out_spec_qual;
		     
		     case(spec_type)
		       
		       `SW_ALLOC_SPEC_TYPE_REQ:
			 begin
			    
			    wire req_nonspec;
			    assign req_nonspec = |req_nonspec_ivc;
			    
			    assign sel_ivc = req_nonspec ? 
					     gnt_in_nonspec_ivc : 
					     gnt_in_spec_ivc;
			    
			 end
		       
		       `SW_ALLOC_SPEC_TYPE_GNT:
			 begin
			    
			    assign sel_ivc = gnt_out_nonspec ? 
					     gnt_in_nonspec_ivc : 
					     gnt_in_spec_ivc;
			    
			 end
		       
		     endcase
		     
		  end
		
		



		
		c_select_mofn
		  #(.width(num_ports),
		    .num_ports(num_vcs))
		req_out_spec_op_sel
		  (.select(gnt_in_spec_ivc),
		   .data_in(route_ivc_op),
		   .data_out(req_out_spec_op));
		
	     end
	   else
	     begin
		
		assign req_out_spec_op = {num_ports{1'b0}};
		assign sel_ivc = gnt_in_nonspec_ivc;
		assign gnt = gnt_out_nonspec;
		
	     end
	   
	   



	   
	   assign req_out_spec_ip_op[ip*num_ports:(ip+1)*num_ports-1]
	     = req_out_spec_op;
	   assign sel_ip_ivc[ip*num_vcs:(ip+1)*num_vcs-1] = sel_ivc;
	   assign gnt_ip[ip] = gnt;
	   	   
	end
      
   endgenerate
   
   



   
   wire [0:num_ports*num_ports-1] req_in_nonspec_op_ip;
   c_interleave
     #(.width(num_ports*num_ports),
       .num_blocks(num_ports))
   req_in_nonspec_op_ip_intl
     (.data_in(req_in_nonspec_ip_op),
      .data_out(req_in_nonspec_op_ip));
   
   wire [0:num_ports*num_ports-1] req_out_nonspec_op_ip;
   c_interleave
     #(.width(num_ports*num_ports),
       .num_blocks(num_ports))
   req_out_nonspec_op_ip_intl
     (.data_in(req_out_nonspec_ip_op),
      .data_out(req_out_nonspec_op_ip));
   
   wire [0:num_ports*num_ports-1] gnt_out_nonspec_op_ip;
   c_interleave
     #(.width(num_ports*num_ports),
       .num_blocks(num_ports))
   gnt_out_nonspec_op_ip_intl
     (.data_in(gnt_out_nonspec_op_ip),
      .data_out(gnt_out_nonspec_ip_op));
   
   wire [0:num_ports*num_ports-1] req_out_spec_op_ip;
   c_interleave
     #(.width(num_ports*num_ports),
       .num_blocks(num_ports))
   req_out_spec_op_ip_intl
     (.data_in(req_out_spec_ip_op),
      .data_out(req_out_spec_op_ip));
   
   wire [0:num_ports*num_ports-1] gnt_out_spec_op_ip;
   c_interleave
     #(.width(num_ports*num_ports),
       .num_blocks(num_ports))
   gnt_out_spec_op_ip_intl
     (.data_in(gnt_out_spec_op_ip),
      .data_out(gnt_out_spec_ip_op));
   
   



   
   generate
      
      case(spec_type)
	
	`SW_ALLOC_SPEC_TYPE_NONE, `SW_ALLOC_SPEC_TYPE_PRIO:
	  begin
	     
	     assign unused_by_nonspec_ip = {num_ports{1'b0}};
	     assign unused_by_nonspec_op = {num_ports{1'b0}};
	     
	  end
	
	`SW_ALLOC_SPEC_TYPE_REQ:
	  begin
	     






	     c_binary_op
	       #(.width(num_ports),
		 .num_ports(num_ports),
		 .op(`BINARY_OP_NOR))
	     unused_by_nonspec_op_nor
	       (.data_in(req_out_nonspec_ip_op),
		.data_out(unused_by_nonspec_op));
	     





	     c_binary_op
	       #(.width(num_ports),
		 .num_ports(num_ports),
		 .op(`BINARY_OP_NOR))
	     unused_by_nonspec_ip_nor
	       (.data_in(req_in_nonspec_op_ip),
		.data_out(unused_by_nonspec_ip));
	     
	  end
	
	`SW_ALLOC_SPEC_TYPE_GNT:
	  begin
	     



	     c_binary_op
	       #(.width(num_ports),
		 .num_ports(num_ports),
		 .op(`BINARY_OP_NOR))
	     unused_by_nonspec_op_nor
	       (.data_in(req_out_nonspec_ip_op),
		.data_out(unused_by_nonspec_op));
	     




	     c_binary_op
	       #(.width(num_ports),
		 .num_ports(num_ports),
		 .op(`BINARY_OP_NOR))
	     unused_by_nonspec_ip_nor
	       (.data_in(gnt_out_nonspec_op_ip),
		.data_out(unused_by_nonspec_ip));
	     
	  end
	
      endcase
      
   endgenerate
   
   



   
   generate
      
      genvar 				    op;
      
      for (op = 0; op < num_ports; op = op + 1)
	begin:ops
	   
	   wire active;
	   assign active = active_op[op];
	   
	   



	   
	   wire [0:num_ports-1] sel_ip;
	   
	   wire [0:num_ports-1] req_out_nonspec_ip;
	   assign req_out_nonspec_ip
	     = req_out_nonspec_op_ip[op*num_ports:(op+1)*num_ports-1];
	   
	   wire req_out_nonspec;
	   assign req_out_nonspec = |req_out_nonspec_ip;
	   



	   wire 		update_arb_nonspec;
	   assign update_arb_nonspec = req_out_nonspec;
	   
	   wire [0:num_ports-1] gnt_out_nonspec_ip;
	   
	   if(spec_type != `SW_ALLOC_SPEC_TYPE_PRIO)
	     begin
		
		c_arbiter
		  #(.num_ports(num_ports),
		    .num_priorities(1),
		    .arbiter_type(arbiter_type),
		    .reset_type(reset_type))
		gnt_out_nonspec_ip_arb
		  (.clk(clk),
		   .reset(reset),
		   .active(active),
		   .update(update_arb_nonspec),
		   .req_pr(req_out_nonspec_ip),
		   .gnt_pr(gnt_out_nonspec_ip),
		   .gnt());
		
	     end
	   
	   



	   
	   wire [0:num_ports-1] gnt_out_spec_ip;
	   wire 		gnt;
	   
	   if(spec_type != `SW_ALLOC_SPEC_TYPE_NONE)
	     begin
		



		
		wire [0:num_ports-1] req_out_spec_ip;
		assign req_out_spec_ip
		  = req_out_spec_op_ip[op*num_ports:(op+1)*num_ports-1];

		wire 		     req_out_spec;
		assign req_out_spec = |req_out_spec_ip;
		
		wire 		     update_arb_spec;
		assign update_arb_spec = req_out_spec;
		
		if(spec_type == `SW_ALLOC_SPEC_TYPE_PRIO)
		  begin
		     
		     wire update_arb;
		     assign update_arb = update_arb_nonspec | update_arb_spec;
		     
		     c_arbiter
		       #(.num_ports(num_ports),
			 .num_priorities(2),
			 .arbiter_type(arbiter_type),
			 .reset_type(reset_type))
		     gnt_out_ip_arb
		       (.clk(clk),
			.reset(reset),
			.active(active),
			.update(update_arb),
			.req_pr({req_out_nonspec_ip, req_out_spec_ip}),
			.gnt_pr({gnt_out_nonspec_ip, gnt_out_spec_ip}),
			.gnt(sel_ip));
		     
		     assign gnt = req_out_nonspec | req_out_spec;
		     
		  end
		else
		  begin
		     
		     c_arbiter
		       #(.num_ports(num_ports),
			 .num_priorities(1),
			 .arbiter_type(arbiter_type),
			 .reset_type(reset_type))
		     gnt_out_spec_ip_arb
		       (.clk(clk),
			.reset(reset),
			.active(active),
			.update(update_arb_spec),
			.req_pr(req_out_spec_ip),
			.gnt_pr(gnt_out_spec_ip),
			.gnt());
		     
		     wire unused_by_nonspec;
		     assign unused_by_nonspec = unused_by_nonspec_op[op];
		     
		     wire [0:num_ports-1] gnt_out_spec_qual_ip;
		     assign gnt_out_spec_qual_ip
		       = gnt_out_spec_ip & unused_by_nonspec_ip &
			 {num_ports{unused_by_nonspec}};
		     
		     wire 		  gnt_out_spec_qual;
		     assign gnt_out_spec_qual = |gnt_out_spec_qual_ip;
		     
		     assign sel_ip = gnt_out_nonspec_ip | gnt_out_spec_qual_ip;
		     
		     assign gnt = req_out_nonspec | gnt_out_spec_qual;
		     
		  end
		
	     end
	   else
	     begin
		assign gnt_out_spec_ip = {num_ports{1'b0}};
		assign gnt = req_out_nonspec;
		assign sel_ip = gnt_out_nonspec_ip;
	     end
	   
	   wire [0:num_vcs-1] sel_ivc;
	   c_select_1ofn
	     #(.num_ports(num_ports),
	       .width(num_vcs))
	   sel_ivc_sel
	     (.select(sel_ip),
	      .data_in(sel_ip_ivc),
	      .data_out(sel_ivc));
	   
	   assign gnt_out_nonspec_op_ip[op*num_ports:(op+1)*num_ports-1]
	     = gnt_out_nonspec_ip;
	   assign gnt_out_spec_op_ip[op*num_ports:(op+1)*num_ports-1]
	     = gnt_out_spec_ip;
	   assign gnt_op[op] = gnt;
	   assign sel_op_ip[op*num_ports:(op+1)*num_ports-1] = sel_ip;
	   assign sel_op_ivc[op*num_vcs:(op+1)*num_vcs-1] = sel_ivc;
	   
	end
      
   endgenerate
   
endmodule
module vcr_sw_alloc_sep_if
  (clk, reset, active_ip, active_op, route_ip_ivc_op, req_nonspec_ip_ivc, 
   req_spec_ip_ivc, gnt_ip, sel_ip_ivc, gnt_op, sel_op_ip, sel_op_ivc);

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

   parameter num_vcs = 4;
   

   parameter num_ports = 5;
   

   parameter arbiter_type = `ARBITER_TYPE_ROUND_ROBIN_BINARY;
   

   parameter spec_type = `SW_ALLOC_SPEC_TYPE_REQ;
   
   parameter reset_type = `RESET_TYPE_ASYNC;
   
   input clk;
   input reset;
   

   input [0:num_ports-1] active_ip;
   input [0:num_ports-1] active_op;
   

   input [0:num_ports*num_vcs*num_ports-1] route_ip_ivc_op;
   

   input [0:num_ports*num_vcs-1] 	   req_nonspec_ip_ivc;
   

   input [0:num_ports*num_vcs-1] 	   req_spec_ip_ivc;
   

   output [0:num_ports-1] 		   gnt_ip;
   wire [0:num_ports-1] 		   gnt_ip;
   

   output [0:num_ports*num_vcs-1] 	   sel_ip_ivc;
   wire [0:num_ports*num_vcs-1] 	   sel_ip_ivc;
   

   output [0:num_ports-1] 		   gnt_op;
   wire [0:num_ports-1] 		   gnt_op;
   

   output [0:num_ports*num_ports-1] 	   sel_op_ip;
   wire [0:num_ports*num_ports-1] 	   sel_op_ip;
   

   output [0:num_ports*num_vcs-1] 	   sel_op_ivc;
   wire [0:num_ports*num_vcs-1] 	   sel_op_ivc;
   
   



   
   wire [0:num_ports*num_ports-1] 	   req_in_nonspec_ip_op;   
   wire [0:num_ports*num_ports-1] 	   req_out_nonspec_ip_op;
   wire [0:num_ports*num_ports-1] 	   gnt_out_nonspec_ip_op;
   
   wire [0:num_ports*num_ports-1] 	   req_out_spec_ip_op;
   wire [0:num_ports*num_ports-1] 	   gnt_out_spec_ip_op;
   
   wire [0:num_ports-1] 		   unused_by_nonspec_ip;
   wire [0:num_ports-1] 		   unused_by_nonspec_op;
   
   



   
   generate
      
      genvar 				   ip;
      
      for(ip = 0; ip < num_ports; ip = ip + 1)
	begin:ips
	   
	   wire active;
	   assign active = active_ip[ip];
	   
	   wire [0:num_vcs*num_ports-1] route_ivc_op;
	   assign route_ivc_op
	     = route_ip_ivc_op[ip*num_vcs*num_ports:(ip+1)*num_vcs*num_ports-1];
	   
	   



	   
	   wire [0:num_ports-1] 	gnt_out_nonspec_op;
	   assign gnt_out_nonspec_op
	     = gnt_out_nonspec_ip_op[ip*num_ports:(ip+1)*num_ports-1];
	   
	   wire 			gnt_out_nonspec;
	   assign gnt_out_nonspec = |gnt_out_nonspec_op;
	   
	   wire 			update_arb_nonspec;
	   assign update_arb_nonspec = gnt_out_nonspec;
	   
	   wire [0:num_vcs-1] 		req_nonspec_ivc;
	   assign req_nonspec_ivc
	     = req_nonspec_ip_ivc[ip*num_vcs:(ip+1)*num_vcs-1];
	   
	   wire [0:num_vcs-1] 		req_in_nonspec_ivc;
	   assign req_in_nonspec_ivc = req_nonspec_ivc;
	   
	   wire [0:num_vcs-1] 		gnt_in_nonspec_ivc;
	   
	   if(spec_type != `SW_ALLOC_SPEC_TYPE_PRIO)
	     begin
		
		c_arbiter
		  #(.num_ports(num_vcs),
		    .num_priorities(1),
		    .reset_type(reset_type),
		    .arbiter_type(arbiter_type))
		gnt_in_nonspec_ivc_arb
		  (.clk(clk),
		   .reset(reset),
		   .active(active),
		   .update(update_arb_nonspec),
		   .req_pr(req_in_nonspec_ivc),
		   .gnt_pr(gnt_in_nonspec_ivc),
		   .gnt());
		
	     end
	   
	   wire [0:num_ports-1] req_in_nonspec_op;
	   c_select_mofn
	     #(.width(num_ports),
	       .num_ports(num_vcs))
	   req_in_nonspec_ip_op_sel
	     (.select(req_in_nonspec_ivc),
	      .data_in(route_ivc_op),
	      .data_out(req_in_nonspec_op));
	   
	   assign req_in_nonspec_ip_op[ip*num_ports:(ip+1)*num_ports-1]
	     = req_in_nonspec_op;
	   



	   
	   wire [0:num_ports-1] req_out_nonspec_op;
	   c_select_mofn
	     #(.width(num_ports),
	       .num_ports(num_vcs))
	   req_out_nonspec_op_sel
	     (.select(gnt_in_nonspec_ivc),
	      .data_in(route_ivc_op),
	      .data_out(req_out_nonspec_op));
	   
	   assign req_out_nonspec_ip_op[ip*num_ports:(ip+1)*num_ports-1]
	     = req_out_nonspec_op;
	   
	   



	   
	   wire [0:num_ports-1] req_out_spec_op;
	   wire 		gnt;
	   wire [0:num_vcs-1] 	sel_ivc;
	   
	   if(spec_type != `SW_ALLOC_SPEC_TYPE_NONE)
	     begin
		



		
		wire [0:num_ports-1] gnt_out_spec_op;
		assign gnt_out_spec_op
		  = gnt_out_spec_ip_op[ip*num_ports:(ip+1)*num_ports-1];
		
		wire 		     gnt_out_spec;
		assign gnt_out_spec = |gnt_out_spec_op;
		
		wire 		     update_arb_spec;
		assign update_arb_spec = gnt_out_spec;
		
		wire [0:num_vcs-1]   req_spec_ivc;
		assign req_spec_ivc
		  = req_spec_ip_ivc[ip*num_vcs:(ip+1)*num_vcs-1];
		
		wire [0:num_vcs-1]   req_in_spec_ivc;
		assign req_in_spec_ivc = req_spec_ivc;
		
		wire [0:num_vcs-1]   gnt_in_spec_ivc;
		
		if(spec_type == `SW_ALLOC_SPEC_TYPE_PRIO)
		  begin
		     
		     wire update_arb;
		     assign update_arb = update_arb_spec | update_arb_nonspec;
		     
		     c_arbiter
		       #(.num_ports(num_vcs),
			 .num_priorities(2),
			 .reset_type(reset_type),
			 .arbiter_type(arbiter_type))
		     gnt_in_ivc_arb
		       (.clk(clk),
			.reset(reset),
			.active(active),
			.update(update_arb),
			.req_pr({req_in_nonspec_ivc, req_in_spec_ivc}),
			.gnt_pr({gnt_in_nonspec_ivc, gnt_in_spec_ivc}),
			.gnt(sel_ivc));
		     
		     assign gnt = gnt_out_nonspec | gnt_out_spec;
		     
		  end
		else
		  begin
		     
		     c_arbiter
		       #(.num_ports(num_vcs),
			 .num_priorities(1),
			 .reset_type(reset_type),
			 .arbiter_type(arbiter_type))
		     gnt_in_spec_ivc_arb
		       (.clk(clk),
			.reset(reset),
			.active(active),
			.update(update_arb_spec),
			.req_pr(req_in_spec_ivc),
			.gnt_pr(gnt_in_spec_ivc),
			.gnt());
		     
		     wire unused_by_nonspec;
		     assign unused_by_nonspec = unused_by_nonspec_ip[ip];
		     
		     wire [0:num_ports-1] gnt_out_spec_qual_op;
		     assign gnt_out_spec_qual_op
		       = gnt_out_spec_op & unused_by_nonspec_op &
			 {num_ports{unused_by_nonspec}};
		     
		     wire 		  gnt_out_spec_qual;
		     assign gnt_out_spec_qual = |gnt_out_spec_qual_op;
		     
		     assign gnt = gnt_out_nonspec | gnt_out_spec_qual;
		     
		     case(spec_type)
		       
		       `SW_ALLOC_SPEC_TYPE_REQ:
			 begin
			    
			    wire req_nonspec;
			    assign req_nonspec = |req_nonspec_ivc;
			    
			    assign sel_ivc = req_nonspec ? 
					     gnt_in_nonspec_ivc : 
					     gnt_in_spec_ivc;
			    
			 end
		       
		       `SW_ALLOC_SPEC_TYPE_GNT:
			 begin
			    
			    assign sel_ivc = gnt_out_nonspec ? 
					     gnt_in_nonspec_ivc : 
					     gnt_in_spec_ivc;
			    
			 end
		       
		     endcase
		     
		  end
		
		



		
		c_select_mofn
		  #(.width(num_ports),
		    .num_ports(num_vcs))
		req_out_spec_op_sel
		  (.select(gnt_in_spec_ivc),
		   .data_in(route_ivc_op),
		   .data_out(req_out_spec_op));
		
	     end
	   else
	     begin
		
		assign req_out_spec_op = {num_ports{1'b0}};
		assign sel_ivc = gnt_in_nonspec_ivc;
		assign gnt = gnt_out_nonspec;
		
	     end
	   
	   



	   
	   assign req_out_spec_ip_op[ip*num_ports:(ip+1)*num_ports-1]
	     = req_out_spec_op;
	   assign sel_ip_ivc[ip*num_vcs:(ip+1)*num_vcs-1] = sel_ivc;
	   assign gnt_ip[ip] = gnt;
	   	   
	end
      
   endgenerate
   
   



   
   wire [0:num_ports*num_ports-1] req_in_nonspec_op_ip;
   c_interleave
     #(.width(num_ports*num_ports),
       .num_blocks(num_ports))
   req_in_nonspec_op_ip_intl
     (.data_in(req_in_nonspec_ip_op),
      .data_out(req_in_nonspec_op_ip));
   
   wire [0:num_ports*num_ports-1] req_out_nonspec_op_ip;
   c_interleave
     #(.width(num_ports*num_ports),
       .num_blocks(num_ports))
   req_out_nonspec_op_ip_intl
     (.data_in(req_out_nonspec_ip_op),
      .data_out(req_out_nonspec_op_ip));
   
   wire [0:num_ports*num_ports-1] gnt_out_nonspec_op_ip;
   c_interleave
     #(.width(num_ports*num_ports),
       .num_blocks(num_ports))
   gnt_out_nonspec_op_ip_intl
     (.data_in(gnt_out_nonspec_op_ip),
      .data_out(gnt_out_nonspec_ip_op));
   
   wire [0:num_ports*num_ports-1] req_out_spec_op_ip;
   c_interleave
     #(.width(num_ports*num_ports),
       .num_blocks(num_ports))
   req_out_spec_op_ip_intl
     (.data_in(req_out_spec_ip_op),
      .data_out(req_out_spec_op_ip));
   
   wire [0:num_ports*num_ports-1] gnt_out_spec_op_ip;
   c_interleave
     #(.width(num_ports*num_ports),
       .num_blocks(num_ports))
   gnt_out_spec_op_ip_intl
     (.data_in(gnt_out_spec_op_ip),
      .data_out(gnt_out_spec_ip_op));
   
   



   
   generate
      
      case(spec_type)
	
	`SW_ALLOC_SPEC_TYPE_NONE, `SW_ALLOC_SPEC_TYPE_PRIO:
	  begin
	     
	     assign unused_by_nonspec_ip = {num_ports{1'b0}};
	     assign unused_by_nonspec_op = {num_ports{1'b0}};
	     
	  end
	
	`SW_ALLOC_SPEC_TYPE_REQ:
	  begin
	     






	     c_binary_op
	       #(.width(num_ports),
		 .num_ports(num_ports),
		 .op(`BINARY_OP_NOR))
	     unused_by_nonspec_op_nor
	       (.data_in(req_out_nonspec_ip_op),
		.data_out(unused_by_nonspec_op));
	     





	     c_binary_op
	       #(.width(num_ports),
		 .num_ports(num_ports),
		 .op(`BINARY_OP_NOR))
	     unused_by_nonspec_ip_nor
	       (.data_in(req_in_nonspec_op_ip),
		.data_out(unused_by_nonspec_ip));
	     
	  end
	
	`SW_ALLOC_SPEC_TYPE_GNT:
	  begin
	     



	     c_binary_op
	       #(.width(num_ports),
		 .num_ports(num_ports),
		 .op(`BINARY_OP_NOR))
	     unused_by_nonspec_op_nor
	       (.data_in(req_out_nonspec_ip_op),
		.data_out(unused_by_nonspec_op));
	     




	     c_binary_op
	       #(.width(num_ports),
		 .num_ports(num_ports),
		 .op(`BINARY_OP_NOR))
	     unused_by_nonspec_ip_nor
	       (.data_in(gnt_out_nonspec_op_ip),
		.data_out(unused_by_nonspec_ip));
	     
	  end
	
      endcase
      
   endgenerate
   
   



   
   generate
      
      genvar 				    op;
      
      for (op = 0; op < num_ports; op = op + 1)
	begin:ops
	   
	   wire active;
	   assign active = active_op[op];
	   
	   



	   
	   wire [0:num_ports-1] sel_ip;
	   
	   wire [0:num_ports-1] req_out_nonspec_ip;
	   assign req_out_nonspec_ip
	     = req_out_nonspec_op_ip[op*num_ports:(op+1)*num_ports-1];
	   
	   wire req_out_nonspec;
	   assign req_out_nonspec = |req_out_nonspec_ip;
	   



	   wire 		update_arb_nonspec;
	   assign update_arb_nonspec = req_out_nonspec;
	   
	   wire [0:num_ports-1] gnt_out_nonspec_ip;
	   
	   if(spec_type != `SW_ALLOC_SPEC_TYPE_PRIO)
	     begin
		
		c_arbiter
		  #(.num_ports(num_ports),
		    .num_priorities(1),
		    .arbiter_type(arbiter_type),
		    .reset_type(reset_type))
		gnt_out_nonspec_ip_arb
		  (.clk(clk),
		   .reset(reset),
		   .active(active),
		   .update(update_arb_nonspec),
		   .req_pr(req_out_nonspec_ip),
		   .gnt_pr(gnt_out_nonspec_ip),
		   .gnt());
		
	     end
	   
	   



	   
	   wire [0:num_ports-1] gnt_out_spec_ip;
	   wire 		gnt;
	   
	   if(spec_type != `SW_ALLOC_SPEC_TYPE_NONE)
	     begin
		



		
		wire [0:num_ports-1] req_out_spec_ip;
		assign req_out_spec_ip
		  = req_out_spec_op_ip[op*num_ports:(op+1)*num_ports-1];

		wire 		     req_out_spec;
		assign req_out_spec = |req_out_spec_ip;
		
		wire 		     update_arb_spec;
		assign update_arb_spec = req_out_spec;
		
		if(spec_type == `SW_ALLOC_SPEC_TYPE_PRIO)
		  begin
		     
		     wire update_arb;
		     assign update_arb = update_arb_nonspec | update_arb_spec;
		     
		     c_arbiter
		       #(.num_ports(num_ports),
			 .num_priorities(2),
			 .arbiter_type(arbiter_type),
			 .reset_type(reset_type))
		     gnt_out_ip_arb
		       (.clk(clk),
			.reset(reset),
			.active(active),
			.update(update_arb),
			.req_pr({req_out_nonspec_ip, req_out_spec_ip}),
			.gnt_pr({gnt_out_nonspec_ip, gnt_out_spec_ip}),
			.gnt(sel_ip));
		     
		     assign gnt = req_out_nonspec | req_out_spec;
		     
		  end
		else
		  begin
		     
		     c_arbiter
		       #(.num_ports(num_ports),
			 .num_priorities(1),
			 .arbiter_type(arbiter_type),
			 .reset_type(reset_type))
		     gnt_out_spec_ip_arb
		       (.clk(clk),
			.reset(reset),
			.active(active),
			.update(update_arb_spec),
			.req_pr(req_out_spec_ip),
			.gnt_pr(gnt_out_spec_ip),
			.gnt());
		     
		     wire unused_by_nonspec;
		     assign unused_by_nonspec = unused_by_nonspec_op[op];
		     
		     wire [0:num_ports-1] gnt_out_spec_qual_ip;
		     assign gnt_out_spec_qual_ip
		       = gnt_out_spec_ip & unused_by_nonspec_ip &
			 {num_ports{unused_by_nonspec}};
		     
		     wire 		  gnt_out_spec_qual;
		     assign gnt_out_spec_qual = |gnt_out_spec_qual_ip;
		     
		     assign sel_ip = gnt_out_nonspec_ip | gnt_out_spec_qual_ip;
		     
		     assign gnt = req_out_nonspec | gnt_out_spec_qual;
		     
		  end
		
	     end
	   else
	     begin
		assign gnt_out_spec_ip = {num_ports{1'b0}};
		assign gnt = req_out_nonspec;
		assign sel_ip = gnt_out_nonspec_ip;
	     end
	   
	   wire [0:num_vcs-1] sel_ivc;
	   c_select_1ofn
	     #(.num_ports(num_ports),
	       .width(num_vcs))
	   sel_ivc_sel
	     (.select(sel_ip),
	      .data_in(sel_ip_ivc),
	      .data_out(sel_ivc));
	   
	   assign gnt_out_nonspec_op_ip[op*num_ports:(op+1)*num_ports-1]
	     = gnt_out_nonspec_ip;
	   assign gnt_out_spec_op_ip[op*num_ports:(op+1)*num_ports-1]
	     = gnt_out_spec_ip;
	   assign gnt_op[op] = gnt;
	   assign sel_op_ip[op*num_ports:(op+1)*num_ports-1] = sel_ip;
	   assign sel_op_ivc[op*num_vcs:(op+1)*num_vcs-1] = sel_ivc;
	   
	end
      
   endgenerate
   
endmodule