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.

about how to write a vhdl code for lut for coefficients

Status
Not open for further replies.

kannan2590

Member level 4
Member level 4
Joined
Sep 1, 2012
Messages
77
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Location
india
Visit site
Activity points
2,321
Suppose i have coefficients like ffee(1111111111101110),fffe,ffd0,ffe0.......ff45.
Can you tell me with a vhdl code about how to arrange these coefficients in LUT and then calling them for multiplication in filters.
 

What do you mean by "arrange these coefficients in LUT" ?

Actually my question is i want to write a vhdl code for arranging the mentioned coefficients in LUT (Look up table).Can you suggest me how to write it and call it for multiplication in filters.Whether a counter is needed for arranging in LOOK UP TABLE.
 

If you mean storing something in special LUTs, I have to say you don't have access to LUTs or at least I don't know how to access LUTs.
But if you wanna simply store them and recall them, it is easy. If you mean this tell me to explain it for U.
 

If you mean storing something in special LUTs, I have to say you don't have access to LUTs or at least I don't know how to access LUTs.
But if you wanna simply store them and recall them, it is easy. If you mean this tell me to explain it for U.

please explain it to me
 

ohh...
You just need to write a 2 dimensional memory, then in each address you store your number. then you increase your address and store your next number.
for example:

subtype Mem1D is STD_LOGIC_VECTOR(15 downto 0);
type Mem2D is array(0 to 255) of Mem1D;
signal b_reg, b_next: Mem2D; //now b_reg is your memory and you can store your numbers
b_next(0) <= ffee;
b_next(1) <= fdac;
.
.
.

Did you want this?
 
Last edited:

ohh...
You just need to write a 2 dimensional memory, then in each address you store your number. then you increase your address and store your next number.
for example:

subtype Mem1D is STD_LOGIC_VECTOR(15 downto 0);
type Mem2D is array(0 to 255) of Mem1D;
signal b_reg, b_next: Mem2D; //now b_reg is your memory and you can store your numbers
b_next(0) <= ffee;
b_next(1) <= fdac;
.
.
.

Did you want this?

I expected like this below

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_SIGNED.ALL;


entity filter10 is
Port ( clk : in STD_LOGIC;

clk_120mbps: in std_logic;
reset : in STD_LOGIC;
din : in STD_LOGIC_vector(7 downto 0);
ifiltout : out STD_LOGIC_vector(23 downto 0)
);
end filter10;

architecture Behavioral of filter10 is

signal H00,H032,H064 : STD_LOGIC_vector(15 downto 0) := (others => '0');

signal MCM00, add_out01, add_out02,MCM01, MCM02: STD_LOGIC_vector(23 downto 0) := (others => '0');


--signal Q01,Q02,Q03 : STD_LOGIC_vector(31 downto 0) := (others => '0');
signal Q1,Q2:std_logic_vector(23 downto 0):=(others =>'0');



begin
P20:pROCESS(clk,RESET)
VARIABLE CNT:STD_LOGIC_VECTOR(5 DOWNTO 0):="000000";
BEGIN


IF RESET='0' THEN
CNT:="000000";
add_out02<="000000000000000000000000";
ELSIF clk='1' AND clk'EVENT THEN


CNT := CNT +1;
CASE CNT IS
WHEN "000001"=> H00 <= "1111111110101011";
H032<= "0011111010011011";
H064<= "0000001100000010";


WHEN "000010"=> H00 <= "0111110100100100";
H032<= "0100000111111101";
H064<= "0000000100001111";


WHEN "000011"=> H00 <= "1011110010011111";
H032<= "0100010100000111";
H064<= "1111111101011000";


WHEN "000100"=> H00 <= "1111110000100001";
H032<= "0100011110101100";
H064<= "1111110111110001";


WHEN "000101"=> H00 <= "1011101110101101";
H032<= "0100100111100110";
H064<= "1111110011010011";



WHEN "000110"=> H00 <= "1011101101001100";
H032<= "0100101110101110";
H064<= "1111101111111011";


WHEN "000111"=> H00 <= "0111101100000011";
H032<= "0100110011110101";
H064<= "1111101101100000";


WHEN "001000"=> H00 <= "1011101011011010";
H032<= "0100110110111010";
H064<= "1111101100000011";

WHEN "001001"=> H00 <= "1011101011010111";
H032<= "0100110111111100";
H064<= "1111101011010110";


WHEN "001010"=> H00 <= "1011101100000010";
H032<= "0100110110111010";
H064<= "1111101011011011";


WHEN "001011"=> H00 <= "1011101101100000";
H032<= "0100110011110101";
H064<= "1111101100000010";


WHEN "001100"=> H00 <= "1011101111111001";
H032<= "0100101110101101";
H064<= "1111101101001101";


WHEN "001101"=> H00 <= "1011110011010010";
H032<= "0100100111100101";
H064<= "1111101110101111";


WHEN "001110"=>H00 <= "0111110111110000";
H032<= "0100011110101101";
H064<= "1111110000100001";

----
WHEN "001111"=> H00 <= "0111111101011001";
H032<= "0100010100000111";
H064<= "1111110010011110";


WHEN "010000"=> H00 <= "0100000100001111";
H032<= "0100000111111101";
H064<= "1111110100100101";


WHEN "010001"=> H00 <= "0100001100010010";
H032<= "0011111010011011";
H064<= "1111110110101010";


WHEN "010010"=> H00 <= "0100010101100110";
H032<= "0011101011101111";
H064<= "1000000000000000";



WHEN "010011"=> H00 <= "0000100000001001";
H032<= "0011011100000011";
H064<= "0100000000000000";


WHEN "010100"=> H00 <= "0000101011111000";
H032<= "0011001011100111";
H064<= "1000000000000000";


WHEN "010101"=> H00 <= "0000111000110011";
H032<= "0010111010101111";
H064<= "1000000000000000";



WHEN "010110"=> H00 <= "0001000110101110";
H032<= "0010101001010110";
H064<= "0000000001000000";


WHEN "010111"=> H00 <= "1001010101101010";
H032<= "0010010111111110";
H064<= "0000000000000001";



WHEN "011000"=> H00 <= "0101010101101010";
H032<= "0010010111111111";
H064<= "0000000100000000";


WHEN "011001"=> H00 <= "0001110101110100";
H032<= "0001110101101100";
H064<= "0100000000000000";


WHEN "011010"=> H00 <= "0010000110101001";
H032<= "0001100101011010";
H064<= "1000000000000000";


WHEN "011011"=> H00 <= "0010010111111101";
H032<= "0001010101101011";
H064<= "1000000000000000";


WHEN "011100"=> H00 <= "0010101001010110";
H032<= "0001000110101101";
H064<= "0000000000000001";


WHEN "011101"=> H00 <= "0110111010101000";
H032<= "0000111000110110";
H064<= "1000000000000000";


WHEN "011110"=> H00 <= "0011001011101010";
H032<= "0000101011111010";
H064<= "0000000010000000";


WHEN "011111"=> H00 <= "0111011100000010";
H032<= "0000100000001101";
H064<= "0110000000000000";


WHEN "100000"=> H00 <= "0011101011101100";
H032<= "0000010101100100";
H064<= "0000000000000010";

--
CNT := "000000";
when others => H00 <= "0000000000000000";
H032<= "0000000000000000";
H064<= "0000000000000000";


END CASE;
--CNT <= CNT +1;
END IF;
END PROCESS P20;

P40:pROCESS(clk,RESET)
BEGIN
IF RESET='0' THEN

Q1<="000000000000000000000000";
Q2<="000000000000000000000000";
ELSIF clk'EVENT AND clk='1' THEN


MCM00 <= (din*H064);
MCM01 <= (din*H032);
MCM02 <= (din*H00);
add_out01 <= Q1+MCM01;
add_out02 <= Q2+MCM02;
Q1<=MCM00;
Q2<=add_out01;

END IF;
END PROCESS P40;


I wanted like this .The problem is for a particular count value the values of H00,H064,H032 must be multiplied in the MCM00,MCM01,MCM02,Which is not happening.Can you suggest me how to extract coefficient values and store during the multiplication with din.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top