Logic to check 10bit binary number is perfect square or not

can any explain a logic to check whether the 10 bit binary input is perfect square or not.

In reply to mamathamanu:

Is this for synthesizable logic or a test? If it’s for synthesizable logic the easiest thing to do is just create a look up table. If the input number is in the lookup table (0, 1, 4, 9, etc) then it’s a perfect square. If this is for a test you can use the $sqrt function.

In reply to mamathamanu:

can any explain a logic to check whether the 10 bit binary input is perfect square or not.

I can think of something like this :


    int a,b; // b is the input
    a=$sqrt(b);
    if($pow(a,2)==b)
      $display(" b is perfect square, a=%d,b=%d",a,b);

but $sqrt only takes integer or real type as input.

In reply to sbellock:

thanks

In reply to verif_gal:

thanks