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.

Solve Equations Verilog

Status
Not open for further replies.

Chinmaye

Full Member level 3
Joined
Jan 18, 2016
Messages
164
Helped
0
Reputation
0
Reaction score
1
Trophy points
1,298
Activity points
3,145
Dear all,
I am trying to solve equation of a^7-2a^5-a^2 = -1. How can one implement this in verilog with minimum hardware?
TIA
 

A text editor will do. Vi will run on any linux, so you could probably just use a rasberry PI. You'll probably need some kind of screen and a keyboard.
 

The point is that the equation has no variable input, thus it can be calculated at compilation time and doesn't infer hardware.

The equation has however multiple (three or so) solutions, I'm not quite sure how you want to present it.

If you have a meaningful Verilog problem in mind, please share.
 

So i basically start with an initial guess for variable 'a'. Then i try to compute the equation substituting my initial guess for 'a'. The problem is, 'a' can take a decimal value. As in, if a = 2.187, then, how can one compute 2.187^7 -2*2.187^5-2.187^2 +1 in verilog?
 

Computing exponential in verilog

Dear all,

I have been trying to use exponential function in verilog. I want to calculate an expression like below.
Let x = 3.987
x^6 + x^8- x^5 = 10.

How can this be done in verilog?
TIA
 
Last edited by a moderator:

It's power of n, not exponential function and can be calculated as cascaded multiply.

What do you want to achieve? The equation has multiple solutions, but can be calculated at compile time.
 

Hello,

maybe first famiiarize yourself with one of methods for approximation solving of nonlinear equations - for example Nwewton's method. See links:

https://en.wikipedia.org/wiki/Newton%27s_method

https://www.sciencedirect.com/science/article/pii/S1110256X1300028X

After you read these descriptions and understood them, you could try to implement one of these method in Verilog.

Regards

BTW: this equotation is contrary and has not solutions ! Substitute 1 for a variable and check it yourself.

See: 1^7-2*1^5-1^2 = -1
1-2-1 =-1
-2=-1 -> equotqtions is contrary and has no solutions!
 
Last edited:

in post 1, its a^7, in post its x^6 ?

the number of roots is equal to the highest exponent, so 7 roots and 6 roots, receptively

if all you want is a solution, then use Wolfram Alpha
type in something like "what are the roots of a^7-2a^5-a^2 = -1"
enter, and wait a little while

when i did it, Wolfram Alpha provided 3 real roots and 4 more roots as complex conjugates
it took about 10 seconds

side issue: exponentials involve the base of the natural logs, such as e^x,
or the base of the common logs, such as 10^x
the variable is in the exponent

these equations are polynomials - the exponents are integers
 
Last edited:

BTW: this equotation is contrary and has not solutions ! Substitute 1 for a variable and check it yourself.

See: 1^7-2*1^5-1^2 = -1
1-2-1 =-1
-2=-1 -> equotqtions is contrary and has no solutions![/QUOTE

Sorry- English is not my mother tounge. It shouyld be: contradictory equotation

There is no point to solving these eqotation because it is contradictory, and has no solution.

Maybe you made mistake during writing this equotation if yes please give proper form of this eqotqtion.

Regards
 

this equotation is contrary and has not solutions ! Substitute 1 for a variable and check it yourself.

As shown by wwfeldmann, the post #1 equation has real roots. Similarly the equation in post #5 has two real roots, x=3.987 isn't among it, but x≈-1.2 and x≈1.3.

Post #1 suggests that you want to synthesize hardware logic to perform the calculation. But this is neither useful nor simple.

Firstly it's not useful because the solution is constant and can be calculated at compile time. You can however define a different problem involving variable coefficients as input. Then there's something to calculate at run time.

Secondly it's not simple because real variables aren't synthesisable in logic hardware. You can use either fixed or floating point variables for the calculation.
 

As shown by wwfeldmann, the post #1 equation has real roots. Similarly the equation in post #5 has two real roots, x=3.987 isn't among it, but x≈-1.2 and x≈1.3.

Post #1 suggests that you want to synthesize hardware logic to perform the calculation. But this is neither useful nor simple.

Firstly it's not useful because the solution is constant and can be calculated at compile time. You can however define a different problem involving variable coefficients as input. Then there's something to calculate at run time.

Secondly it's not simple because real variables aren't synthesisable in logic hardware. You can use either fixed or floating point variables for the calculation.

I wonder if the OP wants to create an iterative algorithm to compute the real roots of a polynomial, i.e. enter the polynomial and the design computes the root(s).

One of the issues they seem to be struggling with is that A**B in verilog can't be synthesized unless B is a power of 2 (as that is just a shift operation). To implement an exponentiation of A you have to multiply A (B-1) times using an FSM for example.
 

BTW: this equotation is contrary and has not solutions ! Substitute 1 for a variable and check it yourself.

See: 1^7-2*1^5-1^2 = -1
1-2-1 =-1
-2=-1 -> equotqtions is contrary and has no solutions![/QUOTE

Sorry- English is not my mother tounge. It shouyld be: contradictory equotation

There is no point to solving these eqotation because it is contradictory, and has no solution.

Maybe you made mistake during writing this equotation if yes please give proper form of this eqotqtion.

Regards

Sorry,

I did a mistake, some kind of brain fade :lol:

regards
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top