Line 1... |
Line 1... |
`timescale 1ns / 1ps
|
`timescale 1ns / 1ps
|
//////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////
|
// Company:
|
// Company: UPT
|
// Engineer:
|
// Engineer: Constantina-Elena Gavriliu
|
//
|
//
|
// Create Date: 18:50:09 10/17/2013
|
// Create Date: 18:50:09 10/17/2013
|
// Design Name:
|
// Design Name:
|
// Module Name: leading_zeros
|
// Module Name: leading_zeros
|
// Project Name:
|
// Project Name:
|
// Target Devices:
|
// Target Devices:
|
// Tool versions:
|
// Tool versions:
|
// Description:
|
// Description:
|
//
|
//
|
// Dependencies:
|
// Dependencies: d_ff.v
|
//
|
//
|
// Revision:
|
// Revision:
|
// Revision 0.01 - File Created
|
// Revision 0.01 - File Created
|
// Additional Comments:
|
// Additional Comments:
|
//
|
//
|
Line 63... |
Line 63... |
generate
|
generate
|
begin : level_generation_begin
|
begin : level_generation_begin
|
genvar i;
|
genvar i;
|
for (i = 1; i <= nr_levels - 1; i = i + 1)
|
for (i = 1; i <= nr_levels - 1; i = i + 1)
|
begin : level_generation
|
begin : level_generation
|
//begin : v_levels_begin
|
|
genvar j;
|
genvar j;
|
for (j = 0; j <= max_pow_2/(2 ** (i + 2)) - 1; j = j + 1)
|
for (j = 0; j <= max_pow_2/(2 ** (i + 2)) - 1; j = j + 1)
|
begin : v_levels
|
begin : v_levels
|
assign v_d[i][j] = v_q[i - 1][2*j+1] | v_q[i - 1][2*j];
|
assign v_d[i][j] = v_q[i - 1][2*j+1] | v_q[i - 1][2*j];
|
end
|
end
|
//end
|
|
|
|
//begin : p_levels_begin
|
|
// genvar j;
|
|
for (j = 0; j <= max_pow_2/(2 ** (i + 2)) - 1; j = j + 1)
|
for (j = 0; j <= max_pow_2/(2 ** (i + 2)) - 1; j = j + 1)
|
begin : p_levels
|
begin : p_levels
|
assign p_d[i][(i+2)*j+i+1] = (~(v_q[i - 1][2*j+1]));
|
assign p_d[i][(i+2)*j+i+1] = (~(v_q[i - 1][2*j+1]));
|
assign p_d[i][(i+2)*j+i : (i+2)*j] = (v_q[i - 1][2*j+1] == 1'b1) ? p_q[i - 1][j*(2*i+2)+2*i+1 : j*(2*i+2) + i + 1] : p_q[i - 1][j*(2*i+2)+i : j*(2*i+2)];
|
assign p_d[i][(i+2)*j+i : (i+2)*j] = (v_q[i - 1][2*j+1] == 1'b1) ? p_q[i - 1][j*(2*i+2)+2*i+1 : j*(2*i+2) + i + 1] : p_q[i - 1][j*(2*i+2)+i : j*(2*i+2)];
|
end
|
end
|
//end
|
|
end
|
end
|
end
|
end
|
endgenerate
|
endgenerate
|
|
|
generate
|
generate
|
if (PIPELINE != 0)
|
if (PIPELINE != 0)
|
begin : pipeline_stages
|
begin : pipeline_stages
|
//begin : INSERTION_begin
|
|
genvar i;
|
genvar i;
|
for (i = 0; i <= nr_levels - 2; i = i + 1)
|
for (i = 0; i <= nr_levels - 2; i = i + 1)
|
begin : INSERTION
|
begin : INSERTION
|
if ((i + 1) % nr_levels/(PIPELINE + 1) == 0)
|
if ((i + 1) % nr_levels/(PIPELINE + 1) == 0)
|
begin : INS
|
begin : INS
|
Line 102... |
Line 96... |
begin : NO_INS
|
begin : NO_INS
|
assign p_q[i] = p_d[i];
|
assign p_q[i] = p_d[i];
|
assign v_q[i] = v_d[i];
|
assign v_q[i] = v_d[i];
|
end
|
end
|
end
|
end
|
//end
|
|
assign p_q[nr_levels - 1] = p_d[nr_levels - 1];
|
assign p_q[nr_levels - 1] = p_d[nr_levels - 1];
|
assign v_q[nr_levels - 1] = v_d[nr_levels - 1];
|
assign v_q[nr_levels - 1] = v_d[nr_levels - 1];
|
end
|
end
|
endgenerate
|
endgenerate
|
|
|
generate
|
generate
|
if (PIPELINE == 0)
|
if (PIPELINE == 0)
|
begin : no_pipeline
|
begin : no_pipeline
|
//begin : xhdl4
|
|
genvar i;
|
genvar i;
|
for (i = 0; i <= nr_levels - 1; i = i + 1)
|
for (i = 0; i <= nr_levels - 1; i = i + 1)
|
begin : NO_INSERTION
|
begin : NO_INSERTION
|
assign p_q[i] = p_d[i];
|
assign p_q[i] = p_d[i];
|
assign v_q[i] = v_d[i];
|
assign v_q[i] = v_d[i];
|
end
|
end
|
//end
|
|
end
|
end
|
endgenerate
|
endgenerate
|
|
|
assign lzc[size_lz - 1:0] = p_q[nr_levels - 1][size_lz - 1:0];
|
assign lzc[size_lz - 1:0] = p_q[nr_levels - 1][size_lz - 1:0];
|
|
|