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.

Polynomial implimentation in verilog

Status
Not open for further replies.

nasim nasirian

Newbie level 3
Joined
Oct 19, 2008
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,307
Hi
I use ISE 10.1 for mu work. I need to implement a polynomial like this: (1+ x.^3+x.^5 ). My input is a register with 36 bits. How can I do that?

I would be grateful If you can help me.


Nasim:cry:
 

Lets say x is your input and y is output.

y= 1+ x^3 + x^5.

now

x^3 is shifting x to right by 3 bits....i.e
x^3 = {x,3'b000};

similarly
x^5 = {x,5'b00000};

now you also want to add 1 so instead of shifting by three zeros shift by 001 i.e.

x^5 = {x,5'b001};

so finally we have

y= 1+ x^3 + x^5. as

y = {x,3'b000} + {x,3'b001};
 

Many thanks for your consideration Kvingle.
Is it possible to use * operator instead of shifting register;such as :

module Non_linear(a, out, clk);

input clk;
input [52:0] a;
output reg [158:0] out;

assign out = a*a*a+a*a*a*a*a+1 ;
endmodule

I mean I want to create a verilog module and add it to my project like IP cores, and use it in different places. I have sine wave signal, that is stored in a 53 bits register, I want to affect the nonlinear polynomial on my signal, and then view the result signal, I' m a little confused , Another question is that which bits is important or as a result I should MSB bits of output or LSB?

Thanks
Nasim
 

kvingle said:
Lets say x is your input and y is output.

y= 1+ x^3 + x^5.

now

x^3 is shifting x to right by 3 bits....i.e
x^3 = {x,3'b000};

similarly
x^5 = {x,5'b00000};

now you also want to add 1 so instead of shifting by three zeros shift by 001 i.e.

x^5 = {x,5'b001};

so finally we have

y= 1+ x^3 + x^5. as

y = {x,3'b000} + {x,3'b001};


I don't think this will work can you please prove it ?????
 

I don't think this will work
Quite right. Obviously there's a little difference between x*8 (respectively x<<3) and x^3.

Polynomial calculation means repeated multiply as the original poster mentioned, but it can't be replaced by a shift operation.
As an additional problem, that hasn't been considered in the thread yet, the result has to be truncated to fit the required bit
width. The unrestricted result of x^5 has e.g. 180 bits.
 

Yes indeed. nasim nasirian.
I didn't notice the little difference.
FvM is right.(thanks)
 

Thanks fro your responses , those were very helpful, I finally use assign and * operator like this:assign mult_out = a_reg * b_reg * c_reg;

always@(posedge clk)

begin
a_reg <= a;
b_reg <= b;
c_reg <= c;
out <= mult_out;
end


and it works but we should consider the truncation bits and find out how choose the important bit, Now I have a problem in selecting data , for examle : my output is 51 bits and which bits are important and which of them should be truncated?
 

my output is 51 bits and which bits are important and which of them should be truncated?
The answer depends on the definition of your polynomial respectively the range and number format of x. We can't know it.

The problem however isn't specific to HDL coding, you also have it when calculating the result with pencil and paper
method. You should be able to solve it this way.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top