data/full_repos/permissive/171279647/hdl/axis/axis_bitonic_sort.v
1: b"%Error: data/full_repos/permissive/171279647/hdl/axis/axis_bitonic_sort.v:118: Cannot find file containing module: 'axis_bitonic_block'\n   axis_bitonic_block #(\n   ^~~~~~~~~~~~~~~~~~\n        ... Looked in:\n             data/full_repos/permissive/171279647/hdl/axis,data/full_repos/permissive/171279647/axis_bitonic_block\n             data/full_repos/permissive/171279647/hdl/axis,data/full_repos/permissive/171279647/axis_bitonic_block.v\n             data/full_repos/permissive/171279647/hdl/axis,data/full_repos/permissive/171279647/axis_bitonic_block.sv\n             axis_bitonic_block\n             axis_bitonic_block.v\n             axis_bitonic_block.sv\n             obj_dir/axis_bitonic_block\n             obj_dir/axis_bitonic_block.v\n             obj_dir/axis_bitonic_block.sv\n%Error: data/full_repos/permissive/171279647/hdl/axis/axis_bitonic_sort.v:136: Cannot find file containing module: 'axis_bitonic_block'\n   axis_bitonic_block #(\n   ^~~~~~~~~~~~~~~~~~\n%Error: Exiting due to 2 error(s)\n"
module axis_bitonic_sort #(
	parameter DATA_WIDTH = 16,
	parameter CHAN_NUM = 32,
	parameter DIR = 0,
	parameter SIGNED = 0,
	parameter IS_TLAST = 1,
	parameter IS_TREADY = 1
)
(
	input wire aclk,
	input wire aresetn,
	input wire [DATA_WIDTH*CHAN_NUM-1:0]s_axis_tdata,
	input wire s_axis_tvalid,
	output wire s_axis_tready,
	input wire s_axis_tlast,
	output wire [DATA_WIDTH*CHAN_NUM-1:0]m_axis_tdata,
	output wire m_axis_tvalid,
	input wire m_axis_tready,
	output wire m_axis_tlast
);

localparam CHAN_ACT = 2**$clog2(CHAN_NUM);
localparam CHAN_ADD = CHAN_ACT - CHAN_NUM;

localparam STAGES = $clog2(CHAN_ACT);
localparam STAGE_DATA_WIDTH = DATA_WIDTH*CHAN_ACT;

wire [STAGE_DATA_WIDTH-1:0]axis_stage_tdata[STAGES:0];
wire [STAGE_DATA_WIDTH-1:0]m_axis_tdata_tmp;
wire [STAGES:0]axis_stage_tvalid;
wire [STAGES:0]axis_stage_tlast;
wire [STAGES:0]axis_stage_tready;

assign axis_stage_tdata[0] = {s_axis_tdata, {CHAN_ADD{SIGNED?{1'b1,{(DATA_WIDTH-1){1'b0}}}:{DATA_WIDTH{1'b0}}}}};
assign axis_stage_tvalid[0] = s_axis_tvalid;
assign s_axis_tready = IS_TREADY ? axis_stage_tready[0] : 1'b1;
assign axis_stage_tlast[0] = IS_TLAST ? s_axis_tlast : 1'b0;
assign m_axis_tdata_tmp = axis_stage_tdata[STAGES];
assign m_axis_tdata = DIR ? m_axis_tdata_tmp[DATA_WIDTH*CHAN_NUM-1:0] : m_axis_tdata_tmp[DATA_WIDTH*CHAN_ACT-1-:DATA_WIDTH*CHAN_NUM];
assign m_axis_tvalid = axis_stage_tvalid[STAGES];
assign axis_stage_tready[STAGES] = IS_TREADY ? m_axis_tready : 1'b1;
assign m_axis_tlast = IS_TLAST ? axis_stage_tlast[STAGES] : 1'b0;

genvar stage;
genvar block;

generate for (stage = 0; stage < STAGES; stage = stage + 1) begin: SORT_STAGE
	localparam BLOCKS = CHAN_ACT / 2**(stage+1);
	localparam BLOCK_ORDER = stage;
		
	wire [STAGE_DATA_WIDTH-1:0]s_axis_stage_tdata;
	wire s_axis_stage_tvalid;
	wire s_axis_stage_tready;
	wire s_axis_stage_tlast;
	wire [STAGE_DATA_WIDTH-1:0]m_axis_stage_tdata;
	wire m_axis_stage_tvalid;
	wire m_axis_stage_tready;
	wire m_axis_stage_tlast;
		
	assign s_axis_stage_tdata = axis_stage_tdata[stage];
	assign s_axis_stage_tvalid = axis_stage_tvalid[stage];
	assign axis_stage_tready[stage] = s_axis_stage_tready;
	assign s_axis_stage_tlast = axis_stage_tlast[stage];
	assign axis_stage_tdata[stage + 1] = m_axis_stage_tdata;
	assign m_axis_stage_tready = axis_stage_tready[stage + 1];
	assign axis_stage_tvalid[stage + 1] = m_axis_stage_tvalid;
	assign axis_stage_tlast[stage + 1] = m_axis_stage_tlast;

	for (block = 0; block < BLOCKS; block = block + 1) begin: BLOCK
		localparam BLOCK_DATA_WIDTH = DATA_WIDTH*2**(BLOCK_ORDER+1);
		localparam BLOCK_POLARITY = DIR ? (~block & 1) : (block & 1);
			
		wire [BLOCK_DATA_WIDTH-1:0]s_axis_block_tdata;
		wire [BLOCK_DATA_WIDTH-1:0]m_axis_block_tdata;
			
		assign s_axis_block_tdata = s_axis_stage_tdata[BLOCK_DATA_WIDTH*(block+1)-1-:BLOCK_DATA_WIDTH];
		assign m_axis_stage_tdata[BLOCK_DATA_WIDTH*(block+1)-1-:BLOCK_DATA_WIDTH] = m_axis_block_tdata;
		
		if (block == 0) begin
			axis_bitonic_block #(
				.DATA_WIDTH(DATA_WIDTH),
				.ORDER(BLOCK_ORDER),
				.POLARITY(BLOCK_POLARITY),
				.SIGNED(SIGNED)
			) abb_inst (
				.aclk(aclk),
				.aresetn(aresetn),
				.s_axis_tdata(s_axis_block_tdata),
				.s_axis_tvalid(s_axis_stage_tvalid),
				.s_axis_tready(s_axis_stage_tready),
				.s_axis_tlast(s_axis_stage_tlast),
				.m_axis_tdata(m_axis_block_tdata),
				.m_axis_tvalid(m_axis_stage_tvalid),
				.m_axis_tready(m_axis_stage_tready),
				.m_axis_tlast(m_axis_stage_tlast)
			);
		end else begin
			axis_bitonic_block #(
				.DATA_WIDTH(DATA_WIDTH),
				.ORDER(BLOCK_ORDER),
				.POLARITY(BLOCK_POLARITY),
				.SIGNED(SIGNED)
			) abb_inst (
				.aclk(aclk),
				.aresetn(aresetn),
				.s_axis_tdata(s_axis_block_tdata),
				.s_axis_tvalid(s_axis_stage_tvalid),
				.s_axis_tready(),
				.s_axis_tlast(),
				.m_axis_tdata(m_axis_block_tdata),
				.m_axis_tvalid(),
				.m_axis_tready(m_axis_stage_tready),
				.m_axis_tlast()
			);
		end
	end
end endgenerate

endmodule
module axis_bitonic_sort #(
	parameter DATA_WIDTH = 16,
	parameter CHAN_NUM = 32,
	parameter DIR = 0,
	parameter SIGNED = 0,
	parameter IS_TLAST = 1,
	parameter IS_TREADY = 1
)
(
	input wire aclk,
	input wire aresetn,
	input wire [DATA_WIDTH*CHAN_NUM-1:0]s_axis_tdata,
	input wire s_axis_tvalid,
	output wire s_axis_tready,
	input wire s_axis_tlast,
	output wire [DATA_WIDTH*CHAN_NUM-1:0]m_axis_tdata,
	output wire m_axis_tvalid,
	input wire m_axis_tready,
	output wire m_axis_tlast
);


localparam CHAN_ACT = 2**$clog2(CHAN_NUM);
localparam CHAN_ADD = CHAN_ACT - CHAN_NUM;

localparam STAGES = $clog2(CHAN_ACT);
localparam STAGE_DATA_WIDTH = DATA_WIDTH*CHAN_ACT;

wire [STAGE_DATA_WIDTH-1:0]axis_stage_tdata[STAGES:0];
wire [STAGE_DATA_WIDTH-1:0]m_axis_tdata_tmp;
wire [STAGES:0]axis_stage_tvalid;
wire [STAGES:0]axis_stage_tlast;
wire [STAGES:0]axis_stage_tready;

assign axis_stage_tdata[0] = {s_axis_tdata, {CHAN_ADD{SIGNED?{1'b1,{(DATA_WIDTH-1){1'b0}}}:{DATA_WIDTH{1'b0}}}}};
assign axis_stage_tvalid[0] = s_axis_tvalid;
assign s_axis_tready = IS_TREADY ? axis_stage_tready[0] : 1'b1;
assign axis_stage_tlast[0] = IS_TLAST ? s_axis_tlast : 1'b0;
assign m_axis_tdata_tmp = axis_stage_tdata[STAGES];
assign m_axis_tdata = DIR ? m_axis_tdata_tmp[DATA_WIDTH*CHAN_NUM-1:0] : m_axis_tdata_tmp[DATA_WIDTH*CHAN_ACT-1-:DATA_WIDTH*CHAN_NUM];
assign m_axis_tvalid = axis_stage_tvalid[STAGES];
assign axis_stage_tready[STAGES] = IS_TREADY ? m_axis_tready : 1'b1;
assign m_axis_tlast = IS_TLAST ? axis_stage_tlast[STAGES] : 1'b0;

genvar stage;
genvar block;

generate for (stage = 0; stage < STAGES; stage = stage + 1) begin: SORT_STAGE
	localparam BLOCKS = CHAN_ACT / 2**(stage+1);
	localparam BLOCK_ORDER = stage;
		
	wire [STAGE_DATA_WIDTH-1:0]s_axis_stage_tdata;
	wire s_axis_stage_tvalid;
	wire s_axis_stage_tready;
	wire s_axis_stage_tlast;
	wire [STAGE_DATA_WIDTH-1:0]m_axis_stage_tdata;
	wire m_axis_stage_tvalid;
	wire m_axis_stage_tready;
	wire m_axis_stage_tlast;
		
	assign s_axis_stage_tdata = axis_stage_tdata[stage];
	assign s_axis_stage_tvalid = axis_stage_tvalid[stage];
	assign axis_stage_tready[stage] = s_axis_stage_tready;
	assign s_axis_stage_tlast = axis_stage_tlast[stage];
	assign axis_stage_tdata[stage + 1] = m_axis_stage_tdata;
	assign m_axis_stage_tready = axis_stage_tready[stage + 1];
	assign axis_stage_tvalid[stage + 1] = m_axis_stage_tvalid;
	assign axis_stage_tlast[stage + 1] = m_axis_stage_tlast;

	for (block = 0; block < BLOCKS; block = block + 1) begin: BLOCK
		localparam BLOCK_DATA_WIDTH = DATA_WIDTH*2**(BLOCK_ORDER+1);
		localparam BLOCK_POLARITY = DIR ? (~block & 1) : (block & 1);
			
		wire [BLOCK_DATA_WIDTH-1:0]s_axis_block_tdata;
		wire [BLOCK_DATA_WIDTH-1:0]m_axis_block_tdata;
			
		assign s_axis_block_tdata = s_axis_stage_tdata[BLOCK_DATA_WIDTH*(block+1)-1-:BLOCK_DATA_WIDTH];
		assign m_axis_stage_tdata[BLOCK_DATA_WIDTH*(block+1)-1-:BLOCK_DATA_WIDTH] = m_axis_block_tdata;
		
		if (block == 0) begin
			axis_bitonic_block #(
				.DATA_WIDTH(DATA_WIDTH),
				.ORDER(BLOCK_ORDER),
				.POLARITY(BLOCK_POLARITY),
				.SIGNED(SIGNED)
			) abb_inst (
				.aclk(aclk),
				.aresetn(aresetn),
				.s_axis_tdata(s_axis_block_tdata),
				.s_axis_tvalid(s_axis_stage_tvalid),
				.s_axis_tready(s_axis_stage_tready),
				.s_axis_tlast(s_axis_stage_tlast),
				.m_axis_tdata(m_axis_block_tdata),
				.m_axis_tvalid(m_axis_stage_tvalid),
				.m_axis_tready(m_axis_stage_tready),
				.m_axis_tlast(m_axis_stage_tlast)
			);
		end else begin
			axis_bitonic_block #(
				.DATA_WIDTH(DATA_WIDTH),
				.ORDER(BLOCK_ORDER),
				.POLARITY(BLOCK_POLARITY),
				.SIGNED(SIGNED)
			) abb_inst (
				.aclk(aclk),
				.aresetn(aresetn),
				.s_axis_tdata(s_axis_block_tdata),
				.s_axis_tvalid(s_axis_stage_tvalid),
				.s_axis_tready(),
				.s_axis_tlast(),
				.m_axis_tdata(m_axis_block_tdata),
				.m_axis_tvalid(),
				.m_axis_tready(m_axis_stage_tready),
				.m_axis_tlast()
			);
		end
	end
end endgenerate

endmodule