hallovipin
Member level 1
Hi;
consider the following code which is written to generate a histogram (channel vs count)
input peak found, write_spectrum, first_byte, reset;
input [7:0] data_in
output tx_data;
reg [15:0] spectrum [255:0];
reg [9:0] chann_cnt;
wire tx_temp_data;
reg [7:0] addr_r;
integer i;
/////////////////// Writing data //////////////////////////
always @(posedge peak_found) begin
if(reset)
for(i=0;i<256;i=i+1)
spectrum<=16'd0;
else
if(!write_spectrum)
spectrum[data_in]<=spectrum[data_in];
else
spectrum[data_in]<=spectrum[data_in]+16'd1;
end
//////////////// Reading data ////////////////
always @(posedge txclk, posedge reset)
if(reset) begin
chann_cnt<=10'd0;
first_byte<=1'b1;
end
else
if(write_spectrum)begin
chann_cnt<=10'd0;
first_byte<=1'b1;
end
else
if(chann_cnt==256)
chann_cnt<=10'd0;
else begin
if(first_byte) begin
tx_data<=tx_temp_data;
first_byte<=1'b0;
chann_cnt<=chann_cnt+8'd1;
addr_r<=chann_cnt;
end
else begin
tx_data<=tx_temp_data;
first_byte<=1'b1;
end
end
assign tx_temp_data=first_byte?spectrum[addr_r][15:8]:spectrum[addr_r][7:0];
Now the problem is that ISE (xilinx synthesis tool) is using Flip flops for generating 256*16 ([15:0] spectrum [255:0] ) buffer instead of lukup tables or available block RAm resources. This way I am exceeding the total number of available flip flop slices.
What to do.. so that I can utilize lukup tables or BLOCK RAM.
consider the following code which is written to generate a histogram (channel vs count)
input peak found, write_spectrum, first_byte, reset;
input [7:0] data_in
output tx_data;
reg [15:0] spectrum [255:0];
reg [9:0] chann_cnt;
wire tx_temp_data;
reg [7:0] addr_r;
integer i;
/////////////////// Writing data //////////////////////////
always @(posedge peak_found) begin
if(reset)
for(i=0;i<256;i=i+1)
spectrum<=16'd0;
else
if(!write_spectrum)
spectrum[data_in]<=spectrum[data_in];
else
spectrum[data_in]<=spectrum[data_in]+16'd1;
end
//////////////// Reading data ////////////////
always @(posedge txclk, posedge reset)
if(reset) begin
chann_cnt<=10'd0;
first_byte<=1'b1;
end
else
if(write_spectrum)begin
chann_cnt<=10'd0;
first_byte<=1'b1;
end
else
if(chann_cnt==256)
chann_cnt<=10'd0;
else begin
if(first_byte) begin
tx_data<=tx_temp_data;
first_byte<=1'b0;
chann_cnt<=chann_cnt+8'd1;
addr_r<=chann_cnt;
end
else begin
tx_data<=tx_temp_data;
first_byte<=1'b1;
end
end
assign tx_temp_data=first_byte?spectrum[addr_r][15:8]:spectrum[addr_r][7:0];
Now the problem is that ISE (xilinx synthesis tool) is using Flip flops for generating 256*16 ([15:0] spectrum [255:0] ) buffer instead of lukup tables or available block RAm resources. This way I am exceeding the total number of available flip flop slices.
What to do.. so that I can utilize lukup tables or BLOCK RAM.