how to optimize this comparator for better synthesis result?

  • Thread starter water9580@yahoo.com
  • Start date
W

water9580@yahoo.com

Guest
wire [6:0] length;
wire [11:0] addr;



assign len_lte=((addr[11:2]+length)<=13'h400)?1'b1:1'b0;

thx
 
On Apr 29, 11:56 pm, "water9...@yahoo.com" <water9...@yahoo.com>
wrote:
length;
wire [11:0] addr;

assign len_lte=((addr[11:2]+length)<=13'h400)?1'b1:1'b0;

thx
It would help to know:

What you are synthesizing this code into.

What results are not adequate (speed, resource usage)

Are there any useful properties of length or addr that might
help (i.e. one or the other is static or changes only when
len_lte is not required to be valid)

Why does 13'h400 need 13 bits when you compare it to a
sum of 10 and 7 bit numbers

why the (a <= b) ? 1 : 0; format instead of just a <= b;

Regards,
Gabor
 
On Apr 30, 8:49 pm, gabor <ga...@alacron.com> wrote:
On Apr 29, 11:56 pm, "water9...@yahoo.com" <water9...@yahoo.com
wrote:

wire [6:0] length;
wire [11:0] addr;

assign len_lte=((addr[11:2]+length)<=13'h400)?1'b1:1'b0;

thx

It would help to know:

What you are synthesizing this code into.

What results are not adequate (speed, resource usage)

Are there any useful properties of length or addr that might
help (i.e. one or the other is static or changes only when
len_lte is not required to be valid)

Why does 13'h400 need 13 bits when you compare it to a
sum of 10 and 7 bit numbers

why the (a <= b) ? 1 : 0; format instead of just a <= b;

Regards,
Gabor
my solution:

assign addr_pg=addr[11:2]+length;


always @(*)
begin
if(addr_pg[10])
begin
if(|addr_pg[9:0])
tlp_length=start_dist4k;
else
tlp_length=tlp_length1;
end
else
begin
tlp_length=tlp_length1;
end
end

it can remove a big comparator.

any better coding style?
 

Welcome to EDABoard.com

Sponsor

Back
Top