⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fftcrom.vhd

📁 基于存储器的基4按频率抽取的fft 的vhdl描述 可以对连续数据流进行256点的fft
💻 VHD
字号:
library ieee;	use ieee.std_logic_1164.all;	use IEEE.std_logic_arith.all;--	use IEEE.math_real.all;	use IEEE.math_complex.all;library work;	use work.fftDef.all;	--	use work.fftDataType.all;	entity fftCRom is	port(			clk : in std_logic;			enable : in std_logic; --to disable coeficient look up at lass pass			coefk1 : in slvAddrt;			coefo1, coefo2, coefo3 : out slvCoeft;			neg2, neg3 : out std_logic;			xc2, xc3 : out std_logic		);end entity fftCRom;	library ieee;    use ieee.std_logic_textio.all;library std;	use std.textio.all;architecture std_behavior of fftCRom is		type romtype is array((2 ** Addrw)/4  -1 downto 0) of slvCoeft;   	 		constant rom1 : romtype := --fromFile("rom1b.rom",1);				("0111110011100110000000000011",				"0111100111011110000000001010",				"0111011011100110000000010111",				"0111010000000010000000101000",				"0111000100101110000000111110",				"0110111001101010000001011001",				"0110101110110010000001111001",				"0110100100001110000010011110",				"0110011001110010000011001000",				"0110001111100110000011110110",				"0110000101100010000100101001",				"0101111011101110000101100001",				"0101110010000110000110011110",				"0101101000100110000111011111",				"0101011111010010001000100101",				"0101010110000110001001110000",				"0101001101000110001010111111",				"0101000100001110001100010011",				"0100111011011110001101101011",				"0100110010111010001111001000",				"0100101010011010010000101001",				"0100100010000010010010001110",				"0100011001110010010011110111",				"0100010001101010010101100101",				"0100001001101010010111010111",				"0100000001101110011001001101",				"0011111001111010011011000110",				"0011110010001010011101000100",				"0011101010100010011111000101",				"0011100010111110100001001011",				"0011011011011110100011010011",				"0011010100000110100101100000",				"0011001100110010100111110000",				"0011000101100010101010000011",				"0010111110010110101100011010",				"0010110111001110101110110100",				"0010110000001010110001010001",				"0010101001001010110011110001",				"0010100010001110110110010011",				"0010011011010110111000111001",				"0010010100011110111011100010",				"0010001101101110111110001101",				"0010000110111111000000111011",				"0010000000001111000011101011",				"0001111001100111000110011101",				"0001110010111111001001010010",				"0001101100011011001100001001",				"0001100101110111001111000010",				"0001011111010111010001111100",				"0001011000110111010100111001",				"0001010010011011010111110111",				"0001001011111111011010110110",				"0001000101100011011101111000",				"0000111111001011100000111010",				"0000111000110011100011111110",				"0000110010011011100111000010",				"0000101100000111101010001000",				"0000100101110011101101001110",				"0000011111011111110000010110",				"0000011001001011110011011110",				"0000010010110111110110100110",				"0000001100100111111001101111",				"0000000110010011111100110111",				"0000000000000000000000000000");		constant rom2 : romtype := --fromFile("rom2b.rom",2);			(	"1111110011011100000110010001",				"1111100110111000001100100010",				"1111011010010000010010110010",				"1111001101101000011000111110",				"1111000000111000011111000110",				"1110110100000100100101001010",				"1110100111001100101011000111",				"1110011010001100110000111110",				"1110001101000100110110101110",				"1101111111110100111100010101",				"1101110010010101000001110011",				"1101100100101101000111000111",				"1101010110111001001100001111",				"1101001000110101010001001100",				"1100111010100001010101111101",				"1100101011111101011010100000",				"1100011101000101011110110101",				"1100001101111001100010111100",				"1011111110010101100110110011",				"1011101110011001101010011011",				"1011011110000001101101110010",				"1011001101001001110000111000",				"1010111011110101110011101101",				"1010101001111101110110010000",				"1010010111011101111000100001",				"1010000100010101111010011111",				"1001110000011101111100001010",				"1001011011110101111101100010",				"1001000110011001111110100111",				"1000110000000001111111011000",				"1000011000100101111111110110",				"0111111111111110000000000000",				"0111100111011110000000001010",				"0111010000000010000000101000",				"0110111001101010000001011001",				"0110100100001110000010011110",				"0110001111100110000011110110",				"0101111011101110000101100001",				"0101101000100110000111011111",				"0101010110000110001001110000",				"0101000100001110001100010011",				"0100110010111010001111001000",				"0100100010000010010010001110",				"0100010001101010010101100101",				"0100000001101110011001001101",				"0011110010001010011101000100",				"0011100010111110100001001011",				"0011010100000110100101100000",				"0011000101100010101010000011",				"0010110111001110101110110100",				"0010101001001010110011110001",				"0010011011010110111000111001",				"0010001101101110111110001101",				"0010000000001111000011101011",				"0001110010111111001001010010",				"0001100101110111001111000010",				"0001011000110111010100111001",				"0001001011111111011010110110",				"0000111111001011100000111010",				"0000110010011011100111000010",				"0000100101110011101101001110",				"0000011001001011110011011110",				"0000001100100111111001101111",				"0000000000000000000000000000");		constant rom3 : romtype := --fromFile("rom3b.rom",3);			(	"0111011011100110000000010111",				"0110111001101010000001011001",				"0110011001110010000011001000",				"0101111011101110000101100001",				"0101011111010010001000100101",				"0101000100001110001100010011",				"0100101010011010010000101001",				"0100010001101010010101100101",				"0011111001111010011011000110",				"0011100010111110100001001011",				"0011001100110010100111110000",				"0010110111001110101110110100",				"0010100010001110110110010011",				"0010001101101110111110001101",				"0001111001100111000110011101",				"0001100101110111001111000010",				"0001010010011011010111110111",				"0000111111001011100000111010",				"0000101100000111101010001000",				"0000011001001011110011011110",				"0000000110010011111100110111",				"1111110011011100000110010001",				"1111100000100100001111101010",				"1111001101101000011000111110",				"1110111010100000100010001000",				"1110100111001100101011000111",				"1110010011101000110011110111",				"1101111111110100111100010101",				"1101101011100101000100011110",				"1101010110111001001100001111",				"1101000001101101010011100110",				"1100101011111101011010100000",				"1100010101100001100000111011",				"1011111110010101100110110011",				"1011100110010001101100001001",				"1011001101001001110000111000",				"1010110010111101110101000001",				"1010010111011101111000100001",				"1001111010100001111011010111",				"1001011011110101111101100010",				"1000111011010101111111000010",				"1000011000100101111111110110",				"0111110011100110000000000011",				"0111010000000010000000101000",				"0110101110110010000001111001",				"0110001111100110000011110110",				"0101110010000110000110011110",				"0101010110000110001001110000",				"0100111011011110001101101011",				"0100100010000010010010001110",				"0100001001101010010111010111",				"0011110010001010011101000100",				"0011011011011110100011010011",				"0011000101100010101010000011",				"0010110000001010110001010001",				"0010011011010110111000111001",				"0010000110111111000000111011",				"0001110010111111001001010010",				"0001011111010111010001111100",				"0001001011111111011010110110",				"0000111000110011100011111110",				"0000100101110011101101001110",				"0000010010110111110110100110",				"0000000000000000000000000000");		signal  coef1kRdReg, coef2kRdReg, coef3kRdReg : slvAddrt;		signal coefkRdReg : slvAddrt := (others => '0');		signal N : integer;		constant PI : real := 3.1415926535897932384626433832795;	begin	CoefRom: process(clk) is	  begin				--last state, out put the coef												--if rising_edge(clk) then					 				--end if;				----				----							--state 2, the second coef is ready				if rising_edge(clk) then					coef1kRdReg <= coefkRdReg;					coef3kRdReg <= coefkRdReg;-- + coefkRdReg + coefkRdReg;					coef2kRdReg <= coefkRdReg;-- + coefkRdReg;				end if;					   if rising_edge(clk) then			   if enable = '1' then				--state 0, read the fist coef's address					coefkRdReg <= coefk1;				end if;			end if;							end process CoefRom;		      N <= conv_integer(coef1kRdReg(addrw -2 downto 0));      		coefo1 <= --rom1(conv_integer(coef1kRdReg(addrw -2 downto 0)));		          createCoeft(-tan(-PI*real(N)/real(2**addrw)),		          sin(-2.0*PI*real(N)/real(2**addrw)));		coefo2 <= --rom2(conv_integer(coef2kRdReg(addrw -2 downto 0)));		          createCoeft((cos(-2.0*PI*real(2*N)/real(2**addrw))+1.0)/sin(-2.0*PI*real(2*N)/real(2**addrw)),-sin(-2.0*PI*real(2*N)/real(2**addrw)))		          when (2*N) > (2**Addrw/4) else		          createCoeft(-tan(-PI*real(2*N)/real(2**addrw)),		          sin(-2.0*PI*real(2*N)/real(2**addrw))); 		coefo3 <= --rom3(conv_integer(coef3kRdReg(addrw -2 downto 0)));		          createCoeft((cos(-2.0*PI*real(3*N)/real(2**addrw))+1.0)/sin(-2.0*PI*real(3*N)/real(2**addrw)),-sin(-2.0*PI*real(3*N)/real(2**addrw)))		          when (3*N) > (2**Addrw/4) else		          createCoeft(-tan(-PI*real(3*N)/real(2**addrw)),		          sin(-2.0*PI*real(3*N)/real(2**addrw))); 		      		xc2 <= '1' when (2*N) = (2**Addrw/4) else		      '0';		xc3 <= '1' when (3*N) = (2**Addrw/4) else		      '0';      neg2 <= '1' when (2*N) > (2**Addrw/4) else		      '0';		neg3 <= '1' when (3*N) > (2**Addrw/4) else		      '0';	end architecture std_behavior;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -