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.

How to calculate a power of y in VHDL ?

Status
Not open for further replies.

Cutey

Member level 2
Joined
Nov 6, 2009
Messages
51
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,607
Hi people
how to calculate X^y in VHDL, actually i have a program in vhdl to multiply two number using shift adder and I want to modify it to power of y.
here is my code multiply m by n, and I need to insert loop operation to work as multiply m by m for n time.....


rchitecture Behavioral of MUL is
signal count:integer:= 0;
signal n1,m1,nn:std_logic_vector(31 downto 0);
signal result1:std_logic_vector(63 downto 0);
begin
process(clk)

begin

if (rising_edge(clk))then
if( start = '1' )then
result<="0000000000000000000000000000000000000000000000000000000000000000";
result1<="0000000000000000000000000000000000000000000000000000000000000000";
count <=0;


else



if (count /= 32 )then
if (m1(0)='1')then
result1<=result1+n1;
end if ;
n1 <=n1(30 downto 0) & '0';
m1 <='0'& m1 (31 downto 1);
count <=count+1;
end if ;
end if;
end if ;
-- end loop;

result<=result1;
 
Last edited:

Re: Power of y in VHDL

This is not going to be trivial. Loops do not exist on hardware without some control logic. A loop in VHDL just unrolls to some parrallel hardware. This will give you a fixed amount of time always.
The best thing to do is find an algorithm to implement x^y and think about it in terms of hardware
 

Re: Power of y in VHDL

even if don't use loop operation, I think it is possible to modify it by using if statement, am I correct?
 

Re: Power of y in VHDL

a x^y calculation will be a multi-stage pipeline.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top