Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Sum of Squares of the Arithmetic ---

Status
Not open for further replies.

arunragavan

Advanced Member level 1
Joined
Jul 1, 2004
Messages
415
Helped
30
Reputation
60
Reaction score
9
Trophy points
1,298
Location
India
Activity points
5,028
Can anyone gimme an idea of implementing sum of squares of arithmetic on FPGA.. a verilog or VHDL codin wud be really useful

with regards,
 

Here is a Verilog module that continuously counts, squares the count value, and accumulates the squares.

Code:
module top (clk, sum);
  input             clk;
  reg        [15:0] count = 0;
  output reg [31:0] sum = 0;

  always @ (posedge clk) begin
    count <= count + 1;
    sum <= sum + count * count;
  end
endmodule
 

echo47 said:
Here is a Verilog module that continuously counts, squares the count value, and accumulates the squares.

Code:
module top (clk, sum);
  input             clk;
  reg        [15:0] count = 0;
  output reg [31:0] sum = 0;

  always @ (posedge clk) begin
    count <= count + 1;
    sum <= sum + count * count;
  end
endmodule


i agree with this code.. but how is it advantageous over the mathematical formula for the sum of squares,

n*(n+1)*(2n+1)/6;

is it becoz it requires more multiplication and a division every time???

and moreover, when wll ur module end?


/cedance
 

The original question was very simple, so I gave a minimal example. He didn't say what values he wanted to square, so I used a counter. He didn't say when it should stop, so it doesn't stop.

I'm guessing he is starting to learn Verilog, and needed a simple "hello world" example to build upon.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top