how to find the square root of number by using babylonian method equation: Xn+1=1/2(Xn+(s/Xn)) by using verilog code any one help me ……..I have written a code but its not synthesis not running.
module squre ( input [15:0] a, output reg [15:0] x ); reg [15:0] b; reg [15:0] y [0:9]; integer i; initial b=16'd1; always @(a) begin y=b; for (i=0; i<10; i=i+1) begin y[i+1]= ((y[i]+(a/y[i]))/2); if (y[i+1]==y[i]) begin y=y[i]; i=9; end end x=y; end endmodule
If any problem in program tell me fast. also in this program has to be dividing problem. Tell me how to write the program.