Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
12 years ago

Polynomial Evaluation

Hello,

I'm totally new to VHDL and i'm trying to do a polynonamial evaluation. In particular I have a signed 16 bit value (x) and I want to obtain y=d*x^3+c*x^2+b*x+a.

I have created a signed multiplier:

LIBRARY ieee;

USE ieee.std_logic_1164.all;

USE ieee.numeric_std.all;

ENTITY my_signed_multiplier IS

PORT( in1, in2 : IN signed (15 DOWNTO 0);

clk,clr : IN std_logic;

result : OUT signed(15 DOWNTO 0));

END ENTITY my_signed_multiplier;

ARCHITECTURE logic OF my_signed_multiplier IS

SIGNAL in1_reg, in2_reg : signed (15 DOWNTO 0);

SIGNAL out_reg : signed (31 DOWNTO 0);

BEGIN

PROCESS(clk,clr)

BEGIN

IF clr ='1' THEN

in1_reg<=(OTHERS => '0');

in2_reg<=(OTHERS => '0');

out_reg<=(OTHERS => '0');

ELSIF rising_edge(clk) THEN

in1_reg<=in1;

in2_reg<=in2;

out_reg<=in1_reg*in2_reg;

END IF;

END PROCESS;

result<=out_reg(31 DOWNTO 16);

END ARCHITECTURE logic;

Now I was supposed to create another entity which has a generic variable (eg: pow : integer ) that specifies how many instance of my_signed multiplier use to obtain the correct signal power elevation. By the way now I'm stuck is I don't know exactly how to do it.

Any suggestions is appreciated . Thank you !

25 Replies